#help-development
1 messages Β· Page 942 of 1
Let's say you were to suffer a cardiac emergency suddenly (e.g. cardiac arrest). How much would you be billed and how much would you end up paying? Just an approximate number
Particularly in your case with your insurance etc
Depends, but you could easily expect $2k-$5k on the low end and no more then $10k
For me its free since i have the VA
If i used my jobs insurance i would probably only pay $500
And that's covered by insurance, right?
A good majority yes. So as i said just before you replied i would probanly have to cover $500
General rule is your insurance will cover something like 70%-80% of the bill. The rest would be on you. Lowest you could expect or most is you are covering half but thats like dirt cheap insurance lmao
I see. That's kind of a relief then
Though I was browsing my brain and a topic of housing prices came up π¬π¬
They are an atrocity across the entire world rn
Most people are not ending up in the hospital either. So medical stuff is only a worry if you are a frequent flyer
But from what I know it's really prevalent in the US
Gotcha
Housing prices vary wildly on state and where in that state lmao
How about yours?
but not by much
I currently pay $1,500 for a one bedroom apartment. Its like almost 900sq ft
And my utility bill is usually no more then $140
I'm struggling to visualize 900sq ft lol
Yeahhh
83m^2
the houses start at like 500k
Yeah I ran the converter but still didn't imagine much
just imagine a 83 meter long hallway that's 1 meter wide lol
Lmao
Well that's long lmao
Well would 83sq meters be sustainable for, for example, a small party? Like idk 7 people celebrating new year and goofing
sure
of course
For some reason I find it hard to visualize 83 sq m sorry lol
My apartment is almost a perfect square. 30ft x30ft
9.1m x 9.1m
i assume it has walls
i just googled "80m^2 apartments" and this eg is one
Square footage in the US is measured by usable space not the overall dimensions of the four outer walls
yes i know, we do the same here
i'm talking if your perfect square is separated by walls
What does kind mean?
Bedroom?
bedroom has to of course
child
Alex do you enjoy your life in Germany?
Oh interesting
it's pretty great imho lol
I'm just upset that carlos doesnt show up
Yeah I've heard some good things about life in Germany
Carlos?
To be fair alex is rich like me
Flexing on us peasants xD
some dude who shall fix my wall
Well better then you breaking doors in random hotels
i was told "carlos shows up at 8am" and it's 8.15 now
Where is d o o r
It broke
Ah yes, the most convenient door. No door
But alex didnt break it this time.
Same actually
Living room to kitchen
your fist will ;d
ArrayDeque is it synchronized by bakkit?
or cannot be combined with bukkit task and asynchrony
I'm deleting the chunk if necessary
if i want to start plugin dev
where should i start from ?
write a simple plugin
for example rtp plugin
you can see all forms of tutorials by search on youtube google duckduckgo
i don't know if rtp is the best
he'll end up tp into some chunk
Learning programming. In this case Java and/or Kotlin. You can learn while doing tutorials, but first you should learn the basics of Java. How to print something, what types are and how to initialize them, what inheritance is etc.
ik a decent bit of java
i dont know kotlin tho
Okay, then start reading docs and tutorials on how to create plugins and what there's to it
U don't need Kotlin
any useful links ?
It's just another language that compiles to the JVM
Let me search rq, I used a specific tutorial series back in the day but I don't think I'll find that
Maybe this helps
here's a small guide on how to setup a project with IJ + maven https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/
it doesnt explain the API though, only the project setup
I mean we can assume when someone knows how to program on an intermediate level they'll understand the rough procedure on how to setup things. But this might be helpful in case you don't know. Tho, I think OP wanted to know the API specifics
So may wanna try dis
k ima look into it
i should use maven over gradle right ?
Well, preferably you would use gradle but since you donβt know the difference between the two, I would stick to maven lol
Use what you're most comfortable with
if you've never worked with neither of them then start with maven
i don't think so. many people know basic java but never heard of maven for example
javac go crazy
That is because they dont bother learning build systems. One of the disadvantages of not having formal education in such things
Hey, minecraft didnt use a build system
But now they know so hopefully they will take time to learn and research things
Pretty sure it did
The common build system that most IDE's default to is the ant build system
Exception is eclipse they always done their own thing lol
Na he just yeeted jars in a libs folder and called it a day
jdk version 17 for mc 1.20.4 ??
Manually added to compilation classpath
The same structure has remained to this day
.minecraft/libs
except they have been flattened down to include group, name & version sub-folders
Java 17 is the minimum requirement for that version
ill have to create a server to test my plugin right ?
is there any place where i can run a server for a short period of time for free ?
your own computer
my pc isnt very strong
dont worry
gguyys how to properly exclude meta-inf from jar in maven?
can't fix sertificate error for a week :<
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
I believe
Sniped
what is the name of the antivirus jar plugins that 1 person created and posted on spigotmc
we talk with him
long time ago
optic?
cats
person say what this plugin should have been paid
bro are u ask the owner name or the plugin name
like yes
how strong does my server have to be ?
A (mid range) CPU from the last 10 years is fine
I used to run Intellij + 2 clients + server on my i5 3470
how to put head in tab with skins in the license server
Send a player tab packet with a skin
why do some plugins overlap the heads on the tab?
without tab plugin heads exists
I dont know what that is supposed to mean even
why do some plugins remove the heads on the tab when enabled?
If you're talking about flickering extra heads that could be because of plugins like Citizens
That's due to a limitation of Minecraft
The packets required to spawn an NPC with skins is the same as adding it to the tab
so what they do is add it and then remove it again
for example premium tab not show heads in tab in license server
In newer versions this doesnt happen anymore becuase you can make a client aware of another player without adding him to the tablist
you mean heads removed or tab plugin remove this
You gonna end up accidentally summoning a demon if you dont stop with that gibberish...
sorry I don't understand English well
What do you mean that now the tab plugin does not remove heads from the tab sheet?
I think i get what you mean.
What they do is fill the tablist with empty profiles.
No skin, no tab name.
After that you can simply update the tab entries.
You want to know how those empty slots are made, right?
I want to know how to make a plugin on a tab so as not to remove the head from the tab
Idk what premim tab is
Probably talking about an online mode server
still no idea what they're trying to do though
premium tab removes heads from the tab when using the plugin and I want to create my own so that it does not remove heads from the tab
??
in online mode premiun tab plugin delete heads too
oh this mean someone lie me
how to make own plugin not affect the head in the list of tabs
ask the tab support
fairs
RayTraceResult rayTraceResult = player.getWorld().rayTraceEntities(getLocationInFront(player, 1.2), player.getLocation().getDirection().multiply(1), Bukkit.getViewDistance(), 1f);
if(rayTraceResult == null) {
Bukkit.broadcast(Component.text("RTR = null"));
return;
}
Entity entity = rayTraceResult.getHitEntity();
if(rayTraceResult.getHitEntity() == null) {
Bukkit.broadcast(Component.text("entity = null"));
return;
}
if(entity == player){
Bukkit.broadcast(Component.text("entity = player"));
return;
}
if(!(entity instanceof LivingEntity)){
Bukkit.broadcast(Component.text("entity is not living"));
return;
}
Bukkit.broadcast(Component.text(entity.getType().toString()));
((LivingEntity) entity).damage(damage);
}```
``` private Location getLocationInFront(Player player, double distance) {
Vector direction = player.getLocation().getDirection().normalize();
Vector offset = direction.multiply(distance);
Location locationInFront = player.getLocation().add(offset);
return locationInFront;
}``` i wrote this, but it doesn't work. the result of raytrace is player. but player is looking on sheep, i was trying to add to location distance, so as not to count the player, but it didn't help
You'll want the eye location
Additional, you also can just pass a predicate to the raytrace method and filter out the source player
yes
do i need to make my command class in the same folder as my plugin class
or somewhere else ?
it's up to you
Everything is arbitrary. You could write everything into a single file. Heck you could even write your entire project into a single line of code.
Its all a matter on how organized you want your code to be. And using multiple packages and classes will help a great deal with that.
In short I'd make a package for commands
public void fire(Player player, ItemStack item){
playFireSound(player.getLocation());
damageUsingRayTrace(player);
if(item == null) return;
if(item.getType() == Material.AIR) return;
if(item.getType() != material) return;
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setCustomModelData(fire[0]);
int nowBullets = item.getItemMeta().getPersistentDataContainer().get(MoreBullets.WEAPON_BULLETS, PersistentDataType.INTEGER);
item.getItemMeta().getPersistentDataContainer().set(MoreBullets.WEAPON_BULLETS, PersistentDataType.INTEGER, nowBullets-1);
item.setItemMeta(itemMeta);
Bukkit.broadcast(Component.text(item.getItemMeta().getPersistentDataContainer().get(MoreBullets.WEAPON_BULLETS, PersistentDataType.INTEGER)));
}
``` why pdc is not updating
Because you are calling item.getItemMeta each time
Which returns a copy
Use the ItemMeta instance you already have
ohh, okay
in bukkit api exists event which check in which location or block the dropped item fell?
oh wait i find
ok so like https://www.spigotmc.org/wiki/create-a-simple-command/ is this outdated ?
Nope, not outdated.
Hi i have a question , how i can make it so when player do /link , it will give him the rank he have in game to the discord server the bot in?
i don't want to use extra 3rd plugin
what have i done wrong then ?
There is honestly no ItemStack which cant be directly instantiated...
What ItemStack did you import?
for now iam using JDA library
whatever my ide told me
which is org.bukkit.inventory.ItemStack;
If you dont want JDA then you can use discords web api.
JDA is just a wrapper for a bunch of rest requests.
Show more code pls
itemtype rework maybe?
no but ppl keep coming up with development builds
π€¨
i already have JDA installed in my project
Well then use it π
When the player types /link then you can just send him a code he has to enter on discord.
In the backend you store <TheKey : MinecraftUUID>.
Then you wait for the player to use a command on discord with the same key.
There are more sophisticated ways, but this is a trivial approach.
muh time limit
You could also send the player a link with metadata attached. This way he only has to click on the discord link and is attached automatically
Within 500ms or he is not human
same tick
i already did that , i am asking about how i can get the player rank from minecraft server , and then send it to the discord bot? so he will assign it to the discord user
who linked
So you are asking how to send data from one application to another?
possible?
for example i use luckperms , get the rank player have and assign it in discord
Yes, ofc. That how the entire internet works...
after he do /link
There is a million different ways you can do that.
Just use whatever you are familiar with. RPCs are an option. I think discord has those.
alright thanks , gonna see how i can do it
Webhooks work.
Opening a rest endpoint on your bot works. (It uses those anyways).
Sockets work.
Redis or RabbitMQ works.
RPCs (as mentioned before)
SQL update hooks are also ok
https://discord.com/developers/docs/intro
Here are all endpoints you can use on your bot
i decided not to make the fake armorstand with protocollib , i will use a lib for that ..
to much work to support 1.8 - 1.13.2 , 1.16.5 , 1.19.4 , 1.20.4
no 1.19.2?
why would you lol
1.13.2 is a rather interesting one. And why no 1.12.2?
so yes, mental help may be needed
I believe 1.12 is within the range 1.8 - 1.13
okay randomly using ranges it unfair
Im experiencing weird issue thats related to BukkitTask. I want to execute a task after a delay. However my code seems to run only when the delay is set to 0.
logger.info("Now inside BukkitTask Task");
new TridentHandler(player, trident, logger).runTask(plugin);
cooldowns.put(player.getUniqueId(), System.currentTimeMillis() + cooldown);
}, cooldown);```
is there something im missing here? 'plugin' variable is defined before task and pointed to my main class that extends JavaPlugin
You using ticks or seconds?
You should not be using Player in tasks iirc
Always use UUID and get the player when the task is run
For your actual problem, idk sadly
I gues seconds
Bukkit stuff uses ticks
good point, you have mismatch of time with the cooldown (adding millis to ticks) and using ticks in the task
why is that
I'll let someone smarter explain that, I am not even sure you are supposed to do that here
But I believe it was something with keeping the Player in memory if player already left
i actually have the cooldown calculations in different function that returns the value in milliseconds
i guess that would be a NPE
true
yeah you should use ticks
yea gonna do that :D thanks
well no
But it would not do what you want it to do
I think
havent experienced UB in spigot yet, ill test it
but why stores Player π€
ok i actually cant test it bc im not on my computer nor have friends :D
ive been a fool. thank you guys for help
looking at old code of mine π
does the name of AttributeModifiers matter?
if you ever feel bad https://github.com/Y2Kwastaken/SimpleHoes
let's dive in π
well this caught me off guard
is that a curly bracket or are you just happy to see me?
every beginner java dev π€ static abooz
i'll carry on coding π
well that might be a standard eclipse formatting moment
wtf was i cooking ππππ
i couldn't come up with this if i wanted to these days
well at least it was minecraft:clear and not just clear
xd
Okay, looking at my first plugin I am greeted with something I'd never do these days: A changelog. https://github.com/Geolykt/bake/blob/master/bake/src/de/geolykt/bake/Bake.java#L35-L116
whats with the 3 clears?
if you ever feel bad, https://github.com/radstevee/tgttos-remake
i really needed to make sure i clerared it apparently
π₯
why are you doing this while in Main π
sameee
didnt even bother deleting the comments lmao
well we get to cyberbully each other on the basis of our first plugins
isn't that the bonding experience we all need
can someone help me my server keeps crashing at net.minecraft.nbt.MojangsonParser.g(SourceFile:189) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3871-Spigot-d2eba2c-3f9263b]
i think thats bc a javaplugin cant be static
sniped π
wdym
Okay the worst infraction I did in my first plugin was making my fields be uppercase for the first character
C# leaking
I never touched C# funnily enough
kinda goated honestly
And I won't ever touch it either
he answered faster
first line: yoo he understands di in his first project!
second line: mr incredible grayscale
https://github.com/radstevee/tgttos-remake/blob/master/src/main/java/net/radsteve/tgttos/Config.java
capital letters in front of variable names π
im not getting any work done with this shit π
with what
what the fuck
looking at shitty code
show me
i spend most of my day looking at shity code
rad and y2k sent their plugins
i am recoding an old plugin sorta rn so i am subject to it too
and it's horror
meanwhile my current projects
wanna see one of my old plugins? xd
ew
ive got a better idea
please send it but i won't look rn i need to do shit lol
do you wanna look at a utility i made 10 minutes ago
i can send u a project i used to teach fresh beginners java/spigot
dont ask
it came to my head and i was like oh that's brillinnt!
then i made it
and like
what the fuck
well it exists now
allTheBasics is a Spigot plugin containing everything necessary for your minecraft Server! - sieadev/allTheBasics
true
we are sharing SHITTY code rn illusion
oh mb
immediately why
got it
now do it for double long float and short
nice conventions drvosss lol
LMFAO
xdd i told you i used it to teach people java and spigot
i let them have their freedom
double is done for up to 1E303
long exists too
short and float eh
i never continued working on this now that i think about it loo
stop acting like its MY code ππ
you probably still are mcci hasn't been a thing for that long
i will think of it
π
that was actually an mcc recreation
before mcci was a thing
π€
same shit
so were just ignoring the fact that it exists for like 5 years or so
yeah that's not long
true i havent been doing plugin dev for long
i just wanted to check the first commit and then realised there was no git repo in there π
my plugin.yml can time travel
you havent seen what i wrote
ow
Builder!!
thats some of the better code in my first plugin
lol
lol
Error occurred while enabling pluginname v${project.version} (Is it up to date?) java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.sendMessage(String)" because the return value of "org.bukkit.Bukkit.getPlayer(String)" is null
when im running my server then im getting this error in the console
i added some events and listerners to my plugin btw
looks like i used to have everything in my main file
https://github.com/FourteenBrush/MagmaBuildNetwork/commit/cf5632252ee1722fc8b768e6ee1bd7f6b362cd15
player is obviously null then
null check then
probably followed some npc tutorial
i mean i figured that part out
why tho
do i need to add my player name or somin ?
no just make sure its valid, idk where you got that name from
i need my player name
iv made some baisic code that broadcasts stuff when the player joins the server
public void onPlayerJoin(PlayerJoinEvent event) { event.setJoinMessage("Welcome to this server!"+ event.getPlayer().getName()); }
yeah?
ye
so then im getting this error in console
Error occurred while enabling pluginname v${project.version} (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.sendMessage(String)" because the return value of "org.bukkit.Bukkit.getPlayer(String)" is null
show surrounding code
its in this class
public class MyListener implements Listener {the methord}
nd some imports thats it
event.getPlayer(str) isnt used in that code
thats doesnt really make sense
also this is while enabling
how did you setup your main?
i think you didnβt register the listener properly
I'm trying to boost a player's fortune enchantment on their tool by 1 when breaking certain blocks if possible (eg. Fortune 1 gives the drops of Fortune 2)
I currently have tried cancelling the drops and then using Block#getDrops(ItemStack) to spawn new drops but am realising that this would break compatibility with custom drop plugins
Any ideas?
u can edit drops on blockbreak
u dont need to cancel and replace
u can edit existing ones
and by making your listener get called last you can make sure that other plugins apply their custom drops first
(event priority)
That solution is definitely possible but I'm not sure how I would calculate the enchantment increases for this
So manually calculating the fortune for any extra drops is the best way?
public void onEnable(){getServer().getPluginManager().registerEvents(new MyListener(), this);}
probably yh
i wouldnt know any other way
how can i check if the player has no inventory opened
csnt
cant
at least for their own inventory
you can only check chests and stuff like that
i want to check a custom inv
oh get inventory, ok
its never null tho
that would get the contents of their imv
yh wait
1 sec
im slow
getOpenInventory @near crypt
its also never null
thats what i want to do, but how can i check when the inventory is closed.. this is my problem
InventoryCloseEvent
declaration: package: org.bukkit.event.inventory, class: InventoryCloseEvent
hmm ok
the thing i want to do is just to stop a runnable when the inventory is closed by the player
wait ima reask my question
It was completely wrong
so my code is
` public void onPlayerJoin(PlayerJoinEvent event) {
event.setJoinMessage("Welcome to this server!"+ event.getPlayer().getName());
Bukkit.broadcastMessage("Welcome to the server!");
}`
and in my main class
public void onEnable() { getServer().getPluginManager().registerEvents(new MyListener(), this);}
im my chat nothin shows
same as the console
yes
At what point should I be modifying the drops - I was looking at BlockDropItemEvent and saw that I shouldn't be adding drops through it
"It is not legal however to add new items to the list"
ok it works now
but it says the welcome to the server
and then the welcome to the server ! playername
even tho my code is in the other way
im just wondering whats the reason behind that
I would assume event is called before player actually join
And join message is sent later
While your broadcast fires instantly
why cant they just let me do it π
java.lang.IllegalStateException: Asynchronous player kick!
BlockDropItemEvent is the correct method to modify the drops of blocks.
Because that would mess up the entire game state...
Just run the kick method sync
Why do you need to run a kick method async anyway
the player isnt sync after the kick either way, so?
It still needs to be done sync
what happens after it's done has nothing to do with the problem?
He is registered in lists, he has an attached entity in the world that needs to be removed sync, the PlayerQuitEvent needs to be called sync.
There are just so many parts that could cause the current tick to throw an exception if you where to force an async kick.
ok
how do i establish a ManyToOne relationship in hibernate, with just the uuid (primary key for the OneToMany object)
please separate many to one I did not understand π
How would I modify them with that event though?
Also, does Block#breakNaturally trigger the BlockDropItemEvent?
that was everything I'll say
You... put them in a collection and annotate it with ManyToOne?
Idk if i understand the question
how does player.getInventory.getItem(int i) work, like what number do I have to put to get the item of a specific spot
is it 0-35 or 1-36, and does it start the count on hotbar or the top
all the tutorials show it with a object reference in the many object
i only have the uuid
You need to check the hard coded slots online.
But if you want to get armor or the main/offhand, then there are better ways.
!?
where can I get the hard coded slots list? Also yes, theres better ways for armor or offhand but thats not what I need lol
Somewhere online π
0-8 is hotbar
and then it does 9-35 top left -> bottom right
36 is boots iirc
40 is offhand
for required args should i use [] or <>
in my usage
thank you
Relationships can exclusively be define between two entity classes.
UUID is not an Entity class so you cant define a relationship with it.
i could do it before hibernate π
the UUID is referenced in both entities
I mean you can just create a table for your UUIDs. And let them be stored for your objects without a relation contract:
@ElementCollection
@CollectionTable(name = "entity_uuids", joinColumns = @JoinColumn(name = "entity_id"))
@Column(name = "playerIds")
private List<UUID> playerIds = new ArrayList<>();
i have 10 items. i have a cart. all the items have a uuid pointing to the carts uuid. why cant i just use the uuid and why do i need the carts object reference when i can just have the uuid?
<>
btw i kinda forgot this part, if you get a slot's item and its empty, does it return null or an itemstack of air?
ty
Because you are now trying to manually handle relations between objects through implicit references.
This is simply not how relational data works.
Also the Items should not know in which cart they are in
if (offHandItem.getType() == Material.AIR) ?
in my case the items should as they are bans of a player
And what are they relating to?
to the bandata so i have all of them in a set
i dont know if there is a getall method in hibernate
i dont know how to get alle references of a uuid
so i just tried it like that
Hey,
I'm spawning some Mobs with my plugin, but when I spawn a Mob with EntityType.ZOMBIE it catches on fire.
I know so far this sounds like the normal behaviour, however I have disabled visual fire, so I'm unsure of what to do
Mob mob = (Mob) player.getWorld().spawnEntity(player.getLocation(), EntityType.ZOMBIE);
mob.setInvulnerable(true);
mob.setVisualFire(false);
mob.setSilent(true);
I assume visual fire doesn't override the regular fire
Just give it fire res or smth
set fire ticks to 0
Won't help
it should if you do it after visual fire is turned of
When spawning an entity and modifying it do use the spawn method that takes a consumer
It makes sure the changes to the mob are applied before it's spawned
instead of after
Could change the result assuming what DrVosss said is true
You should maybe draw an ERD.
- Identify/Create a list of all entities
- Define all attributes for the entities
- Map the relationships
- Minimize common relationships
Then just implement it in code.
All the other methods apply apart from the fire (unless I'm misunderstanding the method)
I'd honestly assume that the consumer just passes the created mob, I wouldn't see any reason for it not to
Edit: yea the method seems to just toggle whether visual fire should be always visible, so I'm using the method wrong
not even an erd, or a very shitty one
thanks, but i dont think my hibernate skill issue is resolved as i dont know how to even set up such relations properly
can u custom color a potion while still having a specific effect
i havent gotten one to work
Still do use the consumer
might be possible with shaders or resource packs
nvm i found setColor in potionmeta
^
Sadly doesn't work
neither does applying fire resistance
fire resistance only makes them not take damage tho, no?
should also stop them from starting to burn
if they aren't burning
or so I remember it at least
can check
Same code as before essentially. I tried fireResistance before using the method that takes a Consumer<Entity>
Mob mob = (Mob) player.getWorld().spawnEntity(player.getLocation(), EntityType.ZOMBIE);
mob.setInvulnerable(true);
mob.setSilent(true);
PotionEffect fireResistance = new PotionEffect(
PotionEffectType.FIRE_RESISTANCE,
Integer.MAX_VALUE,
1,
true,
false
);
mob.addPotionEffect(fireResistance);
interesting it doesn't stop them from starting to burn
Does your code require it to be a zombie
I need to work with all hostile mobs pretty much
oh well ig you could use nms
So I got a problem with one of my plugins is getting flagged as trojan
how can I resolve that problem
there is many people comming asking me why is your plugin tagged as virus
and it is pain in ass to explain to each of them that there are false positives
?paste
generally if you use straight Java with no reflection/tricks you will not be flagged
move it to your server if you can
Submit it as a sample to whatever antivirus is flagging it
or this
https://paste.md-5.net/nafeyifize.js hi, i get CorruptedModificationError but i dont know i to resolve in the code.
If it's Windows Defender they have their own page for that
what am i doing wrong here
playerInventory.first { it != null && it.isSimilar(ItemStack(Material.getMaterial("COPPER_BLOCK")!!)```
BedWars.getInstance().getArena().getConfigFile().getFileConfiguration().getStringList
do you mean concurrent modificationexception?
i get error in Team team = arena...
yes
you can't remove elements from a collection without traveling
it.type == material.Copper_Blcok doesn't work
however there is the iterator form that allows you that
public Team getTeam(Player player) {
return teams.stream()
.filter(team -> team.getPlayers().contains(player))
.findFirst()
.orElse(null);
}
is a simple steam
idk why get error
i mean get error team.getPlayers()
but idk how resolve
what's the error?
it might be your team.getPlayers, what do you do inside?
is a @Getter
is a list
?paste a stacktrace
btw consider using a Map for O(1), doesn't make much difference for O(n) where n < 100 but still
the stream has no bugs
nobody?
?notworking
i really think the bug is elsewhere
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
yeah CME
For ~100 its already a factor of 10x
So maybe more like less than a dozen
what kind of list is your .getPlayers() returning
yes but it is obviously wrong and this is a common function
Players
yeah but like noticable
oh well if it's obvious then you can fix it
WeakList?
Moron.
ArrayList
i have try async and not but give always problem
that, or the built in EntityCombustEvent π€¦ Man I forgot that exists
ngl I forgot that existed too
Quite a few things.
I would write it like this:
playerInventory.first { it != null && it.type == Material.COPPER_BLOCK }
In which case you might as well use spigots method for this
nah I mean you may mutate it at some point asynchronously
not iterate over it asynchronously, tho that also can give issues
Here is the method spigot already provides:
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/Inventory.html#first(org.bukkit.Material)
declaration: package: org.bukkit.inventory, interface: Inventory
nope, i have try now
Are you making a plugin?
check for startup errors
no, i miss the channel. I am just trying to connect plugins to mysql
Does Block#breakNaturally call BlockDropItemEvent
I believe so
Probably not
Ahh ok, I was just trying to use it but couldn't work out why it wasn't calling
I had assumed I made a mistake with my listener, what would be the best way to replicate a player breaking a block?
right it requires a player
declaration: package: org.bukkit.entity, interface: Player
try this
Additionally, a BlockDropItemEvent is called for the items dropped by this method (if successful).
in javadoc note
Ooh very handy
is there any way to make so entities (armor stands for example) does not interact when placing blocks or hitting?
armor stands have the marker flag
how do sound categories work, do they change anything related to the sound name when trying to play it?
Sound categories are tied to the user sound settings.
They are basically sound channels.
i see
Select the channel you want to play the sound on and then itβll go through the user filters for volume.
Is there a way to do #getDrops on a block state / material?
I'm unsure how that would help?
It depends on what you're trying to do
i use Java 22, selected in my project settings.
When I compile I get this error.
Unsupported class file major version 64
(I use Maven)
How do I fix this error?
Use Java 17
I did before, but I got an error with classfile major 65
I am trying to give the player the equivalent of +1 fortune drops. So if they have Fortune 3 on their pickaxe then they'll receive some extra drops for the difference between Fortune 3 and 4
65 is Java 21
Something you're depending on requires it
I'm using 22, which should backport 65?
is there an event that gets called when an anvil operation happens?
Are you sure you're using 22
Yes.
declaration: package: org.bukkit.event.inventory, class: PrepareAnvilEvent
Make sure your maven shade plugin and maven compiler plugin are on the very latest version
and the click event
^^ and if you're using mojmaps make sure the special source plugin is up to date
https://paste.md-5.net/qofezokilo.xml < pom
https://paste.md-5.net/afilupuzaq.sql < build log
Yeah its the shade plugin thats throwing. Pretty sure.
ignore C\Users\\, that's where i removed my name
Prepare is when you put an item in, not when you click the output
Compiler as well
saw that already
from what i can see you're correct
Update maven-shade to 3.5.1 (or whatever is latest)
to shade each thing in
Why... do you have it twice btw
4 times*
Wait i didnt scroll down
You only need 1

