#help-development
1 messages Β· Page 1950 of 1
ah ye but is there a difference in outcome when working with booleans?
first of all, I have no idea why you would ever use "if true or false", because that will always be true, and there is no need for an if statement, and for the bitwise operand, the data is only one bit, which will always flip to true. So difference, yes. Different result, no I do not believe so.
oh okay
and if im storing a WeakReference to a player, how long will it stay active?
until the player logs out?
and the server clears it internal
alright
and when is a player object even constructed?
playerjoin event?
i guess
i cant get the player in the prelogin
Player p = (Player) e.getWhoClicked();
final String NAME = ChatColor.GRAY+"Donate for a new Section!";
if (e.getView().getTitle().equalsIgnoreCase(NAME)){
switch (e.getCurrentItem().getType()){
case GRASS_BLOCK:
int hype = plugin.getConfig().getInt("PlayerHype."+p.getName());
if (hype >= 1){
p.sendMessage(ChatColor.GRAY+"You has voted for this section");
plugin.getConfig().set("PlayerHype."+p.getName(), hype-1);
int sk = plugin.getConfig().getInt("Sections.Survival");
plugin.getConfig().set("Sections.Survival", sk+1);
plugin.HypeGui(p);
}else{
p.sendMessage(ChatColor.RED+"You do not have enouch hype "+ChatColor.GRAY+"(1)");
}
break;
e.setcancelled(true);
}```
When i click on item nothing is happened, why?
excuse the parentheses and the spaces between them
do you have the event registered and is ther a @ EventHandler?
Oh, how stupit i can be, ty
Hello
ello
I can't seem to be able to use --remapped in buildtools
I'm trying with 1.18 and 1.18.1 and it says
[WARNING] The requested profile "remapped" could not be activated because it does not exist.
I don't think you need that flag anymore
but i found in some repos that have this
spigot-1.18-R0.1-SNAPSHOT-remapped-mojang.jar
spigot-1.18-R0.1-SNAPSHOT-remapped-obf.jar
oh?
Keep following the instructions without it
Well, yes
oh god me and bitwise
foo.bar() | bar.foo()
Will execute both statements even if first is already true
And || will not
ooh
where is the velocity for the entity that is hit from? I mean the entity moves in the direction it is hit (and up the right height). Where can I get these values?
and im wondering if the player is in the prelogin event, the server already stored the player, so its accessible with Bukkit.getPlayer(uuid)?
i think its only accessible in join or even after it
ye..
something stupid actually
im constructing this user on prelogin
so i guess i'd need to set the user later on
yu
nvm i found them in my local m2 repo
no, tho I suppose you could link me it
i was having some issues
Very weird
lol
Yes that's better; you would have less repeating code related to asynchronousity
Find a better name though
but the problem is im doing everything async now by default and i wouldnt need a wrapper anymore
like this stuff and then i write an implementation for it
It'e about single responsibility
and before i needed to wrap everything with a future where now i dont
hmm ye correct but why would i handle that in another class if all the implementations need a future?
hi
helo
in prelogin event not everything is accessible yet
afaik the player might not be authenticated
the prelogin event, the UUID might be fake IIRC
mhm
i should better do my stuff in the login event i guess
Yes
hm ok
If you are going to make a new Storage impl, then you'd have to use CompletableFutures there - which is boilerplate. Futures needs exceptional handling and executors. With delegate, yoy just write a new storage implementation, and create a new delegating one which will do all asynchronousity for you
ah
im stupid
a new delegating one?
i was thinking of having one
i mean, object
where is the velocity for the entity that is hit from? I mean the entity moves in the direction it is hit (and up the right height). Where can I get these values?
doing it like this now, and calling it when the user is loaded
new AsyncStorage(sqlStorage, executor, logger);
new AsyncStorage(mongoStorage, executor, logger);
where is that called
do you also wanna tell us what youβre doing
maybe theres a different approach
in what event?
EntityDamageByEntityEvent
i dont have the code yet but it will be something like
storage.loadUser().whenComplete((user, throwable) -> user.onClientReady(plugin))```
event#getDamager() then get the velocity from that
yeah, i have x and z from it, but not Y :/
huh? getVelocity() returns a bukkit vector which has all 3 values
im making a kind of kingdom plugin and im storing a bunch of stuff for the player in the User class
i assume its a directional vector
do you need it that early
that you cant use PlayerJoinEvent
and yhwy do you need it in the pre login event?
^
not as in the prelogin i think
just use the regular PlayerJoinEvent
so PlayerJoinEvent is fine?
i think, but alex isnt playerjoin going to be too late?
if the db request isnt blocking (which is like that) the player can be on the server earlier than when its stuff is loaded
The main advantage of pre login event is the asynchronousity
You can avoid race conditions
yee that
when hitting entity it jumps, using Y from the damager vector will not get this effect
hello i cant seem to find out how to do this:
Im trying to use a custom syntax in my config file -
<PotionEffect>:<Amplifier>:<Duration>
e.g.
Effects:
- "ABSORPTION:2:120"
- "REGENERATION:2:8"
I'm not sure how to split the config string and get the values and insert them into my code.
what data are you extracting
as the player isnt authenticated
what data will you need later
id still use joinevent and an executor service for io operations
hm n oidea
?paste
im loading all the homes of that player, the chatchannel he's in and his kingdom
like five homes max
when to use weak references btw
im also loading the stats but thats not really something i need from the beginning
i cant use a hashmap right because that has only 2
just String[] arr = thatString.split(":")
int levelIGuess = Integer.parseInt(arr[1])
int durationIGuess = Integer.parseInt(arr[2])
smth liek that
and catch exceptions if the user is stupid to write strange stuff
oopsie
ghost ping smhsmh
yep mb
btw would it be better to make an Effect class
yeah i could just print like "invalid config" and gen a new one
to contain these values
cya :)


