#help-development
1 messages · Page 1869 of 1
Does Minecraft itself have a server uuid?
Not that im aware of
No
You can just generate a standard UUID and save that as Coll suggested
Got it
Sheesh
honestly cant remember if this is on github or not
@analog prairie sounds like you got a none problem for yourself, servers do not have a unique identifier
Wouldn’t kill ya if it was x)
It's on GitHub just private, initial commit on Dec 28th 2020, now over a year later this core is in a production phase
you dont even know
lmao
i need to find out if there is a way to see the total lines of a project
I mean ig
But grade or@maven I still built artifacts and it failed
So wouldn’t it not work regardless
Put simply, that’s not how you use maven or gradle
Ok
[Server thread/INFO]: Tick portal move to world debug
Does any know what's wrong with this problem?
This make my server crash many times
🥲
O
I’ll try latr and let u know
?paste
error alert! https://paste.md-5.net/guniyuxise.cs what'd i do wrong?
Read the error
Im guessing I messed up here stats.replace(e.getPlayer(), value + 1);
it
it's tryna change a non integer right?
pStats.java:22
You're calling get() on your Map but it has no mapping
You can either use getOrDefault() or return if the Integer is null (not an int. Assigning it to a primitive will auto unbox)
Is there a reason why this textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + user.getPlayer())); is kicking players when they join?
What does getPlayer return
could you explain a bit more?
Anyone know how Minecraft applies the enchantment texture to an item texture
to make it all glowy in-game
Since I added that it just kicks everyone when they join
Is getPlayer a string
On which version? Could have some fucked up impl. of BungeeChat or something
why run a command
do it progrimatically
Because if it returns a player the implicit toString is going to have a messy output including {}
Which json may not approve of
Components can't run anything directly. It has to be a command
1.16
Just make sure you're on the latest 1.16.5 then
Not sure why that alone would cause a kick
yea
is there like an isThrowable() thing under material
What would it entail?
like if an item can be thrown
Can't all items be thrown?
like eye of ender, ender pearl, egg. etc.
Oh
Set*
I mean that could also be PRd
wasnt referring to the actual computer term, was just speaking in general XD
But material enum PRs are ugly
Anyone know how Minecraft applies the enchantment texture to an item texture
to make it all glowy in-game
It’s just an overlay
It's client-sided. Will glow so long as there's at least one enchantment on the item's NBT tag
but yeah, just an overlayed texture
It's like enchantment_glint.png or something
yes but how does minecraft do that progrimatically. See im trying to make a 3rd party thing for displaying items given data
the click event is messing with it smh
but if item is enchanted I need to apply the encahntment texture to the material texture
p.sendMessage(Integer.toString(stats.get(p))); this what i got for the message
this the error
Yeah no I don't how to fix this
What does getPlayer return
now p aint work
Okay so it’s a string
but how does that actually apply to the item
yea
@young knoll
although that shouldn't cause the issue
how do i give an item to a player
Player#getInventory#addItem
thx
could you help on this, I edited the code to say the Integer in my HashMap but it doesn't seem to work. Mind helping?
codehttps://paste.md-5.net/kexoxineci.cs
errorhttps://paste.md-5.net/guniyuxise.cs
What's the other reason that it could cause it
Does the client log say anything
how do i define an item
When the client gets kicked, is there anything in the log
event#getItem#equals(Material#Material);
But yeah read the docs
nothing in logs
The client ones or the server ones
Well can anybody help on this?
but its protected
client
Weird
could it be an issue thats the server is in 1.8.8
if i were to define a player head, how would i do that
What version
Very likely
well
the plugin is written to be used in all version
so
the main versio nis 1.8
x
1.8.x
With PlayerPickupItemEvent, how do I cancel a specific item from being picked up?
Check the type of the items itemstack
I tried this but that didnt work
@EventHandler
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
ItemStack bow = new ItemStack(Material.BOW);
if (event.getItem().getType().equals(bow)) {
event.setCancelled(true);
}
}```
Operator '==' cannot be applied to 'org.bukkit.entity.EntityType', 'org.bukkit.Material'
you failed him
Oh they didn’t get the itemstack
CHOCO where u at
event#getItem#getItemStack
hey can you help me?
@young knoll
if you're available
bah
Thanks!
how do i modify item data
am I doing somethign wrong
TextComponent textComponent = new TextComponent();
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
Core.getInstance().getConfigValues().getAlertsHoverMessage()
.replace("%info%", stringBuilder.toString())
.replace("%ping%", user.getConnectionProcessor().getPing() + "")
.replace("%tps%", TPSUtil.getTPS() + "")).create()));
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + user.getPlayer().getName()));
user.getPlayer().spigot().sendMessage(textComponent);
alternatively you can use (event.getItem().getType().equals(Material.BOW))
then you dont need to create the Bow itemstack
urs was with getItemStack()
Yes, because the item is an entity
Entity.getType will never be a bow
wym?
How do i add data to an item
in what you sent, you would use the variable to compare the itemstack rather than the type
.
What
???
This is invalid
event.getItem is an entity, not an itemstack
then it would be event.getItem().getItemStack().getType().equals(Material.BOW)
Yes
you should compare the type rather than compare the itemstack
That’s what I did
I did though
I was talking about the other message you send, it doesnt really matter we're arguing over nothing
The other message was to clarify they need to use getType on getItem#getItemStack, not just getItem
i see, i thought u were telling him to compare the itemstack
Where
Core.getInstance().getConfigValues().getAlertsHoverMessage()
looking if someone can help me!
continuing this question, what i meant was client side. i would like to cancel or change the sound of the block breaking
for example: instead of a wood sound when breaking wood, i would like to play a glass sound to the client
If the sound is handled client side you are out of luck
I’m not sure which side handles it
i know it is possible with a resource pack. since a noteblock uses the wood sounds, can i change just for the noteblock or must it be the wood too?
i am referring to how origin realms adds their sounds to noteblocks
How does it feel to literally be the creator of the popular game called Minecraft connection to other players
Crazy thought
Props to u mate
Does any know what's wrong with this problem?
[Server thread/INFO]: Tick portal move to world debug
what i need to do to hightlight class after using my custom annotation?
for example methods with annotation @EventHandler are highlighted
I think intellij just checks source to see if reflection is done based on the annotation, but I'm not sure
ok
Intellij does it for my custom annotations that use reflection
So I think it has to be that
Interesting
Pretty sure the difference is its public
Hey, I was planning on making a plugin for my server, but it seems that I do not have the competence to make the spigot jar work with the plugin or IntelliJ. Any tips?
To my knowledge package org.bukkit.plugin.java does not exist is not a good sign
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
have you generated Plugin project in Intelji or made it form scratch?
I suppose I started from scratch? I just downloaded IntelliJ and made a new project. I also did the project structure > Modules thing
Aight Ima check it out thanks 👍
and this I may or may not have downloaded the wrong jar
then after creating new project the only thing you need to configure is output path for .jar file
Could i get someone to quickly proofread this?
I wanna know the small stuff im doing wrong before it becomes a bigger problem
Its a plugin that has custom silk spawner functionality, and you can put spawners in a gui to automatically give you XP
I see two thinks that could be improved 1. make field private because they are now package private, 2. instead of making Getters and Setters by hand use Loombok library it generate fields automatically
anyway better to autogenerate them
I notice in your place event you check it getItemMeta == null, you should check hasItemMeta instead
getItemMeta will create a meta instance if one doesn’t already exist, hasItemMeta will not
And consider to divide SpawnerGUI class to more subclasses because this class is now so big and will getting bigger in future
Alright, thank you
makes sense
I honestly thought there would be WAY more wrong with it
Looks pretty good to me, compared to some of the stuff we see in this channel :p
not enough comments?
Like it feels like if i didnt know where stuff was i wouldnt be able to write on it
Is it true that Bukkit#getPlayer(UUID) returns a player iff player is online?
Yes
sick, thanks
Is there any particular part you think feels like spaghetti?
To me the GUI part just looks really dense
Probably good to split it up more
how are you comfortable with 8 spaces indentation haha
Yea that
I’m reference to what feels spaghetti
And I hate that I started to make a api part but then decided that I wasn’t going to and never refactored it lol
So there’s an “api” part that’s not really an api
this is illegal
Ok I think this might just be nitpicking, but if #setXp(int) is used to, well, set xp, I think it should have a return type of void (similarly for other setters) unless we are dealing with immutable objects here.
I always have the rule to myself that variables that ends with type should be allocated an enum constant.
I like custom getters and setters as it gives me more control if I want something else to happen when I set stuff such as returning “this”
but you can overrite generated Gettes and Setters
I don’t see the need to do it, as it’s seconds of time saved
If it ain’t broke, don’t fix it
I don't think it is healthy to live with that mentality
You’ll see a lot of conflict about Lombok here
Lol
Some people love it, others hate it
good luck with 10 varables classes
It’s the same amount of time with 2 variables or 20
Lombok / record classes :3 ❤️
Lombad amirite
STOP HATING ME FOR USING LOMBOK D:
:(((
Records are a new type meant to handle pure data classes
Causes mass discord
Wdym new
15
check out the blog post I sent
According to your post at least
lombok are basically sth that removes boilerplate, necessarily or unnescessarily
Oh cool, anyway what do they do?
read the post I've send and you'll know it
so you see yourself writing getters and setters
Oh my b
lombok removes that requirement
Who writes them
😮
and records to, too
eclipse people? idk lol
Yes
Got it
after I installed IntelliJ, I hated it for the first day. On the second day, I uninstalled eclipse
So what are the downsides to Lombok
Same
Having to use it
Choco uses eclipse
tbh, I can't think of any
lombok is awesome
MD uses netbeans
Chocos dumb
because he's "special"
vscode for the win
Coll what are the downsides to lombok
emacs
there are none
@somber hull look there is one big class, all methods has been generated by lombok
lombok IS AWESOME, fr
Imma look up the downsides
There have to be downsides
I don’t believe it’s perfect
you only need to use attribute @Getter and @Setter, and thats it
if lombok is considered a compiler hack, so is everything else using annotations that create code
Yes
but shouldn't you put in better thought on whether variables deserve a getter or setter?
You still can
oh you need the annotations
Mhm
what event is called when a shulker box is opened and closed? or is there one? a shulker box updates nearby blocks when interacted with
are you still on the noteblocks thing haha
yea lol
It’ll call the physics event
It should, if it’s updating blocks
i logged it and opened and let it close, there isnt anything to output
Show code
HAHAHA
Lol
TL;DR: Lombok is AWESOME and there's no downside whatsoever in using it
@EventHandler
public void onBlockPhysics(BlockPhysicsEvent event) {
System.out.println("update");
}
lol
true, but that event has a special place in my heart
and whoever says something different just doesn'T know what lombok actually is or does
and if they still claim lombok sucks, please let me know WHY you think it sucks
Nothing is perfect*
maybe it is the ignored cancelled?
Why would it
if the system deem that it doesn't affect anything, it is automatically set to cancelled i think
Got it
Oops
Kotlin is java for people that are scared of java
i removed the ignored cancel. same effect
f, then idk
Kotlerrrr
Wdym
java is not scary, it is.... just outdated
Does it have restrictions from Java?
That’s not THAT bad
It has a bunch of new stuff that I’m too dumb lazy to learn
Wait so is it just like a redo of the Java api? Or a new language based off Java?
New JVM language that supports java i'd say
Sounds like a language based off Java
lombok is 😛
I’m just trying to understand what kotlin is
kotlin = ugly java with benefits
No one here has the same opinion
like your babysitter
she was probably ugly but you were into her anyway
and I am saying that as a gay dude
Well, for one, I don't think you should use setters at all. Immutable objects are a much better way of transferring data than mutable ones.
For two, you should avoid getters if you can, and instead move behavior into the object rather than operating on it externally. This enables better design choices; it lets you do things like use multiple implementations of the same interface. You end up with less casts, less switch statements, and more polymorphism. It's a more object-oriented style of code and is much cleaner overall.
Another quite large issue with lombok is that it introduces its own language of sorts. Learning lombok isn't like learning an API or a library. Lombok generates code. Sometimes that code may not be what you'd expect. Things like @Getter are straight-forward, but the more advanced annotations like @Data I find entirely repugnant because they hide so much logic in a single annotation.
When you debug and review lombok code, you have to think in terms of the code which would be generated. This is non-negligible mental overhead, and for what gain? It would be better to write the code yourself or have the IDE generate it, depending on the demands of the situation.
wellllllll
LOMBOK
Kobmol
lombok is pure java. it just avoids you having to write
public XYZ getXyz() { return this.xyz; }```
Sounds abt right
Dum
Sounds like your lazy
yes!
I know, and you know what I mean
but now just imagine you have a toString() method for your data class
I’m going to lom your bok
it is just unecessary, since getters should be avoided anyways
when you add a new field, your toString() becomes useless
in lombok you just do @grand coralta once and it will always work fine
This is why I type faster than you
😎
avoided? @quaint mantle
So I remove the tostring and make another via intellijs autocomplete
typing speed duel? 😛
Pog
send link
How’s that work…
tbh my keyboard is fucked anyway
146 wpm
I smoke too much in front of my PC so there's always some ashes in my keyboard >.<
Check the message above
Sometimes y’all make me want to spiget a new hobby
Average is closer to 115-120
Your girlfriend must love you
or boyfriend
😳
or themfriend
Programmers don’t have partners
😱
True
Guess I'm not a programmer
lmao this is more true than I thought. My bf left me a few months ago lol
when HyperLink45 assumes someone’s gender
Programmers just become the girlfriend instead
ac-130
oh shit that's an old thing
the oldest plane I ever controlled was a boeing 737-200 and I was only in charge of it for about 5 minutes
One joke
“I am T-72 armored military vehicle” - in Russian accent
i dont think thats too hard; im pretty sure that 3/4 of this server are man
3/4 of this server is part of MDs hivemind
Who’s md?
Quick someone ban him
3/4 of this server is people mocking md_5 although they actually love him. Right? Fuck you md_5, we all love you but we don't want to admit it ❤️
I wouldn’t give him my code if I hated him
fun fact: the german word for "shit" sounds exactly like the enligsh word "code"
Any idea how can i avoid block destory sound? https://streamable.com/emfaxg
whoa you actually built a piano
Wait, is there any negative to making a premium plug-in open sourced, except that you would be losing around 30% of your money to those that know how to compile Java?
Turn the volume down
sorry
sorryyyyy
;/
People might leak it
But they’ll do that anyway
oh I thought you talking to me because I said "fuck md_5"
Ig, but where would they put it? It would be taken down from spigot
Yea cause then people can help with bugs
Gray Spigot
using the word "code" lowers your social class
my social class it the lowest anyway
What social class is below programmer
coder
Emo
students
Interns
What if I’m a goth programming student intern
Intern students
Lowest of the low man
then you're my hero
Unpaid intern student
Hero
Gn everyone I got an interview for my first job tmrw
Hopefully it’s not unpaid
good luck ❤️
technical interview?
Lol it’s at a burger place
oh
Very technical
you'll fry rock your interview, I'm sure
solve some burger flipping problem
Coding the ice cream machines at McDonald's to finally work
I hate you
good luck anyway lol
Don’t throw rocks at the interviewer
Thank you, bye
Usually doesn’t help
Damnit I thought it would help
go to sleep now
lol
Get md_5 to personally recommend you
"This is a delicious burger!"
he only shows up here when you insult him or when people use NMS though
“I’ll have you know I have nearly 10 lines of code in the spigot API, you’d have to be an idiot not to hire me”
“Sir, this is a Wendy’s”
Wendy's-API
remapped
oh shit
we made hepl-dev become a totally off topic channel lol
I think we did a good job
That’s not a rare occurrence
No one really needs help
Just use Google
tbh I need help
?learnjava
We don’t offer that kind of help
Thats a long document
Hmm
also @sullen marlin your pastebin sucks, it always thinks something is shell when it's yaml D:
You could make use of Block#canPlace
I need it for already placed blocks though :/
A set of materials is probably your best bet
and BlockäcanPlace will return true for almost everything
ofc I can place dirt on a carpet but that doesn't mean that the dirt will break when breaking the carpet
I need like the "opposite" version of canPlace
like
willBreak() or sth lol
hm
I think Mojang calls it canSurvive
I imagine you could use NMS if spigot doesn't have it
so there is an NMS method for this?
I mean, current thing is working fine, it's just ugly and I'd rather replace it
Not that I know of
Don’t feel bad about big material lists, you should see some of the Material methods
I'm going to have to make a project for this aren't I? Sigh.
yeah I know :/ my besttools plugin is full of such ugly lists / HashSets D:
Okay what version
Every
Idk some people I've worked for do 1.8 like it's the only build around
1.8 people have more cancer than I do and I roll cigarettes while I am still smoking
I very much look forward to the day the material enum is replaced
I hope it will never happen
What can it be replaced with
probably with sth like how enchantments work
NamespacedKey mat = Material.DIRT.getKey()
will probably be a thing
sometime
From the 1.18 post
Future API
There are plans underway to change the way many enums in the API are handled so that custom content can be better supported. These changes are not expected to break most plugin jars (backwards compatibility will be provided), however they may unavoidably break plugin source code (though the Maven version will be bumped if this occurs). To reduce the risk of breakage, please consider avoiding the use of switch statements and EnumSet over enums which implement 'Keyed'.
yeah but
vanilla client
it probably won't happen for Material that soon
This already exists
I doubt that the Material enum will vanish in the next 3+ years
Choco has already tried to kill it :p
yeah but Choco is loco
everyone please mock md_5 to install checkmk in #general
I’d love to look into it myself, but material is very deeply interconnected into spigot and it’s hard to tackle
Guys what API for web socket would you recommend?
A good one preferably
i guess so,, the org.java_websocket.server.WebSocketServer not really works well with spigot
Java supports web sockets o.O
web socket it is just TCP + UDP
The direction the arrow flies is correct, but the direction the arrow is facing is not normal. What should I do?
File.separator try this maybe
flip the screen and see if it looks correct
um no
lol
frostalf go eat the bone I sent you
@tender shard I can't use custom emotes but I assume you want something like this?
At least change the way biomes are used to let users use custom biomes too
Naw this aint it chief
help. config.addDefault doesnt make a new key even if config doesnt have that key
it only makes new key when config is empty
does addDefault only work if para1 is null
try config.set("KEY","VALUE");
configFile.addDefault("DEATH_MESSAGES", defaultDeathMessages); defaultDeathMessages is a Map.
this just overwrites the value
I think I just need to make a loop then config.addDefault it with every key instead of a Map
why do you need to mess with defaults?
o.O
to add the key if key doesnt exists?
well if its giving you trouble using that method you could just create your own check that will add it
.
maybe people won't notice? lol
Haven't you made a thread already?
no i didn't
I think the problem is it doesnt care if the keys of the map is in config, I think it only cares about the name youre about to give the map in the config
so by iterating through the map, I could force it to check every key in the config
what does the code look like for how you are using addDefault?
i was doing it like config.addDefaults("parent", map);
for (String key : defaultDeathMessages.keySet()) {
configFile.addDefault("DEATH_MESSAGES."+key, defaultDeathMessages.get(key));
}
getKeys() can grab all the keys if you want it to
yes.
boolean is if you want it to grab the children keys too or if you just want the upper most keys
but this is simpler than getting all the keys in config, checking if it exists in config, get the key and value in defaultMap, then set it inside the config
aandd it works just as expected
programming 101
yeah, yaml doesn't like maps
usually got to iterate over your map depending how you want it saved or convert the map to a List since yaml has no problems with Lists 🙂
Lists are dog when dealing with config
sometimes
glad some one laughed at that lmao
what's the best way to figure out if it's my plugin causing lag or the world
im having a problem where in a void world my plguin was fine but when i get an actual world it lags
im trying to load all chunks etc but the world just sucks
wtf, im so stupid i didnt realize taht return cancels a loop instead of cancelling an if statement
forever loops?
none, ive got a few schedulers
but thats about it
https://wiki.vg/Entity_metadata#Entity_Metadata_Format#Entity
Is that actually up to date?
lol, yeah need to use return; to exit an if statement early
YES I JUST REALIZED IT AFTER 2DAYS LMAOOO
Is there a better way to read yml files?
I'm using getConfig() now
The server had reload to make the plugin reload config.yml
And config.yml just only one file
@analog prairie wait a minute i found myself in the same problem and i got a solution just wait while i finish typing this and start finding the code to copy paste from my project to here thank you for your understanding and im sorry to make you read it all up to here. ok ill stop here no really.
configFile.options().copyDefaults(true);
plugin.saveConfig();
plugin.reloadConfig();
configFile = plugin.getConfig();
``` @analog prairie try this
???
I don't understand these words
What do you mean
@analog prairie try thiss
OK
see if it works
wdym?
I need more yml to sort function settings
do you have multiple config files?
Y
https://github.com/frostalf/ServerTutorial/blob/master/ServerTutorial/src/main/java/pw/hwk/tutorial/data/DataLoading.java
here is an example of how to load custom yaml files 🙂
Should be
custom name visible does not work but the other properties do
I will try it later 🌟
You can't use string, you know right?
Show your code
When it comes to yml file. there is an important question that needs to be answered. Does server admin need to see/change stored properties? If yes use YML if not use JSON.
ok found the error thanks anyway ^^
What was it?
i have set another propertie which probably prevented the custom name visible 🤷♂️
btw is there somthing that can organize config.yml alphabetically? smh if I make changes to it ingame, the order of it changes so that the modified value is in the bottom.
this would be pointless and very inefficient lol
well its kinda (whats the word when you dont like it?) when you edit the config very often.
I have a function that is similar to what you are wanting
ok maybe I don't have it anymore
anyways you are going to have to create your own function that loads the data and then sorts it how you want, and then save it
Yes; wiki.vg is always up-to-date
thanks
most of the time
dependencies {
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.1'
implementation 'com.google.code.gson:gson:2.8.9'
compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
}
Is this correct?
Thanks
can i use a normal hashmap when working with concurrency?
depends on how the hashmap is going to be used
you can use a normal hashmap regardless of use, but for certain things you'd need to do a bit of extra work manually.
under certain circumstances though you should be able to use a regular hashmap without extra work
boolean isFlying() does this return true when player fly with an elytra or fly with creative mode?
flying is creative flight, gliding is elytra
oh.
you are fine with a normal hashmap if all you are doing is reading from it from multiple threads. It becomes an issue when you need to add stuff to that hashmap from multiple threads
if you need to write to it, then best to use ConcurrentHashMap
will this a concurrentmodification ex?
someHashmap.values.forEach(value -> if (value.something() == null) { remove the entry }?
removing entries is considered writing so yeah it will most likely CME
if you are running that method from multiple threads
well I gave you the other hashmap if you want concurrency
ConcurrentHashMap it is thread safe
alright
log4j2.yml must put at main class path right?
Spigot_ExpTech_whes1015/log4j2.yml
Spigot_ExpTech_whes1015/main.java
Hello! im trying to generate random loot from a set of minecraft loottables, not custom ones
i need to get the list of items a loot table has in order to then randomly select one of them
and give itto the player
but the class LootTables doesnt let me get a list of a certain loot table enum's ItemStack?
Can not set final int field net.minecraft.network.protocol.game.PacketPlayOutMount.a to java.lang.Class
Is there any way to work around this with Field?
does PlayerExpChangeEvent when xp is modified via vanilla command or plugin?
Yea should be
Sometimes few things remain outdated, which is unfortunate(and rare)
its maintained by the community
if you find an error, you can fix it
But wiki.vg should be very reliable
how do I make regex work?
String response = "testx";
Pattern p = Pattern.compile("(.)");
Matcher m = p.matcher(response);
System.out.println(m.group(1));
```gives error No match found
nothing works i am using PlayerInteractAtEntityEvent event
And you're registering the event and everything?
No I want like when a player has my own custom can do a lighting strike on a mob
Custom item? So when a player say holds the "stick of smiting" they can right click and cast lightning? What exactly isn't working
Got the code that isn't working?
Hello, any developer?
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!
I know it sounds absurd, but the yml in my configuration if I delete something in the folder that my plugin created and not in the jar it still detects it, does anyone know how to solve it?
do you have the copyDefaults or something similiar to that
havent check bukkit methods in a while
for example I delete data: 1 in the yml of the folder that I create, my plugin keeps detecting it if I don't delete it in the jar it keeps detecting it
well, the copyDefaults, i think it copy the config into memory
maybe after you delete the config
you should reload them, by using the reload method i think
but for example it is not only in config.yml say no in other yml that I create for example messages.yml, if you understand right?
It is not the reload method, I do not mean that if I delete something in the configuration it reloads automatically, if not that it reloads the configuration it continues to detect it if it comes by default in the configuration.
no no nono you dont understand what im saying...
so for example you have the custom config
message.yml
do you do something like this onEnabled?
messageYml.getConfig().options().copyDefaults();
I mean, I already put the copy Defaults but even when deleting something it continues to detect it if it comes by default and I must delete it in the jar for it to take effect and I don't want that.
try remove that line
because if you remove yml without reloading the config system i guess the memory config dont reload and it will continue to use the yml in memory
but that is my guess, i might be wrong, dont blame me for that, i havent use bukkit in a while now 😛
@EventHandler(priority = EventPriority.HIGH)
public void onContainerBreak(BlockBreakEvent e) {
final BlockState block = e.getBlock().getState();
final boolean isNameable = block instanceof Nameable;
if(isNameable) {
if(isNamed(block)) {
((Nameable) block).setCustomName(null);
block.update();
}
}
}
I have a plugin that is naming chests when they get placed, and I want to undo this when the block gets broken. But the above code doesn't seem to be taking effect.
How can I change either the block that a drop is generated from, or the drop a block causes?
yes i mean how do i do it? ik how to do the lighting strike at a mob thing but only using my custom item to use it idk (sorry if my English is bad)
It's fine I understand. As long as the item has something identifiable on it you can use to identify it it should be really easy to do.
nbt, pdc, custom model data, names, lore...
Slap some hidden attributes on it and you're golden. Unless it's an older version then it's hiding it in the lore or whatever
when someone has my own custom item he can do this with the item
Alright and what's not working?
idk how to do it
can you help me to do it?
public Damage(){
flagCount.put( flagCount.put(*damager*.getName(), Flags);
}
@EventHandler
public void DamageEntity(EntityDamageByEntityEvent event) throws IOException {
if(event.getDamager() instanceof Player) {
Player *damager* = (Player) event.getDamager();```
Hey
Is there no solution to this?
I want to access damager but its local
cause its in the Event
I am creating a constructor
I mean you have the interact event right? You can get the player from it and then get the inventory and then the main hand. That will allow you to check if the item is what you want it to be.
any1 know what happens when i get a non-existing tag with nbtApi
no i want it like this but at an enity but without the explasion it is gonna be lighting strike
can you help me?
Wait you want it to do lightning? Is the explosion working? Im confused.
this is example
yes i want lighting but idk how to?
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Hello people, I'm making it so you have a 20% chance drop diamond from killing a creeper, so I made a random https://prnt.sc/26948pr
but I NEVER get the diamond
I am printing the result
it's ALWAYS 96
tf
Show entire code
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.
ohh right
😄 you will need to run the random every time you run smth
well, I made a code where when the player looks at an entity a hologram will appear, but I'm trying to make that every time the player moves while looking at this entity it rotates towards you, but sometimes it teleports to my angle in milliseconds, then it stays static looking only in one direction
https://paste.md-5.net/ayozamosef.java
does anyone know why, or how can i fix it?
what program should i use to make a poster, like instead of writing my description i would make an image
Your other code snippet had you spawning lightning so you know how to do it. I'm confused to what exactly you need help with?
?paste
Any image program is fine; Photoshop, GIMP, Paint.NET, Krita, Illustrator, Inkscape. Depending on what your goal is these work fine
someone help me on dm?
you basically want an armorstand to be 3 blocks in front of you and looking at you too ?
not necessary, i already spawned the armor stand when the player look to entity
i just want to make when the player move, the ''armor stand'' rotate to my angle
can i dm you?
i already have made that code, but when i move the entity dont rotate for me, sometimes in miliseconds rotate, later stays static looking only in one direction
what ??
you want that the armor stand rotates relative to the player so the armorstand will always have the map on it pointing to the player ?
yes
I mean you can but it's usually best to ask questions here so more people can apply their knowledge as well
like the holograms do you know?
then your code looks a bit more complicated to me then it should be
how can i reach the clickedEntity value on InteractAtEntityEvent from Inventory Close event https://paste.md-5.net/equmocehiv.java
like the playernames are always readable on same y-lvl
tf
what made the code a little complicated was that I had to use ray trace to detect an entity the player is looking at, and check if the previous entity he was looking at wasn't the one he was looking at.
do you update the armorstand after its spawned or do you only update it while the player looks directly on it ?
Anyone know this funny little issue?
I'm actually using a thread that runs at 1 tick and I keep updating this method for all players
then I see the entity that the player is looking at
but my real problem, is that the armor stand isn't rotating to the player's location, one time or another it does, but then it stops
Photoshop?
You're trying to get a value that doesn't exist
How could I fix that?
Use contains or see if value is null
ok, just got back to my pc and I realized that I only had to move ```java
Random r = new Random();
int chance = r.nextInt(100)+1;
👏
How could I do that by chance?
?learnjava This is java basics ;/
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.
how can i reach the clickedEntity value on InteractAtEntityEvent from Inventory Close event https://paste.md-5.net/equmocehiv.java
when do you update the armor stand rotation ?
yes
when
when
private void makeLook(ArmorStand armor,Player player) {
Location loc = player.getLocation();
Location eloc = armor.getLocation();
final double xd = loc.getX() - eloc.getX(),
yd = loc.getY() - eloc.getY(),
zd = loc.getZ() - eloc.getZ(),
yaw = Math.atan2(xd, zd) - 90,
ajd2 = (xd * xd) + (zd * zd),
paral = Math.sqrt(ajd2),
pitch = Math.atan2(yd, paral) - 90;
Location newl = eloc.setDirection(new Vector(pitch, yaw, 0));
armor.teleport(newl);
// armor.setHeadPose(new EulerAngle(Math.toRadians(pitch), Math.toRadians(yaw), 0));
}```
english is not my main
do you update it only 1 time ?
yes
So do i
then how would you suppose it to rotate O.o
But how could I define it as a value
EGH MATH AAAA
hiss
well it wont update if you dont run the method to update the rotation ... give me some time i will try a code
You put stuff in the map
i just get that code on a site
Yes I've done that, but the integer value isn't connected to a integer how could I connect that?
You're not putting anything
I change Integer to 0 as example?
I have the map somewhere else within my code lemme get it
how can i reach the clickedEntity value on InteractAtEntityEvent from Inventory Close event https://paste.md-5.net/equmocehiv.java
You will have to store the cuffed player somewhere. You can store them in a map for example
Full code
That's not going to work
Why wouldn't it?
But how do I set it as a integer?
I'm trying to set it as 0 + 1 basically
and so on
@minor garnet
final ArmorStand armorStand = (ArmorStand) p.getWorld().spawn(p.getLocation(),ArmorStand.class);
armorStand.setGravity(false);
armorStand.getEquipment().setItemInMainHand(new org.bukkit.inventory.ItemStack(Material.DIAMOND_SWORD));
Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
@Override
public void run() {
Location pLoc = p.getLocation().clone();
Location targetLoc = armorStand.getLocation().clone();
pLoc.setY(0);
targetLoc.setY(0);
Vector dif = pLoc.subtract(targetLoc).toVector(); armorStand.teleport(armorStand.getLocation().setDirection(dif));
}
},1,1);
this thing will work 100% perfect
Use getOrDefault
im sure getOrDefault use two params... the key and the default value
(Integer.toString(stats.getOrDefault(value)));
i have arraylist?
this armor stand rotate to player looking from it? hm
I recommend a map in this case. So you know who's cuffing who
yes... all the time
you problem is probably that you set the direction just one time and not multiple times every time the player moves or smth
There is no default value there
is right..
i think not becuase:
How do I set the default value?
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
Bukkit.getOnlinePlayers().forEach(player -> management.showInfo(player));
}
}, 0, 1L);```
It's the second argument in that method
declaration: module: java.base, package: java.util, interface: Map
Thank you
in this case if i need to control cuffed people i need to take the player as clickedEntity which tried to cuff a player
public static String stats = stats.getString("stats.Integer", "0"); like this?
hey everyone i need help making a plugin is anyone willing to teach me how to make one ?
in arraylist im controlling the clickedEntity if he cuffed
The internet is
?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.
your stats are HashMap<Player, Integer> not?
isnt your code returning errors in console ?
Yes
no?
then use stats.getOrDefault(playerVar, 0)
what happens if looking.get(player) is null ?
if the player is not in looking this should then be "null == entity" and thats already wrong
you can also set the PersistentDataContainer instead of a different name O.o
How do I store player data without using HashMaps, I had about YAML files but I have never used them before
Why not use HashMaps
?pdc
They are giving me a lot of issues
@spiral light
is this your working code right now ?
no
What issues. Also if you want persistent data see the link FreeSoccerHDX sent
is my old code made using skript
public static String stats = stats.getOrDefault(Player, 0);
stats.replace(stats.getOrDefault(Player, value + 1)
would this work?
int value = stats.get("Integer");
Also why static this is going to cause issues
I set it as that
and in case the player is not already looking at an entity, and if he has not added the entity to the map yet, do not null check
can you send me a video from it?
does anyone know i could decrease player's jump length
Do I replace "value" with Integer?
how about just copy it and test it with a cmd O.o dont know where to put video and time waste anyway
ofc
... please just learn java basics and how maps work. I can't spoonfeed you every step. There are plenty of guides online
I'm just onto HashMaps
Don't think you can. That's client side.
Hm maybe place a slab or smth above the head
I'm learning the java basics and just got onto HashMaps
Keep reading that then. Don't try to use Spigot right now
I am trying to store the amount of flags a player has, the amount of flags a player has gets updated everytime they hit a entity. So then there is a command to check the amount of flags with HashMaps it returns Null
Does the flags need to be saved during restart. Also are you making an anticheat...?
Yes
thats yeah what i anticipated, well thanks anyways :p
Put a couple System Outs on the PlayerMoveEvent and watch their xyz values and their velocity.
Jumping is really obnoxious to control so you'll have to watch those values and do some guesswork.
Like if their y location goes up and their upwards y velocity is between val1 & val2, then set their velocity to zero or something
If hashmaps are giving you problems you should not be making anticheats
You are not ready for that mess
Anyways send your code and we can help better
why not just use Stastistics Event and listen to jumpms that player has done
That's.. a good idea.
I'll have to use that in my project
Oh wait let me just create a constructor
Movenent is still client side and it will cause strange and annoying behaviour on slow connections
I do not recommend handling it this way
hmmm
I found the solution thank you
I thought I would take a big project to put my experience to the test, so its a personal project xD
Anticheats are a bad way to do so. Make something creative maybe multiblock structures and machines. or another npc plugin
reinvent essentials
yes
the main reason behind trying to make their jumps smaller, is that if i simply decrease their movement speed attribute, it barely does anything when sprint jumping
I have created a lot of projects already
Anticheats require a good understanding of how Minecraft works internally
True
not just minecraft
^
But also the cheats
so minecraft
apart from minecraft