didnt know that
how do i combine them
i assume just move all of the <relocation> into one <relocations>
?
Yep
Same way.
ok
<filters>
<filter></filter>
<filter></filter>
<filter></filter>
</filters>
Send pom
Same solution
i have combined it all tho
my ide seems to think it doesnt exist
reload your mvn project
it seems to have the same issue
Send your pom again
have i not added mvn-ctrl?
it's saying that it doesn't exist
Reload your maven project
No, its on maven central. Its always visible to every maven project.
Ive just double checked with terminal and polled the resource. Its reachable.
i've added maven cenral to my pom and it picks it up now
When you use intellij: Click shift twice, and then search for "invalidate caches" and restart...
How can you set a skin to a head by its value? I haven't find anything on internet
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. Iβll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
thanks!
uuuh, do you maybe know how to for older versions? I'm looking to support 1.8+ (in that page there is another method, but supports 1.16+)
in 1.17 and older you'll need to use reflections.
this method gives you an itemstack for a base64 skin: https://github.com/mfnalex/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/SkullUtils.java#L138
and this method does the same for a placed head: https://github.com/mfnalex/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/SkullUtils.java#L97
ok, thanks
does this use nms? sorry, but i was wondering if I had to implement that (I think it does, according to what i saw)
isn't gameprofile nms?
hmm
Sorry if it's too basic but how can i import it?
Man the new snapshot is wild...
Any Item can be anything now. You can make gunpowder consumable and red dye a tool for breaking wood.
And anything can have durability now. And we finally have custom durability values and stack sizes (up to 99 i think).
nice
But one thing that caught my eye was this: Completely data driven item predicates
This would allow for recipe choices like *[damage~{durability:{min:3}}]
=> any item which has at least 3 uses left
and even for custom data predicates (since that also just a component now).
If we where to add an API layer for it
MMORPG servers gonna glow up with this one π£οΈ
the best thing is. that u can now make anything eatable :d
Customizing items will be actually wild now.
Just a random idea: Creaft a ton of bonemeal together, get a Bonemeal ItemStack thats not stackable and has a durability of 100 or so,
on use it loses durability and you actually see the green bar on the item going down
components
yea there are so many nice opportunies with this
Or a "Deep water bucket" where you can actually store dozens of source water blocks
With a bar filling up
& custom food will be alot easier as well
This enables so much...
Yes...
Custom expensive combat food that can be instantly eaten 
yea this choice is actually really nice by minecraft
I love all of this data driven stuff. We gonna have a blast with it.
does that mean i can finally have an item of choice with bundle preview
is this gonna be in 1.21?
dont people still use versions like 1.17
i feel like this is gonna take like 5 years for people to start using
i will use it :)
~ 70% are on 1.20.X according to bstats
1.8 is almost dead
fr
yeah i like that
where is 1.8.9 i thought that was the version most 1.8 pvpers played
IIRC latest server version is 1.8.8
that is a client update
not a server update
one of the few instances where the client version didn't match the server version or didn't need to anyways
1.20.5
Hey, i am coding a plugin rn that lets players switch between inventories per world. Now i get errors that an item does exist.
My codes does this:
- Take inventory and encode to base64
- save that string using yaml.
- Get the string and decode it and set it into the players inventory
My yaml looks something like this:
uuid + "." + world + "." + "buildinventory" has the string of the "buildinventory" stored in it
uuid + "." + world + "." + "normalinventory" has the string of the "normalinventory" stored in it
and
uuid + "." + world + "." + "buildmode" has a boolean wheater or not the player is in the buildmode, true meaning he is in the buildmode, false meaning he is in normal mode
This is my code:
https://pastebin.com/1sfCPx6S
If you need more details im open to vc or tell u more, its very "complicated"
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.
stacktrace?
1.20.5 i believe
custom stuff is gonna be so easy now
?
send the stacktrace pls
you can make your custom bows now too
im sorry im confused, ive never heard about that
im not english
Im gonna make a plugin that lets you refine and snort sugar for a speed rush
Kek
stacktrace = the console error message
ohhh
ok
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.
in line 123 you're calling toString() on offHandItem, even when offHandItem is null
yep, but offhandItem should never be null
if(offHandItem == null) {
dataOutput.writeObject(new ItemStack(Material.AIR));
} else {
dataOutput.writeObject(offHandItem);
}```
are you using an old config that still contains null for offhand?
and delete your config
my config is also empty
thats also weird
it says it changed it a minute ago but the file is empty
I am german to btw, is it ok for you to vc?
ello?
Im already in bed:p
10% on legacy stuff nice
.
1.8 pvp is superior
knockback items
w tapping
bow boosting
it just doesnt feel the same
youre forced to play slow
I prefer 1.9+ pvp with a sword but items like shields, end crystals and now the mace kinda ruin it for me
good thing as a programmer I can bend pvp to how I like it π
even without shields you just end up trading hits
trust me combos exist in 1.9 pvp
Hello everyone!
I've a problem on my proxy/spigot server and chat validation message.
lost connection: Chat message validation failure
Do you know how to desactivate it?
Are you using nms/packets?
Is there any way to forcibly render an entity when it is high up?
well there is this https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/LivingEntity.html#setRemoveWhenFarAway(boolean)
declaration: package: org.bukkit.entity, interface: LivingEntity
Only an option for display entities
whoever said chatgpt will outright replace programmers is smoking some fine crack
had a long day today that consisted of looking at chatgpt output and shaking my head
It's also making people dumber
Exhibit A: https://hackerone.com/reports/2199174
Summary:
Curl CVE-2023-38545 vulnerability code changes are disclosed on the internet
Steps To Reproduce:
To replicate the issue, I have searched in the Bard about this vulnerability. It disclosed what this vulnerability is about, code changes made for this fix, who made these changes, commit details etc even though this information is no...
Ah man canβt wait to make up vulnerabilities to claim bug bounties
the curl guy posted a rant about that
I remember reading that
I'm losing braincells doing this, I've spent an unreasonable amount of time troubleshooting and give up.
I'm trying to add this a user into a hashmap and it simply won't output the the user I've just added to the hashmap and instead returns it null
HashMap<String, Boolean> map = new HashMap<>();
Player p = (Player) commandSender;
map.put(p.getName(), false);
System.out.println(map.get(p.getName()));
nothing wrong with that tiny section of code you posted.
Give me a moment
I'll just post the entire thing
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (commandSender instanceof Player) {
Player p = (Player) commandSender;
Boolean active = false;
try {
active = QillaPlugin.godMode.get(p.getName());
} catch (NullPointerException exception) {
QillaPlugin.godMode.put(p.getName(), false);
}
if (!active) {
QillaPlugin.godMode.put(p.getName(), true);
p.sendMessage(ChatColor.GREEN + "You have been made invincible.");
} else {
QillaPlugin.godMode.put(p.getName(), false);
p.sendMessage(ChatColor.RED + "You are no longer invincible.");
}
} else if (commandSender instanceof ConsoleCommandSender) {
System.out.println(currentCommand + " cannot be run by console.");
} else {
System.out.println("There was an error running " + currentCommand);
}
return true;
}
This is in a different directory
@EventHandler
public void OnDamage(EntityDamageEvent e) {
Entity entity = e.getEntity();
if(entity instanceof Player && QillaPlugin.godMode.get(entity.getName())) {
e.setCancelled(true);
}
}
And this is the hashmap setup in the main directory
public static HashMap<String, Boolean> godMode = new HashMap<>();
It gives me null at the first if statement "if (!active) {"
This works just fine
Isn't a set a better data structure for this?
And shouldn't we use player ids instead of their username?
use boolean not Boolean
Still good to learn good habits from the beginning
If you're talking about the hasmap, it can't be primitive
Jesus christ
That's it
Appreciate it, I would've overlooked that a million times
Why's that?
a Set can't have duplicates.
You only add a players UUID to the Set if they are in god mode.
Mapping something to a Boolean -> just checking if a set contains that something
if (godMode.contains(p.getUniqueId()))...
Yeah that totally makes sense
names can change, The Player object can change. UUID is unique.
I'm fully aware, I was just too lazy to find a way to pull a uuid from the Player object rn
HashSet internal uses a HashMap iirc
As the #getName there is a #getUUID
it does, and just uses the KeySet
Oh cool
Ah yeah true true
So Set is still better ahah sorry
When you plug the guava concurrent map with weak keys into Collections.newSetFromMap
Massive brain
I'll assume it's getUniqueId
Idk how I overlooked that
easy to do as everyoen talks about UUID not UniqueId
Would it be better to put lists inside of the main file, inside the listener for godmode or a completely separate file
depends where you need to access it
But in this case, for performance
if multiple listeners need it then it has to be at a higher level in yrou design
performance makes no difference
Oh, I tried to put a uuid into a string and it gave me an error
you could rotate around Y
Itβs also probably in radians
ah yeah it's not goign to account for a non 45
just calculate teh pitch +90
does CB cap pitch at 0?
in location
CraftBukkit
thats 2d, but not hard to 3d it
isn't that the cross product?
Rotate of 90 degrees in a 3D space doesn't mean anything. What you want is the orthogonal (in 2D orthogonal = perpendicular) of a plan
So you need two vector defining your plan. You already have one (the direction)
you need the blue line
Problem is that you're dealing in 3 axis
from the existing white one
nah not hard.
take a look at this. it will draw a half circle based upon the players eyeLocation
apply it to your stand, and you'll be able to work out what step you need
public static void halfVertical(Player player) {
double radius = 3;
double every = Math.PI / 30;
Location loc = player.getEyeLocation();
for (double rad = 0; rad <= Math.PI; rad += every) {
double x = radius * Math.cos(rad);
double y = radius * Math.sin(rad);
double rotateZ = Math.toRadians(loc.getPitch() + 90);
double rotateY = Math.toRadians(-loc.getYaw() + 90);
Vector rotate = new Vector(x, y, 0);
rotate.rotateAroundZ(rotateZ);
rotate.rotateAroundY(rotateY);
Location finalLoc = loc.clone().add(rotate);
player.spawnParticle(Particle.FLAME, finalLoc, 1, 0, 0, 0, 0);
}
}```
you just need to find the rad to plugin in
So there is actually an easier method
To define the "plan of your direction" you can just use two vectors:
- The direction vector that you have
- An arbitrary vector like (1, 0, 0)
Once you have those two vectors you can do the cross product between those two
You should get the resultant orthogonal vector
(don't forget to normalise)
Vector direction = yourDirection;
Vector plan = new Vector(1, 0, 0);
if (Math.abs(direction.dot(plan)) > 0.999) {
plan = new Vector(0, 0, 1);
}
Vector orthogonal = direction.getCrossProduct(plan).normalize();
There is maybe a shorter way but I'm on my phone
You have to use Vector#getCrossProduct
Because Vector#crossProduct changes the original vector
Is that even a thing
Yes, vec = orthogonalVector in that case
getCrossProduct returns a new vector. where crossProduct mutates
Don't forget to check the dot product between your arbitraryVector and the direction vector. If those two vectors are colinear it will not work
Huh
Like the only method that has a non mutating version
Man vectors are my biggest annoyance atm
Thereβs so many different ones to convert between
Youβve got vector, then jomlβs vector, minecrafts vec3, minecrafts blockpos
Yeah this is a pain
Just steal sethblings datapack :p
And javaify it
This is why display entities are better
Boo
I refuse to acknowledge anything before 1.19.4 anymore
You have to account the head base to do some projections I'm afraid
And this
is a real pain
bro wants to get unreal engine cars into mc
This is a really interesting project indeed. But I'm very scared of high ping players lmao
vectorile dysfunction
I feel like I should ban you just for that
Do it
Does it get you a vector pointing down?
If (vector == dysfunctional) {
Make not dysfunctional
}
what the
boy
(0, 1, 0) coul'nt work end that's normal
But the others are acting weird
Let met think about it
can i get help? My BlockBreakEvent isnt being executed
it has @EventHandler
and the listener is registered
and SpawnManager is being used
double check the init function is called
better? such as?
i was doing something really wrong
i was storing the whole SpawnManager lol
so id just
created a data class
with the data i needed
world, region and spawnpoint
and stored it apart
from the spawn manager
so i assure init is being called
and yet still not working the way i want lol
but yeah
i think that it is my adapters
lol
there it is
Is there a reason you escape < >
wdym?
you write \u003c
Anyone know how i'd get the "charged-projectiles" from this item. This item being written as item.
I tried metadata but I got no clue how to grab it from there.
cast meta to crossbot meta