so
wouldnt i have to do something like
for (String s : configFile.getEffectList()) {
s.split(":")
int amplifier = Integer.parseInt(arr[1]);
int duration = Integer.parseInt(arr[2]);
PotionEffect potion = new PotionEffect(insert vars)
}
wrote that on a phone dont judge tthe syntax
well yeah
but u can just make an effect clas
to load it then return an arraylist or array of the effects
We already have PotionEffect in bukkit
why do i need a class for it
How so
for example if he uses this multiple times
its in a for loop so
wouldnt it look better with a class to just load the effects
it will add the effect going through the config list
and get info from it
yes
just easier
for example
Effect.load()
will return arraylist of effects
or Effect.getByName("ABSORPTION").getAmplifier() for example
would be more convenient imo
wat
imo, just an overcomplication. you can just make dome static util methods to parse the enchantment
it looks more organized for me
?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.
couldnt i just parse it inside the listener, its only a few lines
that would look ugly but you do you
i wouldnt put everything in my listener method
i would divide things to seperate methods
well ill try it and see how it works out
im not the best at creating methods that return something
might have to be spoonfedn
I mean
do i just return 3 variables
after parsing
and then use those
in the listener
return an arraylist of Effect (the class u made) if u wanna do what i suggested
and the effect class has fields of name, amplifier and duration
Thats literally a copy of PotionEffect class
I had to be spoonfed for like everything. Mangled mashed together stuff, that was honestly good code, simply because there was so little of it. Then you start to make your own code from examples, get real code, and don't ever "need" someone else's examples
hello?
anyone with LOTS of ram willing to help me?
i need a HUGE .schematic (for example 1.17.1 worldedit) at least 1k x 1k, preferably way larger....
i can't generate higher than 500 x 500 and i know bigger exist
No.
What are you even talking about
Learn java?
What the hell are you on about
I literally sent the code with an error message, trying to understand whats wrong
You are not helping at all
and anyways , this isnt my code
this is a json api
(part of it) thats causing an error
please ping me, the bigger the better....
make three 1k by 1k bitmaps, pixel colors are blocks, you can control your whole "schematic" in a shader.
i need a .schem file mate
that's not typical Minecraft answers though
If I use textures larger that 8k by 8k, I get spyware that says not doable because of hardware, not the software you just changed. This game sometimes
so far i did 500x500 on 10mb (with os) but i need a LARGE file to test
tbh 10k x 10k would be perfect
but if i try making 1k x 1k my pc freezes lol
I duno dude, you usually use a buffer, which is just a partial view of a larger file.
for examples if you have a 4GB txt file on XP or something, you can not get the whole thing in ram at once, but you can use memory to view what you need to view.
only ever need 4MB of RAM to access the memory which is built into the CPU Cache
That's like ancient stuff I have pretty much forgot
Want 500TB of storage for $0.99, then end up getting it...
but the memory fades, and where are the files?
If you do it programatically then you can just try and split it recursively into smaller shematics:
tbh, no idea how, since im not generating there schematics... im just opening and validating some stuff
could you maybe generate me a VALID but HUGE schematic?
i want one big 10 k x 10k blocks or 60 x 60 chunks
Doesnt FAWE handle schematics of that size?
It does
does fave export in same as worldedit?
Yes
like exactly same
ok lemme try
because schematics from internet don't work...
i'll get fave 1.17.1
Is there any way to play custom sounds withou using resource packs?
Where would the custom sound come from then π
Like from an URL
magic
no
Or from a file
of course that's not possible
MC is not garry's mod π
you'd have to make a custom resource pack and force the player to install it if you want a custom sound
Then how does this work https://www.spigotmc.org/resources/soundcontrol.18149/
mmmm downloading stuff to people's pc....
it requires people to click on a link and have it running in the background
https://www.spigotmc.org/resources/mcjukebox.16024/ is the plugin that does most of that heavy lifting
yep and that's running in a browser
^^
i would not click a random link in a minecraft server.
TL;DR
Only possibility to play custom songs is a custom resource pack, or making people click a link and open that link in their browser
there is no other way
just ask for ssh/rdp...
Then is it possible via resource packs? Without overwriting any existing sounds?
Yes, resource packs can have custom sound files
I can send you an exampe resource pack from my jukeboxplus plugin
/playsound, or just Player#playSound
That will be appreciated ty
But that only works for already existing sounds
no
it works for custom songs as well
this is the example resource pack for my jukeboxplus plugin
works 100% fine with bukkit's playsound method
and also with vanilla /playsound command
declaration: package: org.bukkit.entity, interface: Player
(paper)
dimensions too large for clipboard format... ehh ill try 5k 5k
there ya go @tender shard xD
5k also too big π¦
haha one sec pls
So in order for a player to hear the sound it needs to have the resource pack installed and also the sound in the same exact namespace right?
lmao
that's the song included in my example pack
I didnt even know itwas included
how to turn off portal transfer
i dont want my players to make portal farms
for what
players? entities?
cancel EntityPortalEvent
or for players, PlayerPortalEvent
3k, it's been 4minutes... but still high CPU so it's doing something
i dont want mobs to transfer through nether portal
so portal farms will not work
as I already said, use EntityPortalEvent and cancel it if applicable
for (p in player) server.dispatchCommand(server.consoleSender, "tellraw " + p.name + " " + json)
why does this
Command Dispatched Async: error
[21:35:00 ERROR]: Please notify author of plugin causing this execution to fix this bug! see: http://bit.ly/1oSiM6C
java.lang.Throwable: null
cause this error
what is player?
also
fun sendRawJson(json: String, vararg player: Player) {
val server = Bukkit.getServer()
for (p in player) server.dispatchCommand(server.consoleSender, "tellraw " + p.name + " " + json)
}
do not access the bukkit API async
How do I delete a resource from my page
the link literally tells you that
report it and ask staff to remove it
im ujsing async player chat event
do not access the bukkit API async
so wht do i do
for what? my playerasync event chat
or the Jsonapi tellraw
class ChatListener : Listener {
@EventHandler
fun onPlayerChat(e: AsyncPlayerChatEvent) {
for the whole for loop that runs dispatchCommand
that would be JsonMessage()
i got this json chatr api thing
from
/**
- Any questions, comments, or suggestions, feel free to contact me at justis.root@gmail.com
- Version 2.3.0
*/
i found it somewhere on google
soooo?? what, do i put scheduler on the json around it
e.g. BukkitScheduler#runTask
Thank you! I fixed it β€οΈ

How long does it talk for resource reports to be responded to
is there any way to check if a block is from 1.9+?
check if Material.valueOf returns sth
doesnt that return the ID of the block?
?
it either gives you a Material "object" or it throws an error
what exactly are you trying to do?
?xy
Asking about your attempted solution rather than your actual problem
well I am trying to make RandomUHC, which is basically uhc but with random block drops. And I want it to be available for 1.8, but if I use it in a version below 1.11, it throws errors. So I want to make the plugin only drop 1.8 blocks and then imma do some shit to make it work with 1.8
so do as I said
use Material.valueOf("DIRT")
inside a try/catch
or use Material.matchMaterial
if it's null, the block doesn't exist
second one is probably easier
yep
avoiding those nasty try-catches
I mean you could use do stuff like
Bukkit.getClass().getPackage().split to find out the version
thats great thank you
How can I get an ItemStack from a configuration section?
getConfig().getItemStack("path-to-section");
np
And what if I want to save an enum? And get it back?
GetEnum?
Or I need to get it as a string?
what event handles when you break a tripwire and all the wire near it is updated
probably BlockPhysicsEvent maybe
Is there a way to get the current player coordinates?
I already cancel that event and fix the blockstate but it still affects wires nearby
?
Player
theres no org.bukkit.player
Yes there is
only gives me offline player
entity ?
ah
found it
thanks
it was entity.player
Your ide should handle imports for you
he writin in notepad
nah
you can save it as a string
or as an int
with Enum#ordinal
it returns the index of that constant
hovering over an enum constant in IntelliJ tells you its ordinal(index)
after a lot of struggle
I know this. Isnt that with the cream cheese filling? Ive been to croatia 3 years ago. Ate some of it. Was noice.
yep cream cheese
Any one can point me to some PDC tutorial
I remember there was one
like when thing came out
but I am unable to find it
?pdc
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
wouldnt the client have to get info from the server to display that tho
like get the data of the structure block to display the outline
Yeah I think you can mess with it via plugin
Okay, so I have this Player player; but it wants me to initialize the variable player. what value would I give it?
A player
?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.
Where you get that player instance is up to you
Is this not the right way to work with actionbars?
It seems like it doesn't create the new actionbar
Because the previous one needs to be removed, which I thought was automatic.
Then a new one needs to be created.
Looks like you're in a switch statement
With no breaks
Switch statements fall through.
int value = 1;
switch (value) {
case 1:
System.out.println("1");
case 2:
System.out.println("2");
case 3:
System.out.println("3");
case 4:
System.out.println("4");
case 5:
System.out.println("5");
}```
1, 2, 3, 4, and 5 will be called here
Yay labels
I figured the player.getLocation() stuff out, but I get this output. Is there a way to just get X Y Z instead of what it does now?
oh, okay thank you
Since getX/Y/Z gives you a float value I looked a bit through the docs but couldn't find a way to just get the int value of the location
getBlockX/Y/Z
alright so im developing a bungee plugin and i realized i needed to hide commands that have perms from command tabbing. im genuinely confused as to how to properly do it tho cause i cant find any info on it
Is it possible to manually send a player the default no permission message?
I see. Thank you!
pretty sure commands that people don't have permission for shouldn't be included in the suggestion list?
thats exactly what im saying
i need to hide the command from players without the permission
except this is a bungee plugin
i mean knowing the code doesnt really help
cause there isnt any code that would be of any help
i need to disable tab complete on bungee
but none of the info i can find doesnt help in the slightest
the methods used for preventing tabcomplete dont work in bungee
cause you cant use spigot api in a bungee plugin
and i know that it is possible to prevent tabcompletion
What exactly are you doing with structures?
hense this. this plugin is on bungeecord. same server
and yes i do know that there is a way to prevent tab completion by just blocking it from bungee itself
but this is a public plugin so i cant do that
According to that git issue you just need to bind a permission to the command
that would be nice to know but i cant find any documentation showing how that is
cause no one ever develops bungee plugins
On spigot you just add permission: x.y.z to the command in the yml
if only bungee api worked the exact same as spigotapi
it doesnt work that wayu
with bungeecord you dont specify the commands in plugin.yml like you do spigot
Wack
you have to manually reference them in the main class
and then
public Command(String command) {
super(command);
}
its very annoying and wonky
i'd argue using plugins.yml is way more clunky
except i just realized i am stupid
except my monkey brain is wrong again
cause that didnt fix the issue
why needdin lobby para
its a bungee command
yeah i know
*unused
imagine
cant imagine my laziness
but i can imagine how much pain my pc is under rn
considering im running an entire server network locally
i mean im sure its fine
mhm
then thats why it gives u an error
then fix it >:(
but it isnt causing anything significant or preformance issues
sooo
idrc
ill fix it when it becomes an issue
It wont compile. Thats an issue...
Then you fixed it already
i mean
i wouldnt call it fixed
id call this plugin an absolute mess
zero code notations
Not sure but I have a tool that can be used to similar effect
Does anyboyd know how to open a .jar file with VScode?
?xy
Asking about your attempted solution rather than your actual problem
Oh sorry I sent this message and then left lol
I have a MultiBlockStructure utility in my library that lets you define, test for the presence of, build, and visualize structures
Rotated/mirrored if needed
I would argue that code not compiling is the best possible scenario, that way you can't actually tell how bad the code is when it runs
does anyone know how I can open a .jar file with VScode?
?xy
Asking about your attempted solution rather than your actual problem
"the only response I got last time I asked was an xy post. guess I'll just ignore that an post the same question again without any extra details"
π
DUde
I TRIED so much
2 hours
on the internet
with tutorials and tyring to understand
so i thougt
why not
ask a NICE person
but ur just acting like a main character
lmao
yeah maybe if you clicked it
vscode is shit
its slow, and feels like a text editor
you need 30 plugins for it to even be as simple as intellij
only reason i'd see people using it are if they are on a lower end pc or are just developing to get a feel
both of which i can respect
I can't imagine a good reason to use vscode over intellij or eclipse
i keep finding programs were i can like view and edit weirly
but i need the whole folder in vscode so i can save it as jar again
but ya'll just messing with me wasting my time
No one is messing with you
You just have no idea what you're doing and you refuse to be corrected
I do have an idea of what I am doing, and I know exactly which files to go into. I'm originally a source developer, and I've never worked with Java and jar shit.
Which IDE extension on Eclipse should I use to decompile and compile jar files?
So you want to edit an already compiled jar?
The question we're trying to make you answer is why
To change all the help commands that pop up in the chat
the plugin didn't give so much optimization
and it looks trash
so im changing it
how is it that interesting
Just again, I've seen the files multiple times in programs, I just don't understand the workflow of making an edit in a jar file and then saving it into it
Because if it looks trash why not write a new one from scratch? Editing a jar is something quite beyond a beginner level thing
You could also write a plugin that listens to the command, cancells it and prints the commands in pretty.
Anyways: jars are just compressed archives. Like zip for example. What you want to do is get the .class file from the jar,
edit it and put it back into the jar.
Not sure if that works to be honest...
Let me think how that would look in bytecode
Editing a .class file is a byte code game
if you just mean /? or /help, you can do that just in Bukkit btw. help.yml I believe
Hm yeah so just editing a class file wont work. Maybe decompiling, editing and recompiling would work.
I rewrote a base spigot class file once. That was fun. "Fun". It's doable but you really need a firm grasp on how things work
asm
You can use 3rd party tools as well that allow you to edit classes on runtime load the library in modify the class save it and voila

long story short: You cant. Unless you have quite a bit of time on your hand and know exactly what you are doing.
Its probably faster to learn java and write a plugin that listens to the command event...
@vocal cloud Because writing what I want from everything I know with Java would take me around 1500 hours, and you might say "oh but it's good that you learn". Well again, us humans co-exist to be good at different things. And I don't want to spend that time when I can work more efficiently. As I said, I develop games with C++ and Lua daily, and I've never stumbled upon having to decompile a jar file so please excuse my beginner levels. I find it annoying that you're all the time trying to sidetrack me and you decide "for me" what I want and not. I've tried to state clearly 4 times what I am looking to do, and though that was right to do since the text-channel is called "help-development" and is very fitting for my purpose of being here. Trust me, I know what I want, and making an edit in this plugin is what I want. And I gave you my answer to why I don't make one from scratch but I can give you an even longer explanation. I'm starting the Minecraft server to hopefully have a smaller and passive income, boo you if you don't believe in it's success - I couldn't care less. So having to write all this code when I could've spent my time on making money other ways and letting all my source/unity knowledge go to waste would be less efficient.
You make a project get maven load the jar in as a local library
nope
Then load spigot in as well
download the plugin for intellij named minecraft development
No
why not π
Because this isn't plugin development
oh
hes still want to edit a jar?
go decompile it
to edit
instead of editing a class file
use fernflower/forgeflower or quiltflower (better than the previous) to decompile them
Usually decompiling doesn't work for me 
But if it works for them then they can go that route
very
I mean technically speaking we don't even know if this user has permissions to modify the contents of said jar file anyways
who cares if we dont public it

π
π
No one can reload plugins on my watch
Aren't there tools for editing decompiled jars?
But yeah decompiling has one major problem:
Decompilers are not typically perfect
They will decompile to broken source as it is hard to interpret source -> bytecode with how much information is lost in translation.
My method will achieve exactly what this person wants no matter how painful it might be to do.
o.o
Dude
I just had a great idea
I should open bytecode modification commissions :)
My knowledge of JVM bytecode is stronk
(I am aware of the legality issues)
(But, this is GPL-licensed software, it allows for modification)
Hey, I created a custom entity with NMS[A zombie pigman] to replace the natural zombie pigman (canceling the event to spawn the custom entity [Another zombie pigman but angry]) but I'm getting A LOT of custom zombie pigman and I dont know why
I think this is because they are not considered on the mobcap, but idk
If you cancel the event then the spawn limit does not take this spawn into consideration
and there is a solution?
several
Primitive approach: Dont cancel the event and remove the entity instead. Might just work.
If you want to properly replace vanilla entities then you need to overwrite them in the nms registries
I'm running into a really weird issue. I have an "item swapper" of sorts for my GUIs and for some reason, when I try to change one specific item with another, it gives me an NPE. The weird part is that the method works perfectly fine in every other class that calls it. So I'm at a loss as to why I'm receiving one in the first place.
Why are you even touching Java? Just do bedrock
Ohh, nice idea! but when I remove the entity, this one is removed from the mob cap again or not?
listen on the name
who names their software
"bedrock
"
bed-rock"
like what kind of software name is that
seriously
And I'm interested about that, I'll investigate
thanks!
It's Minecraft bedrock edition... Not just bedrock, along with a VERY successful company that is making millions and still rising.
Well the name Bedrock comes from the block Bedrock
from Minecraft
And fun fact about Bedrock
You literally cannot destroy it in vanilla
So it's not the worst word they could've picked :p
Yea you can. With E X P L O I T S
Vape on it
Technically you could. It just takes like 4 days irl time
Could be worse. Could be attempting to edit the bytecode of an open source project. 
Really?
I remember hearing that the game sets the block's resistance/hardness to an infinite value.
Or that
It literally makes it impossible to progress the breaking state
Me when I get the block breaking effect on bedrock. o.o
Same as stone so go mine some stone
It was Towny btw which is open source. Kill me.
Actually, can't you now change what blocks have the bedrock like attributes? Something with the new tag system Mojang have been working on.
Oh god ughhh
wait he wanted to modify towny?
By using byte editing yes
Who needs a disassembler when you have HxD
Start counting those indices, bitch :)
Be Me
Come in being ask generic question
Get annoyed response
Respond with aggression
Call people entitled
Insist that they know the best way to do it is editing the Bytecode
Plugin I'm trying to edit the bytecode of is open source
sigh
Hehehe
The amount of plugins that I have tried to decompile, do my edits and then recompile them and then DONT WORK, is.... all of them.
Yeah that's why decompilation doesn't really work
It's good for analysis!
But for editing, no.
Oh yeah, I use it to see how people did stuff all the time
Yeah but the original question was
saw that.
Ugh
Hey I'm trying to edit the towny jar -> towny open source -> done
But it was like pulling teeeth

but now i switched to intellij and i like it so much more
That's cuz IDEA is designed for Java unlike VSC :)
probably mostly cuz its easier to set up maven with a plugin then eclipse but still
I still wanna figure out a way to auto increase the version number of a plugin automatically when I export it, but thats a maven problem
there is a guide to overwrite vanilla entities with NMS?
easily done in maven
cough still need help with this. I legit think it's a problem with how I create the heads, but I'm not aware of the current method to set custom base64 player heads.
how? :)
in a game so give me a few lol
https://github.com/frostalf/ServerTutorial/blob/master/ServerTutorial/pom.xml#L135-L156
https://github.com/frostalf/ServerTutorial/blob/master/ServerTutorial/src/main/resources/plugin.yml#L3
if use it like I have there, anytime you update the version in the pom, the plugin verison will be the same in the file π
no more having to do it yourself lol
Bro I'd have 2000 versions
But wouldnt I need to edit it in the pom to update it?
Yes
bump! (Or a way to add custom entities on the mobcap)
how to remove drops in BlockBreakEvent?
using event.getBlock().getDrops().clear();
but not working
is there a good way to update the state of a decent area of blocks without individually going through them all
if clear doesnt work, maybe a solution can be:
for (ItemStack i:e.getBlock().getDrops() ) { i = new ItemStack(Material.AIR); }
ok thanks. let me try
But .clear might works
Show your code
setDropItems(false)
There is noting like that
?jd
got itπΆ
not on block methods
declaration: package: org.bukkit.event.block, class: BlockBreakEvent
π
Just cancel the event when a vanilla mob is spawned and spawn yours instead
Works but not, because the mob is not counted on the mob cap
Same removing the vanilla entity with entity.remove()
Its working thanks :D
but I can't add custom drops :/ that also get canceled :/
And If the mob doesnt count on mob cap I will get like 300 entities (My mob is a zombie pigman)
So, i need to override the mob on NMS but I dont know how :(
What do you mean it's not counted on mob cap?
Just drop the items yourself
That, or use BlockDropItemEvent instead
What event are you using?
take entity.remove and e.cancel(true) like the same
on essence makes the same thing on this context
What does isAngryPigman()?
Read the documentation on it
is a config option, to the user to decide if custom pig or vanilla pig, its a boolean
Nothing about override mobs on NMS mappings or from obsfusced
There is a way, but I cant find it
Did you still try to cancel the event instead of removing the entity?
yes, was my first try, but on this context remove and cancel makes the same, because the vanilla mob doesnt get on the mob cap
How do I loop through a player's team
Still donβt get what you mean by mob cap, that event is always called when a mob is spawned
Mob cap is the limit of mobs in a world
If the mob doesnt count for the mob cap, minecraft thinks it can continue spawning mobs, causing a lot of mobs spawn like this
because it doesnt have a limit
can reach 1000+
mob π§’ ?
If I remove or cancel it spawn, the mob not will counting for mob cap (because the mob not exists)
I dirt solution is checking world.getEntities and get more of 70 (or another number), just cancel event and no more spawn of custom pigs
But isnt a clean solution
Dude
pls how to remove !!java.util.uuid
Im trying to get the surrounding tripwires blockstate and update it using
if (blockBroken.getType() == Material.TRIPWIRE) {
List<Block> blocks = new ArrayList<>();
blocks.add(blockBroken);
blocks.add(blockBroken.getRelative(BlockFace.NORTH_WEST));
blocks.add(blockBroken.getRelative(BlockFace.NORTH));
blocks.add(blockBroken.getRelative(BlockFace.NORTH_EAST));
blocks.add(blockBroken.getRelative(BlockFace.WEST));
blocks.add(blockBroken.getRelative(BlockFace.EAST));
blocks.add(blockBroken.getRelative(BlockFace.SOUTH_WEST));
blocks.add(blockBroken.getRelative(BlockFace.SOUTH));
blocks.add(blockBroken.getRelative(BlockFace.SOUTH_EAST));
for (Block b : blocks) {
b.getState().update(true, false);
}
}
however it doesnt seem to work, most of the wire, will yes have its blockstate updated but some parts will remains wrong
show your code
Looks like you're doing a chatComponent Wrong
oh you have a config problem
what plugin
Is it a bedrock only server or cross platform?
Does the item appear like that on java?
That would be the issue
Not sure how you would fix it just in the configuration
what is that error and how i can solve this?
Cannot invoke "me.xsenny.sennyhype.SennyHype.getConfig()" because "this.plugin" is nul
It literally says you
plugin is null
how
you need to provide further info for us to be able to help you
Because you dont fill the variable... And a variable without a reference will be null on default
hello everyone !
am trying to download the 1.18.1 api with buildtools and it wouldnt let me as it says that am using java8 how can i change that ?
apologizes if this is a dumb question, but does serializing an ItemStack with ConfigurationSerializable keep data stored in PersistentDataContainer? This was what was stored, and it doesn't seem like it does.
block:
==: org.bukkit.inventory.ItemStack
v: 2586
type: COMMAND_BLOCK
meta:
==: ItemMeta
meta-type: TILE_ENTITY
display-name: '{"extra":[{"text":"CodeBlock"}],"text":""}'
blockMaterial: COMMAND_BLOCK
type: FunctionBlock
EDIT: To anyone who finds this message in the future, yes, it does, I was just saving the wrong data
So corner pieces aren't updated anymore but all cardinal directions are still
?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.
use java 17
1.17 requires java 16 and 1.18 requires java 17
i dont think so?
wait
you mean that do they serialize the data in pdc or what?
here's my thought process:
store data in itemstack's PDC
serialize itemstack when saving server data
deserialize itemstack when loading server
use data inside itemstack's PDC to create objects
how do i do that ? i cant seem to find a way on google (even tried reinstalling jdk 17 and restarting my pc
oh they dont automatically change the JAVA HOME jdk to 17 then
you can manually change them by go to environment variable
use windows search
is there an open-source implementation of the gui interfaces plugin 1.18?
am already there
cant find the HOME_PATH
yeah that's not there
well scroll
i did
then create one
ig
You should probably create a custom pdc type. Maybe <String, ItemStack> in combination with BukkitObjectOutputStream.
It produces Base64 Strings but the content of a pdc does not have to be readable anyways:
https://gist.github.com/graywolf336/8153678
ok i will try that
if it does not work, then i may remember this wrong. you can use java something + the path to java 17 to use the specific java version
check other folder
only here
what does PAUSE do in
java -jar ...
PAUSE
if it crashes you can see the error
ah thanks
How do I save a string on an ItemStack using PDC?
ItemMeta meta = item.getItemMeta();
PersistentDataContainer pdc = meta.getPersistentDataContainer();
pdc.set(new NamespacedKey(*plugin*, key), PersistentDataType.STRING, value)l
item.setItemMeta(meta);
something like that
Well, STRING doesnβt exist
what is the event which gets triggered when player uses elytra?
Is there anyway I can load lile the 30th key in a configuration
without loading the rest
I can only see Integer, integer arrays
no. Configs are loaded as a file not a stream
Thank you btw
Is there any way to cancel a bukkit task within itself?
can enum be a listener?
how to send a chest open packet in nms 1.17?
well not the enum itself but the enum-class could probably use that
whats the usecase?
idk i just tried adding implements Listener to enum declaration and intellij didn't tell me anything
tho i thought i can't implement interfaces with enums
it even compiled
no errors
can someone give me the basic template for gradle bungeecord build files
build.gradle(.kts) and settings.gradle(.kts)
only bungeecord
it's to make proxy plugin
an enum is nothing more than a final class with public static final instance fields
oh ok
you just cant extend another class in an enum, but you can implement one
what should i use instead? 'org.bukkit.event.entity.EntityDamageEvent.DamageModifier' is deprecated
i want to set weapons base damage, but also don't want to discard other things like crit, and enemy's armor protection
anyone? i'm sure this has been made a thousand times already, but for some reason i can't make it work
Not fully right, it can be an abstract class
please help, i am listening to a entitydamagebyentityevent and want to change only base sword damage but not the final damage, how would i do that?
uh, ill try
also, do getDamage() and setDamage() use HP or heart count? like diamond sword's damage would be 7 or 3.5?
give me a better name ._.
How get key from value in HashMap?
Either keep two HashMaps in place, or iterate over the entryset
BiMap
Or dedicated maps
always HP
is there a way to get the damage of sword with it's material without manually createing a map?
i dont know but i think it has like attributes
the +69 attack damage you see in the lore
might be retrievable
in newer versions you can get the materials base attributes i guess
1.13+?
1.18
i am using 1.13+
1.13 is not a new version π
should i made a separate update statement to update users to the database instead of just an INSERT INTO with an ON DUPLICATE?
you can lol
for multi version compability
do i just import a earlier version of the spigot api and lower the api version?
if you only use API then you should use the lowest mc version you want to support
Keep in mind the api does change, so you do need to keep note of any changes in later versions
So you would need to test across multiple versions
yeah but mostly they dont want the api to change behaviour over versions ...
how does one put text with custom font symbols in item lore
?paste
this is probably a silly question, are we allowed to maven import spigot and bungee jars and make our own versions of the jars if its only for private use for the sole purpose of adding/removing some features? (like org.spigotmc sits on top of org.bukkit)
since when can you do instanceof Player player?
Like forking spigot?
yeah
That would be what it's called. As Spigot is a fork of Bukkit, and Paper is a fork of Spigot, and the list goes on
It's open source so yes, there's a ton out there already
how does one use hex colors & custom font symbols in item lore
ChatColor.translateAlternateColorCodes works fine with hex colors
but you have to use them like this:
&x&f&f&0&0&0&0RED TEXT
if you want to use stuff like <#ff0000> just parse it with regex and replace it with &x&f&f&0&0&0&0
mine is a bit overkill lol but also supports hex gradients, itemadder emojis and other stuff https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/de/jeff_media/jefflib/TextUtils.java
alr thanks, how do i do the font stuff tho
no idea
ouef
never used custom fonts
but I guess
you might need to use a Component/ComponentBuilder
maybe that allows to set fonts
isn't that for chat messages tho
item lore
idk if lore supports custom fonts
it probably does
it does
hm setLore only takes strings
maybe
TextComponent text = new TextComponent("asd");
text.setFont("asd");
text.toLegacyText();
no idea whether that works
does anyone knows if logger.log(Level.SEVERE, "something went wrong", exception) will also print the stacktrace of the exception?
or is it just to create a log record?
Question, how do I set a custom skull in 1.18?
GameProfile is no longer bundled with spigot's api
in the world? or the itemstack?
ItemStack
GameProfile is inside com.mojang.authlib
you have to import that one as well
if you use maven or gradle, you can just install authlib to your local repo
Seems to work, cheers
can someone help? idk what im doin lmao
lore.add(ChatColor.translateAlternateColorCodes('&', " &e" + (new TextComponent("\uE000").setFont("custom:custom"))));
as said, convert your textcomponent to legacy text
something liek a struct in .NET?
i dont like how non-flexible records are
how can i stop killed mob from dropping exp orbs?
Harmony Scoreboard | NMS Async |
how are they unflexible?
EntityDeathEvent#setDroppedExp
thanks!
erm you realize that record automatically adds a setter, right?
bruh it says can be converted to record while i have a new field
no it doesnt
the fields are final
arent records just immutable classes
The field SqlStorage.connectionFactory is private.
Creating a particular public record accessor will weaken the visibility.```
dunno what that means
ah it will create a getter
oh right I confused it with lombok's data classes
oh
so record classes are classes that have public immutable fields?
yep
but i dont understand why you cant like add your own mutable fields
well the fields aren't really public, it just automatically creates getter methods
they are compiled to normal classes
so its syntax sugar
exactly
it also automatically creates toString, equals and hashcode methods
yeah
I don't really use them because I still compile for java 8 and just use Lombok's @ Data instead
i dont understand the error message its saying
what line
wdym what line, it says it can be converted to a record and then it says this when i try to do it
can you show the code it generates?
but anyway, there's no need to convert it to a record at all
it probably means, that when you turn it into a record, there will automatically be a getter for connectionFactory field that was previously private
I don't think anyway that it's a good idea to turn this into a record, that's not exactly what they are meant for
then just don't turn it into a record π
the blog post I sent explains what records are for
stupid intellij
explain records
just disable this inspection
its cool
i love how it says if you cant use records cause your users are still on 1.8(WTF)
haha
1.8 users make me sad lol