#help-development
1 messages ยท Page 1850 of 1
true lol
I told you about our hostings, you don't remember?
yes ๐
๐
germany's largest role player server is also still on 1.12
? this is driving me a little up the wall lol
but what I really don't understand is servers still being on 1.8
wdym?
hcf servers gonna update to 1.18 soon enough
like
Do you want to do stuff like
@SomeAnnotation("${project.version}") ?
in a plugin.yml you can use ${project.version} to get that property from maven
yeah
i cant filter the java as a resoruce
hm yes it's possible
one second
but
it's a bit messy
you need the maven templating plugin
I once tried it, but as I said, it sucks
you don't want to use it unless you 100% have to
is there any reason why you need this?
ooh nice lol
Minecraft is now better than Warzone ๐
no way
๐
i just want to have the main class in plugin.yml taken care of automatically
making a template for myself
so wait how do i use this it seems really roundabout
i mean this whole thing seems stupid ish but still
I have created a command "/vault" which opens up a inventry of 6 slots but there is a problem that when i do it
it opens fien but it cannot store my items
so is there any way to make it store my items that i keep?
Youโll need to save it somewhere
yah but what is the class i need to call to save it?
i searched on spigot docs
but i am unable to find
Hello, I don't know how to develop a plugin in 1.18. I created my spigot in 1.18 with BuildTools but when I add it to the library in intelliJ, I cannot extends JavaPlugin. Can you help me ?
Read the update post
will getMaterial would work?
What
big uff
is there a way to get the first developer in the developers property in maven
you would need to get all items in your vault-inventory and save them into a config or smth to save those data
does anyone know how to use effectlib?
i need some help with yaw and pitch stuff
oops
idk how to implement it into my plugin as the builtin effect.yaw = float; doesnt affect the direction of the effect
i was thinking i had to use a vector
slikey's?
yeah
slikeys
read the wiki but he doesnt specify the yaw and pitch in the listed params
hmm
but it clearly exists because of this
no clue
im a bad dev
i jus want to make this effect go straight up every time instead of west
i can send the code in pastes if you could have a look at it
idk really what you mean by setter but
public int Heigth = 0;
this sets something
no like a method setPitch(float pitch)
ClassShopItem inherits from ShopItem. Any idea why I'm getting this exception?
guys i have a problem with PacketPlayInUseEntity in 1.17
i want to get the action type of the packet
but its an interface and its changed
not an enum
if anyone knows please help
if you are going to recommend shitty apis like protocollib, dont reply
it is
a lot of usage and hard to use api
now please answer my question if you know
no api just nms
please guys
im dying out here
Just found out java is silly :(
It could be anything, not just Object
any specific to generic type parameter conversion is impossible (?)
thats not reasonable
what?
what are you trying to do
ok lemme show you
ClassShopInventory inherits from ShopInventory
But must take ClassShopItems
inherits? Do you mean extends?
yea
? extends
he means <? extends X>
^
thank you
I feel stupid, as anyone should after receiving good programming advice.
Thank you again!
now I get why all those things said ? extends T instead of just T
Itโs to allow subtypes to be passed through the type parameter
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
what is the problem?
Im working with effectlib, but i cant seem to change the yaw or pitch of the effect using effect.yaw = float; and the effect.yawOffset doesnt work either. I was thinking about using a vector and a target location but im not sure how to do that
i couldnt find anything on the wiki but maybe thats because i havent looked into it enough
https://paste.helpch.at/kupeherisi.java the core file
https://paste.helpch.at/gepugoziwu.java the class file im trying to edit
it was a copy paste from like a few different servers
i didnt type it up now
does the tab complete packet has Transaction id for legacy?
I'm trying to run BuildTools (for 1.8.8) and I keep getting this error.
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Child module E:\SpigotBuildTools\BuildTools\Spigot\Spigot-Server of E:\SpigotBuildTools\BuildTools\Spigot\pom.xml does not exist @
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.spigotmc:spigot-parent:dev-SNAPSHOT (E:\SpigotBuildTools\BuildTools\Spigot\pom.xml) has 1 error
[ERROR] Child module E:\SpigotBuildTools\BuildTools\Spigot\Spigot-Server of E:\SpigotBuildTools\BuildTools\Spigot\pom.xml does not exist
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, E:\SpigotBuildTools\BuildTools\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=582a, clean, install]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:964)
at org.spigotmc.builder.Builder.runProcess(Builder.java:895)
at org.spigotmc.builder.Builder.runMaven(Builder.java:864)
at org.spigotmc.builder.Builder.main(Builder.java:700)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
how can i send a message that when clicked opens a link
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
Log for this, what wiki are you referring to?
Quick question how do I check if there are still players in a world to unload the world afterwards ?
maybe player.getWorld().getPlayers(); could work
thank you I test it
What class shouldn't be static?
is there a way to create a map that can contain repeating keys?
keys are always unique
well you can create a map with a list of values as value of the map ^^ that way you can store more then 1 value with the same key
Or just use Guava Multimaps
You shouldn't really need repeating keys
Oil can't think of a situation in which you'd need them
hmmm ... maybe storing many fake holos of a player in a list in a map / multimap
What you want is a multimap
Easiest way is Map<K, List<V>>
You can use a set or other collection if needed
thanks for u all
The easiest way is using the multimap from guava
Short question
How can I get the max slots from a bungee server?
Hi, I'm trying to create custom drops for Beetroot, this is my code but does not work
which version ?
1.12
i think getBlock.getDrops.add will not work
getDrops just gives a copy of the drop-list
you should use block.getWorld().dropItemNatur...
thanks
PlayerBedEnterEvent ?
Google exists
I did that yesterday
i tried
Obviously not hard enough
the javadocs couldn't find anything ๐
just cancel PlayerBedEnterEvent
ty
@sage patio you're not calling setItemMeta
I know
I have a bigger problem now
if beetroot look like this, my plugin gives the player both beetroot and beetroot seed
Well you aren't doing any checks
Figure out the beetroot growth stage
You have to check the growth stage and determine the drops based on that
I don't know how to do that
Ageable I think? Not sure
ageable yes
check if the block data is an instance of ageable, then check if the age isn't the max age
thanks
I've done a lot of things w/ custom farming ๐
this is for a role play server, drugs and .... you know
custom name for farmed drugs
it be like that
getBlock().getData()
getState just returns a "copy" of the current blockinformation
getServer().getPluginManager().registerEvents(listener:this, plugin:this); What did i do wrong?
listener: and plugin:
new EventName()
and just this
thanks
You canโt specify arguments by name in java
idk what version you're on but on 1.16+ (these versions are what I've used, idk when it was implemented), there's Block#getBlockData()
1.12
ic
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("PlayerCount");
out.writeUTF("server");```
Is there a implementation like PlayerCount where I can get the Max of player?
๐คทโโ๏ธ then try it your way I suppose
This is from the ProtocolLib api documentation and i'm trying to get the Equipment Array (and from that the Equipment Slot), but the .getByteArrays() method did not work and getting a list failed, since i couldn't use the EquivalentConverter<T> it requested
I think this is enough
kek
Ahh legacy
memph
even more errors new = EventName(); getServer().getPluginManager().registerEvents(listener:this, plugin:this); I probably didn't do this right
What
wait
i just realised
i didn't
im an idiot
new EventName()getServer().getPluginManager().registerEvents(listener:this, plugin:this); nvm im still an idiot
I don't know, I do that
I mean you can store the pluginmanager to a variable
you can make one listener for all events
It is not necessary to make a bunch of listener classes for this
new = EventName();
I love this
๐
getServer().getPluginManager().registerEvents(new ListenerClassName(), this);
I want to clear drops of a block break, but this is not working
No idea i just started spigot plugin stuff 10 minutes ago, how do i check?
๐
._.
your Listener event is in your main class?
or its in another class
event.setDrop(false) or something like that idr
event.setDropItems iirc
uh uh uh
the event the onPlayerJoin? yes its in the same one
its not itemdrop event
BlockBreakEvent
there was smth strange with clearing the block drop list iirc
lemme go try n remember
For item drop it will be setCancelled
^^
Send your main class
?paste
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class Neddox extends JavaPlugin implements Listener {
@Override
public void onEnable() {
System.out.println("Neddox plugin successfully enabled");
getServer().getPluginManager().registerEvents(new ListenerClassName(), this);
}
@Override
public void onDisable() {
System.out.println("Neddox plugin successfully disabled");
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
System.out.println("yooo player joined");
}
}```
getServer().getPluginManager().registerEvents(this, this);
and another question, when you break the block under this beetroot, this drops a beetroot seed, how I Can change that or cancel that?
private void sendCooldown(Player player){
if(cooldowns.containsKey(player)){
int cooldown = (int) (cooldowns.get(player) * 10);
StringBuilder msg = new StringBuilder();
int i= 0;
for(; i < cooldown; i++){
msg.append(ChatColor.GREEN + "|");
}
for(; i < 50; i++){
msg.append("|");
}
player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
new TextComponent(msg.toString()));
}
}
Anyone knows why it just sends me "|||" * 50 in green color?
check if the block broken is farmland then if so check the block above it
thanks
same with pistons
because your code adds 50 times the |
My bad lol didn't reset the ChatColor on the second loop
what is material of farmland in 1.12 ?

SOIL maybe?
someone here that know how the biome-grassOverride-Color gets added to the default "grey" grass_block texture in the client ?
just adding the grassoverride to the grey won't work
ping pong
This is from the ProtocolLib api documentation and i'm trying to get the Equipment Array (and from that the Equipment Slot), but the .getByteArrays() method did not work and getting a list failed, since i couldn't use the EquivalentConverter<T> it requested
https://cdn.discordapp.com/attachments/741875863271899136/925133763367813180/unknown.png
i think more then 3 times asking this is enough ^^ google for protocollib equipment change packet stuff
i already did and coudn't find any
brent, PL doesn't go based on the protocol documentation. That documentation states what type of field is sent over the network whereas PL makes use of the types of the fields in the class, which can differ
In the case of that packet, you want an EquipmentSlot to ItemStack Map
That's the one you're looking for
this 4 logs are with same name, how I can detect them?
blockdata
If they have the same name they're probably in 1.12 or lower
yea 1.12
In which case, (1) please update... for the love of God, (2) use MaterialData of Wood
for some reasons I can't update, and thanks
block.getState().getData(), should return you a MaterialData which you can cast to Wood if it was a log
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/material/Wood.html
Then getSpecies()
so complicated in 1.12 O.O
does not works :(
Yeah not quite lol
but not that complicated ^^
MaterialData data = block.getState().getData()
if (data instanceof Wood && ((Wood) data).getSpecies() == TreeSpecies.OAK) {
System.out.println("You have oak wood");
}```
thanks
Not using J16 features because 1.12
The MaterialData API was pretty incomplete. There are lots of areas where it just doesn't cover, but wood was at least one of them
I vaguely remember that API
I worked with 1.12 for 3 months kek
It was a decent attempt at abstracting away byte data, just never got finished before block states were added
erm oak_log, spruce_log, jungle_log
nvm my discord didnt load
1.12
pre 1.13***
ppl on 1.12 wouldn't get accurate inventory updates when I called the #update() function, ๐ I didn't know it was a client side bug so I spent like 3 hours trying to fix it
How can I work with the Spigot API and Paper API at the same time for compatibility.
When I load my plugin in a Spigot Server it crash, because the ClassLoader (from the net-kyori-adventure API) dont find a Paper Class, but the plugin works when I load it a Paper Server.
(srry for my english)
You can always just use the bungee chat API
i think paper api adds just a few thinks ... you should stick to spigot api and use reflection to use paper api
I mean depending on how far youโre willing to go, just having 2 modules can be reasonable (makes it easier to work with a lot), or if you do have the effort you could carefully decipher when to use what method and so on
Think they just want to use adventure but since itโs not shaded in spigot they get themselves a ncfde
I know this is a stupid question, I don't actually know why I'm asking but here goes:
A friend I have works as a bug tester/QA member for a big server. They said that if they take photos or videos using software on their computer or screenshare the server on discord, the server owners know and have auto-ban scripts for it. This isn't possible is it?
why am I even asking this
yeah, itd be weird if it did something like modified the packets that you sent to the server somehow, and it was detecting that, seems like they were telling half truths
mount a camera on a tripod and point it at your monitor
Gotta have those NDAs
military now using a minecraft metaverse to handle nuclear launches
redstone contraption as the key.
space satellite whichs only function is to see what their QA team are doing
there with that 8k camera
Am I tripping or does 1.18 not include the version in the NMS package names?
Or was that in 1.17 too?
Yeah
CB still does sadly
It does?
I've been using CB and that's where I found out that it isn't used anymore?
It still does
Ah so CraftServer etc?
Yes
Gotcha
CB smh
hi, I have some code here that when I click a certain compass it opens an inventory this is the code: ```java
public void createInv(Player player) {
inv = Bukkit.createInventory(null, 9, ChatColor.GREEN + "something");
m.tmeta.setDisplayName("Training");
m.training.setItemMeta(m.tmeta);
inv.setItem(0, m.training);
m.pmeta.setDisplayName("President");
m.president.setItemMeta(m.pmeta);
inv.setItem(1, m.president);
m.cmeta.setDisplayName("Clutch");
m.clutchgod.setItemMeta(m.cmeta);
inv.setItem(2, m.clutchgod);
player.openInventory(inv);
}
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if (e.getPlayer().getInventory().getItemInMainHand() == com
&& (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)
&& e.getPlayer().getInventory().getItemInMainHand().containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL)) {
createInv(e.getPlayer());
}
}``` but for some reason when I click the compass it wont open the inventory... I don't know if the event for clicking the compass is the problem or if the creation of the inv is off
someone help?
what is default fly speed?
they arent (1.16.5) on mine lul
wait i clone those at the spigot stash
where do you guys got the cb from?
buildtools?
you want... The blocks per second speed of flight?
i thought buildtools do the same
w-why @drowsy bramble ?
or it use another url to clone huh....
craftbukkit is built into spigot
im making an anticheat off a yt vid and wanna add a fly limit before it warns admins
imagine not knowing that. couldnt be me
yeah mine and buildtools cloned from the same url
hmm
how is it different
the maximum is somewhere around 8 at the default speed limit but idk
If you look on the stash you will also find the version numbers are not there
wdym different
I assume they are added at compile time
they cant?
ok lemme check
The purpose of this code is to remove the Targeted entity starting from EntityTargetEvent.
But, if i spawn a snowman that satisfies the if statement in the code doesn't work and throws no error.
However, the snowman actually targets the target. Do you know any workarounds or errors in the code for this problem?
how to remove all colors in a string?
ChatColor.stripColor
according to code i wrote a while ago default FlySpeed is 0.1, but i don't remember where i found this info originally and i'm having trouble looking it up to confirm
Makes sense, the default walk speed is 0.1 iirc
the same code from long ago has default walk speed as 0.2
so take what im saying with a grain of salt, unless it is correct
Is the default walk speed the same as the movement speed attribute?
Sprint fly or walking fly?
i think attributes work on different numbers than the api methods
Is there a way to increase the natural limit of a potion effect's amplifier?
not brewing, say bad-omen
im talking about the number you give to spigot in Player#setFlySpeed, idk what the actual speed is
Ah
Probably not with a plugin
But you could listen for the kill event and add it yourself
that's the problem
Well its to get their speed for anticheat stuff
Idk if i coded it properly tho cuase it doesnt display the msg saying a bunch of stuff about speed
kill event comes after the omen is absorbed, and when absorbed, the omen level of the player goes back to 5.....
you can probably get the velocities in a temporary move event handler for testing purposes
So set it after
I am currently using pdc to keep track of player's previous omen level
Id send the code but im going to buy a ps3 rn so itll be like 2 hours until i can.
That works
I don't know any way to tell the previous omen level (could be higher than 5) before the kill event without the pdc
but the pdc solution is not very nice, especially when effect can be applied through commands and what not
Ill create a thread tho when i get home about it
ok
I mean you can use the effect application event to detect the level from commands
What do you mean
So I have to remove the record of the effect from the pdc manually after 40minutes when the effect vanishes.
You can remove it with the event as wel
First, I am not absolutely convinced that players loggin in and out will always have the effect intact.
alternatively you could store a timestamp and just let expired ones chill, but that's not as clean
Does spigot support item components like Knockback resistance?
Yes
Im currently using the player's alive ticks as the timestamp, so yea, I have to remove the timstamp on player death too
PDC remains through logout
As do effects
Players' pdc on server restart too?
it never remove by anything
unless you manually remove it
through codes, or delete the server file
Ok great then, current solution works.
ya, i hope the metadatable stuff stays around because of that. sometimes you only need to tag stuff temporarily
Was just wondering whether this is possible, as keeping track of pdc means listening to whole lot other stuff, just afraid that I will miss something.
ya i figured, but i recall a while ago someone saying they consider it deprecated or something, and it got me nervous
because i still find uses for it, and i don't want to have to deal with trying to use pdc in a non-persistent way
Oh no!
I mean
They do relocation
Isn't metadata just a fancy map
that sadge
Yes but that handles saving for you
cross-plugin communication is a thing built into metadtable isn't it?
as in if i write 2 plugins, they can see eachothers metadatable keys and values.
?paste
if i had to use my own map i'd also need to have some interface for providing access to the non-owning plugin
https://paste.md-5.net/hifecuqodu.java does anyone know why this isnt coming up when player joins
Event registered?
yup
So if you add a sysout there it works
manager.registerEvents(new ScoreboardDM(), this);
non-persistent stuff doesn't need saving
(srry for ping, just almost missed that statement you sent)
Iโm aware
wdym
If you add a print line in the event, does it work
i'm trying to understand new version of java after 9 with eclipse. does anybody know how to import classes from jdk.internal.loader package?
1.17.1 is forcing me to use java 16 it seems
why do you need those classes?
those arent meant to be imported
just learning. i have old projects contain features of class loaders. so i want to understand the new version and maybe find a proper way to port them.
yes, we don't all stick with the old software forever ๐
no matter since we're talking about new version.
hey, Bungeecord API question here..
is it possible to get an offline ProxiedPlayer..? I imagine it is, but i'm really not sure - i poked around the javadocs but i couldnt find anything helpful
does bungee save player data?
Do you not trust the javadocs for bungeecord?
not necessarily
?jd
alright but if you come back stating you can't find anything, my question is the same ๐
i trust these official ones more, i was on javadoc.io ๐ณ
Bungee is not like a server. It only deals with connections and it only relates to active players
therefore my best bet is to store offline users in a database?
that's what i'm thinkin
Why do you want offline?
/whois
and other network information, i.e; friends #, recent chatlogs, and other global information that i store
they are making use of bungees protocol command stuff to provide a whois command on all the servers without needing to put the plugin on all the mc servers
there's a plugin on each server that links to the central database for stuff like getting their gamemode, if needed - but it isnt nearly as detailed as the global one (should be)
then I really don't see why you need a bungee plugin for this
when you can just improve the one on the mc servers
seems a bit redundant and inefficient
because the bungeecord /whois shows information that i dont want to use plugin messaging channels for?
if the plugin is on all the mc servers, why would you need plugin messaging channels?
to get the bungeecord information
what information does bungeecord provide that the mc server doesn't already have? o.O
i have Litebans' api inside of the bungeecord plugin ._.
ok but you are literally not acknowledging the point I am saying
ok thanks
you have a plugin already on your mc servers you can improve
would make sense that one of them needs removing/improving
Can someone Help me?
code is a bit hard to follow. Probably shouldn't be using static on that one method, and not entirely sure why you are hiding that comment, most of us here can't even read that language anyways ๐
I recommend adding some debug code so you can follow exactly what is going on
Is there any documentation about percentage rates of knockback resistance for netherite?
Pog cat
I agree
And there is next to no documentation on knockback resistance rates
its probably in the code ๐
Time to dive into source
really have no idea if its documented there or not
The scale of horizontal knockback resisted from attacks and projectiles. Vertical knockback is not affected. Does not affect explosions.[3] 1.0 is 100% knockback resistance. 0.4 means 60% of knockback is applied.
clearly you guys aren't l33t pvp players like me who knows the details of knockback like I know the back of my hand
u ever take a moment to appreciate ur hands
all the muscles and tendons controlling the movements
barely even having to think about the movement u want to do
if we were 200 years into the future I'd already have chopped them off to replace them with synthetic hands
I can't feel my hands
they have betrayed me
truly you have forgotten the feeling of the back of your father's hands
can't have a memory of them when he has never been around as well ๐
don't judge the man, cartons of milk and packs of cigs are surprisingly hard to come by
The state I live in will give you money for food ๐
i know that feeling all too well ๐
you have an anime pfp so some might argue you don't know it well enough
?paste
https://paste.md-5.net/sotedojugu.java does anyone know how to make the countdown turn into minutes and not seconds.
for example
15:00 minutes and not
900 seconds
Divide by 60 to get minutes
And then mod 60 for the remaining seconds
There probably some kind of library out there to handle that for you though
Try SimpleDateFormat or DateTimeFormatter
How about when an armor piece displays +1 resistance?
I assume that is 1.0, so it should be 100%
But last I checked it still acted like a chance, even though it shouldnโt
https://minecraft.fandom.com/el/wiki/Attribute
entities have attributes, equipment/tools/weapons have attribute modifiers.
attribute modifiers have an operation as well as a value.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/attribute/AttributeModifier.html
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/ItemMeta.html#addAttributeModifier(org.bukkit.attribute.Attribute,org.bukkit.attribute.AttributeModifier)
spigot and vanilla agree on these values, here's the spigot api link
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attributable.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/AttributeInstance.html
things are a bit more complicated than how i described it, but should be a good starter.
on behalf of the world; hello MSWS
can we spawn NPC without NMS now?
I saw a NPC class in Bukkit API and tried something like this
But I get this error: java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.NPC
Doesnโt that tell you your answer
what?
But I get this error:
java.lang.IllegalArgumentException: Cannot spawn an entity for org.bukkit.entity.NPC
I mean if there's a NPC class, I was wondering if there's a way to spawn it
without NMS
okay
Is it possible to use getOfflinePlayer and if the user is offline you can still get their statistics and their xp level etc?
not natively no
So I would have to store their stuff if I wanted to get their statistics of an offline player?
You can get the statistics of an offline player
Ah great
Ah ok that makes sense
So any statistics would work but getting their xp level wouldnโt ye?
two more ints for xp/lvl dont seem so bad. Its as if mojang just introduced two new statistics
Ye that and inventory or smth would be nice
True
But inventory and such
My thought was to have an explicit OfflinePlayer#loadData
Or implement it lazy.
Which doesnt rly work as all data is saved in one file anyways...
Yeah
so when you fly into the ground with elytra on is there a way to detect that using damageevent? i've tried damagecause CONTACT but that doesn't work i've got this so far
public void damage(EntityDamageEvent event) {
if(event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
if(hasElytra(player.getInventory())) {
if(event.getCause() == EntityDamageEvent.DamageCause.FLY_INTO_WALL ||
event.getCause() == EntityDamageEvent.DamageCause.CONTACT) {
player.getWorld().createExplosion(player.getLocation(), 3.5f);
}
}
}
}
public boolean hasElytra(PlayerInventory inventory) {
if(inventory.getChestplate() != null && inventory.getChestplate().getType() == Material.ELYTRA)
return true;
return false;
}```
currently it works perfect when flying into a wall
true, that would work.
however that would fire if i just jumped down while wearing it, is there a proper way to see if somebody is flying with elytra?
isGliding iirc
thank you very much ๐ i should of thought more into this before asking lol
you could store the data you needed from the offline player in a config on PlayerDisconnectEvent or whatever it was called
PlayerQuitEvent
I am trying to detect if an ender dragon egg is burnt, what code could I use to find if the dropped item is indeed a dragon egg?
@EventHandler
public void onEggBurn(EntityCombustEvent e){
World w = e.getEntity().getWorld();
getLogger().info("item combusted");
if (e.getEntity().getType() == EntityType.DROPPED_ITEM) {
Cast the Entity to Item -> get the ItemStack -> get the type (Material)
maybe you can just get the type directly from the Item
Nope you need to get the ItemStack first
ye thats what ima do
also
im getting this error
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.CraftOfflinePlayer cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_17_R1.CraftOfflinePlayer and org.bukkit.entity.Player are in unnamed module of loader 'app')
from the following code
For some reason when i place a torch connected to a wall and try to detect it on BlockPlaceEvent with event.getBlock().getType() == Material.TORCH it doesn't work but it works fine if i place a torch on top of a block. Does anyone know why this happens?
Something like this:
@EventHandler
public void onCombust(EntityCombustEvent event) {
if (event.getEntity() instanceof Item item && item.getItemStack().getType() == Material.DRAGON_EGG) {
event.setCancelled(true);
}
}
tysm
response = user.getName() + "/n" + user.isOnline() + "/n" + user.getLastPlayed() + "/n" + blocksmined + "/n" + itemscrafted + "/n" + user.getStatistic(Statistic.PLAYER_KILLS) + "/n" + user.getStatistic(Statistic.MOB_KILLS) + "/n" + user.getStatistic(Statistic.DEATHS) +"/n" + user.getStatistic(Statistic.BELL_RING);.
well the error tells you
OfflinePlayer cannot be cast to class org.bukkit.entity.Player
Two blocks iirc
TORCH and WALL_TORCH are separate types
I think itโs WALL_TORCH
ahh ok that makes sense
Is that still a thing in modern versions?
i didn't think so but ig it is
If Mojang didnโt replace that with block states imma be upset
Yeah lol that's why i didn't even think to check for a separate material
why mojang
I guess there is a somewhat valid reason
time to be update
The normal torch has a tag that the wall one does not
what tag is that
wall_post_override
ah that makes sense
hey guys, I have a question... I'm using "\n" to break the line in the lore configuration line but I get [LF]
(Like in the photo - I am using 1.15.2 (Server, plugin and client version) with Via Version)
Can you help me?
?paste
lore is a list of strings, so just split your string that has the line feeds in it and make it a list
Is player.setPlayerListName Effects in chat?
setDisplayName does
is there a reason doing YamlConfiguration#saveConfiguration(File) isn't actually saving the file?
like what would cause that
saveConfiguration ?
save(file) should be the way to safe it
ah sorry
i am using save
my bad
Yeah, it's not saving the actual information
which is weird since it's being set as far as i know
as far as you know ??
i think you should take a look at your code and should know if something gets set/added/removed
I want to remove 1 Beetroot from player's inventory, but this code removes all of beetroots
best way to do this is probably iterate through all items and if found set the Amount of the item -1
if the player has the item in the mainhand for the action you can do this .... not sure about 1.12 but you should check if the new ItemAmount == 0 and then set the item in hand to null
I already have required checks thanks
lemme show you
"Foroosh" in my lang means Sell
and works :D
your server is too slow or the player is too fast
im making a trap plugin and one of the traps when u step on it makes u teleport away but its messing with that teleport
do you just teleport or set velocity too ?
i just use Player.teleport()
If I want to change last line ( price ) from 5 to 5$, how I can fix Double.ParseDouble error?
string#replace(a,withB)
Can I replace withB with nothing?
yeah just ""
anyone know why this code is saying (Player) moved wrongly? https://pastebin.com/EtqjZf64
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.
its making it so the player just doesnt teleport at all
it teleports in creative not in surviavl tho
survival*
well you could try to run it in a new bukkittask ...
ill try but how would that help
not running in the same tick where the player could have interact with smth .... i think this will help
it worked ty
it is there visually if below 128
How I can check if player's INC_SACK's durability is 3? ( I want to check for this item stack : )
You can compare the type with ==
equals should be more future proove ^^
Mwoa
Cannot determine path to 'tools.jar' library for openjdk-17 (C:/Users/felix/.jdks/openjdk-17.0.1)
Error when trying to build my project in intellij to the spigot debugger thing
Install Java 17 at https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
Still dont work :(
Did you use the link above?
92 private void updateCooldown(){
93 Bukkit.getScheduler().runTaskTimerAsynchronously(main, new Runnable() {
94 @Override
95 public void run() {
96 if (!cooldowns.isEmpty()) {
97 cooldowns.forEach((player, cooldown) -> {
98 if (cooldown - 0.05f > 0f) {
99 cooldowns.replace(player, cooldown - 0.1f);
100 } else {
cooldowns.remove(player);
}
sendCooldown(player);
});
}
}
}, 0L, 1L);
}
Error:
[Rprison] Plugin Rprison v1.0-SNAPSHOT generated an exception while executing task 435
java.util.ConcurrentModificationException: null
at java.util.HashMap.forEach(HashMap.java:1424) ~[?:?]
at RPrison.rprison.mining.MiningManager$2.run(MiningManager.java:97) ~[?:?]
at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.18-R0.1-SNAPSHOT.jar:3359-Spigot-dbf4938-4f5d59a]
at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) [spigot-1.18-R0.1-SNAPSHOT.jar:3359-Spigot-dbf4938-4f5d59a]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:833) [?:?]
Anyone knows what's the problem?
How are you importing the library?
public void onArenaJoinEvent(PlayerArenaJoinEvent e)
{
CachedArena arena = e.getArena();
Player player = e.getPlayer();
PartyDataRequestCallbackAPI.getInstance().fetchPartyData(player, (player1, partyData, i) ->
{
int playersInParty = partyData.getAllPlayers().size();
int maxPlayers = arena.getMaxPlayers();
int maxPlayersInTeam = arena.getMaxInTeam();
int currentPlayers = arena.getCurrentPlayers();
if(currentPlayers + playersInParty > maxPlayers || playersInParty > maxPlayersInTeam)
e.setCancelled(true);
});
}
The problem is that I can't cancel the event in time, because messaging takes some time
What library?
What's the problem?
The part is in a (custom) runnable, but when I call e.setCancelled(true) the event is already executed and cancelling doesn't matter anymore
the cancel will not affect the event because it will not run in the same tick the even is fired
Can you disconnect the player then?
from the arena, let him join then kick him lol
You Cant remove an entry while looping over it
so you will need to get the data without desync or store the data somewhere else.... you can also cancel the event instant and after checking you can add the player by hand
How should I remove it then?
I can cache the data, but how do I know when I have to cache it?
create an copy of your map
you cant
then remove from that map and then replace the og with the copy?
SO I have to cache it every tick? Isn't that a little bit laggy?
Also, cancelling the event will result that the bedwars plugin immediately searches for another arena
no,
you could also create a List<Player> toRemove = ...
and add in your forEach to this list and after the forEach you remove all players that are in toRemove
Oh, Thanks!
hey i have a quick question: i am trying to integrate in my plugin that a player can claim chunks. For this purpose, the X and Z coordinates of the respective chunk are strung together and separated from each other with a "." for a certain action of the player. (String chunkID = chunk.getX() + "." + chunk.getZ();)
Afterwards this chunk ID is stored in a database. I created the two corresponding tables as follows: https://www.toptal.com/developers/hastebin/habemotope.sql
now i am trying to query if a chunkid is assigned to a specific player. However, when I then enter statements like this into MySQL:
SELECT playername FROM playerdata, chunks WHERE chunkid = '13.4';
I get not only the player name that belongs to the chunkid but all player names that are stored in the table.
Can anyone help me with this?
My JDA guildMessageListener does not fire at all,
public void onEnable() {
discordBot = new DiscordBot(getConfig().getString("discordBotToken"));
discordBot.connect();
discordBot.getJda().addEventListener(new DiscordMessageEvent(this));
}
public class DiscordBot {
JDA jda;
private final String token;
public DiscordBot(String token){
this.token = token;
}
public void connect(){
try {
jda = JDABuilder.createDefault(token)
.enableIntents(GatewayIntent.GUILD_MESSAGES)
.build()
.awaitReady();
}catch (LoginException | InterruptedException e){
e.printStackTrace();
}
}
public void sendMessage(MessageChannel channel, String message){
channel.sendMessage(message).queue();
}
public JDA getJda() {
return jda;
}
}```
```h
public class DiscordMessageEvent extends ListenerAdapter {
Main plugin;
public DiscordMessageEvent(Main plugin){
this.plugin = plugin;
}
final String prefix = "/";
public void onGuildMessageEvent(MessageReceivedEvent event){
event.getChannel().sendMessage("Test").queue();
}
What am I doing wrong?
I recommend asking the jda discord
Also I belive listening to messages for commands is deprecated
Use the slash command feature
Thatโs not a valid method
Try put @Override over the event method and youโll see why it isnโt valid
@ivory sleet how are you?
Which one?
The event callback method
Thatโs not what I said
I told you to put @Override on it
If you do that, you can properly validate at compile time that you are indeed overriding a valid event callback.
Hello, which itemflag is used to remove enchantment glow?
can't
to give an item a glow you need to enchant it
to remove the glow, remove the enchant
So it's client side?
iirc if an item has the nbt tag Enchantments then itโs gonna glow
Will using packets work?
Idk sounds like a dumb workaround
Well I have registered custom enchantments and only want the glow to show up when they are applied while the base custom items already have one or two vanilla enchantments
I mean you could ofc send packets lying to the client that the item does not have any enchantments
wait that is not item
But like itโs a duct taped workaround
that is for entities lol
Is there a proper one tho? XD
No because the game and its api doesnโt have your best interest in mind sadly
Welp duct tape it is
using packet a dumb is not really a dumb idea
many of the time packet level stuff is also way more efficient
clumpy ninjas!
You could always recreate your the enchantments using lore, but if it's something like efficiency you can't since you need to change the breaking speed (been there didn't do that since it's impossible nowadays)
Efficiency but you lose safety
not really
Yes
That would be the case if you're not fully understand how Minecraft networking works
most of the time if you use packets you lose safety
Having high abstractions around low level implementations help you to design safe stuff safer since the abstraction will limit you to a lot of stuff
It is a fundamental gain-loss concept
if you know what you are doing, you'll be able to write your own packet abstraction layer instead of relying on Bukkit/Spigot one.
At the end of the day, entire Minecraft server is pretty much a huge TCP abstraction
enchantment glowing on itemstacks only if custom enchantments applied ?
I'm using packets atm using protocollib, how can I make sure it won't cause any problems?
you cant
they CAN break on each version
first, yes you will, but it is objectively less safe, as first of all you do not have any compile time validation that you indeed did it right thus creating bugs is a greater possibility.
second, no thatโs not entirely true, the server implementation contains logic as well and storage handling, not just a tcp server
Hello, I made a plugin for custom farming item names, when a player breaks a Carrot for example, my plugin removes the original Carrot and drops a Carrot with Custom name and Lore, but there is a problem
problem is if player don't have permission to break the block ( worldguard cancels the block break, ), my plugin drop the custom farm again, what should I do ?
just check if event.isCanceled
it's an oversimplification explaination.
though, abstraction layer also contains logic most of the time.
thanks
Hi does anyone have idea how to make long cooldown(1day, 1week etc.)
And do you think Mojang have compile time validation when they develop their abstraction layer? testing is a thing
No, the concretion layers contain logic, not the abstraction layers
Save it to external file?
yes
thanks again
No but they know their code base much better than most people here, but that does still not take away the fact that it is objectively less safe
You'll probably need to save it in a file / database and check every while if the current date - start date <= cooldown
true there, I'm wording it wrong
Yeah, the itemstacks already have vanilla enchantments tho
not possible since client rendering...
Why this way to check if players item in hand is null doesnt' work?
because getInventory.getItem already can be null
and "null" does not have the method isSimilar
getItem != null would be enought
What errors?
NPE probably
says that item is null
yes
when i don't have nothing
and null cant have the method isSimilar
thanks ๐
first if or second one?
i did it like this, and keep sending errors
in the second line ?
i deleted the first one
then probably worldguard event is fired after yours.... probably search for EventPriority in google
You could also use the worldguard api
so what do you have now and what is the error ?
np
nvm, i solved it
sorry
lol
hey i have a quick question: i am trying to integrate in my plugin that a player can claim chunks. For this purpose, the X and Z coordinates of the respective chunk are strung together and separated from each other with a "." for a certain action of the player. (String chunkID = chunk.getX() + "." + chunk.getZ();)
Afterwards this chunk ID is stored in a database. I created the two corresponding tables as follows: https://www.toptal.com/developers/hastebin/habemotope.sql
now i am trying to query if a chunkid is assigned to a specific player. However, when I then enter statements like this into MySQL:
SELECT playername FROM playerdata, chunks WHERE chunkid = '13.4';
I get not only the player name that belongs to the chunkid but all player names that are stored in the table.
Can anyone help me with this?
you need to leftjoin it
playerdata, chunks
^
what are you trying to do here
are you using a foreign key in chunks?
do anyone know how to change color name above player's head ? (1.8 version)
use scoreboard teams
already used, but didn't work
is there any event that fires when players put armor on?
no but there are some libs out there that make an event for it
there i try to get the name, which belongs to the chunkid
do you know any?
not off the top of my head, no
what columns are in the table chunks?
you're trying to specify 2 table name, or chunks table in playerdata schema
yes as a join
id, playerid, chunkid
pls โซ
have you verified that you are correctly putting them in a team
i.e does a team prefix work at all?
ok i tried Select playername from playerdata left join chunks on chunkid = '13.4'; but its still the same problem
SELECT playername FROM playerdata WHERE playerid IN (SELECT playerid FROM chunks WHERE chunkid = '13.4');```
something along the lines of that
hey. whenever trying to create a npc with the executers skin, the skin is black but got some textures on the inside. does anybody know why?
private void setSkin(GameProfile target, Player playerSkin) {
GameProfile playerProfile = ((CraftPlayer) playerSkin).getHandle().getGameProfile();
System.out.println(playerProfile);
Property property = (Property) playerProfile.getProperties().get("textures").toArray()[0];
String texture = property.getValue();
String signature = property.getSignature();
target.getProperties().put("textures", new Property("textures", texture, signature));
}
I tried making an http request for the auth server as well, same thing there.
okay looks like the texture doesn't pass the outlines of a skin
does anybody know how i can pass them?
Hey, does anyone know how I can register attributes for my entity type? this is my current way, but it doesn't always work, it randomly throws a null exception that occurs when attributes are not registered. (API 1.17.1)
private static <E extends Entity> void setDefaultAttributes(EntityTypes<E> type){
try {
final Field field = AttributeDefaults.class.getDeclaredField("b");
field.setAccessible(true);
Map<EntityTypes<?>, AttributeProvider> attributes = new HashMap<>((Map<EntityTypes<?>, AttributeProvider>)field.get(null));
attributes.put(type, EntityInsentient.w().a());
Utils.setField(field, null, attributes);
} catch (NoSuchFieldException | IllegalAccessException exception) {
exception.printStackTrace();
}
}```exception```fix
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.attributes.AttributeProvider.a(java.util.function.Consumer, net.minecraft.world.entity.ai.attributes.AttributeBase)" because "this.d" is null
at net.minecraft.world.entity.ai.attributes.AttributeMapBase.e(SourceFile:48) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at java.util.HashMap.computeIfAbsent(HashMap.java:1224) ~[?:?]
at net.minecraft.world.entity.ai.attributes.AttributeMapBase.a(SourceFile:48) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.world.entity.EntityLiving.getAttributeInstance(EntityLiving.java:2333) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.world.entity.EntityLiving.<init>(EntityLiving.java:292) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.world.entity.EntityInsentient.<init>(EntityInsentient.java:132) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.world.entity.EntityCreature.<init>(EntityCreature.java:17) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
at pl.tuso.xentitydev.entities.type.EntityDev.<init>(EntityDev.java:84) ~[?:?]
at pl.tuso.xentitydev.entities.Snail.<init>(Snail.java:28) ~[?:?]
at pl.tuso.xentitydev.events.DevCommand.onCommand(DevCommand.java:29) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-1.17.1.jar:3284a-Spigot-3892929-0ab8487]
... 19 more```
Idk, but with team.getPrefix() it work
The name above player head didnโt change
First time see this exception. Are you know what is it?
java.lang.AssertionError: TRAP
at net.minecraft.world.item.ItemStack.N(ItemStack.java:188)
at net.minecraft.world.item.ItemStack.e(ItemStack.java:1186)
at net.minecraft.server.level.PlayerInteractManager.a(PlayerInteractManager.java:444)
at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1602)
at net.minecraft.network.protocol.game.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:28)
at net.minecraft.network.protocol.game.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1)
at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30)
at net.minecraft.server.TickTask.run(SourceFile:18)
at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:151)
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.c(SourceFile:23)
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1157)
at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:1)
at net.minecraft.util.thread.IAsyncTaskHandler.y(SourceFile:125)
at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1136)
at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1129)
at net.minecraft.util.thread.IAsyncTaskHandler.bp(SourceFile:110)
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1112)
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1037)
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:303)
at java.base/java.lang.Thread.run(Thread.java:833)
is there any reason why a thread with .setDeamon(true) will still block the mainthread ?
Greg.
I don't see any other option then caching the party data every tick. Is that not resource intensive?
What
Seems like a forgot to cancel event, maybe it will help.
Itโs the opposite
Or well
The application will not await a daemon threads termination
but it sounds like youโre just joining said thread
i want to iterate through a list of files that will then load and handle a lot of data -> loop will wait for each entry finish before next starts...
now i created a thread that should run for each entry ... but starting the thread and setting it to deamon=true will still block the process of the others while not finished
that makes sense ^^

Pretty hard stuff
and now i have the expected java heap space xD
Yeah tvhee unless you can join/await that task in the event callback
Which might not be a great idea depending on what exactly youโre doing
Yep, I have to integrate a new party plugin. I can do that by implementing an interface. The problem is that the interface wants direct results, but messaging takes time
Yup
So I have to cache the parties every tick (async)
Hopefully that is not too intensive for the server
do whatever crappy workaround you might find, itโs very hard to manage a multithreaded plugin in correlation to spigot sometimes
Yes
@ivory sleet can you take a peek at your free time?
Uh, why do you need to do this if I may ask?
Like why not just reconfigure them on the entity spawn event
The problem is, I don't quite know how to do this, I can't spawn an entity until I register its attributes.
Is it a custom entity?
Custom entity type
and the problem is that the method for this is private or smth like this and you cant set a new attribute ? ....
rather not, generally speaking this is where the method works fine but not always, randomly or not
at the time I register the type
in 1.17 i had smth like this
public static <E extends Entity> EntityTypes<E> register(EntityTypes.b<E> entity, String name, EntityTypes<?> model){
EntityTypes<E> type = IRegistry.Y.a(
IRegistry.Y.getId(model),
ResourceKey.a(IRegistry.l, new MinecraftKey("experimental", name)),
new EntityTypes<>(entity, model.f(), true, model.b(), model.c(), model.d(), ImmutableSet.of(),
model.m(), model.getChunkRange(), model.getUpdateInterval()), Lifecycle.stable()
);
setDefaultAttributes(type);//here
return type;
}```
And when is that
Where should I find a resource that shows how to make custom mobs?
probably youtube but outdated for 1.18 mostly
Yep that's the problem lol
here i register that type
private static final EntityTypes<EntityDev> DEV = register(EntityDev::new, "entity", EntityTypes.c);```and i use this in the constructor```java
super(DEV, ((CraftWorld) location.getWorld()).getHandle());```
its not thaaaaaat complicated but since i know something about your skill-lvl it would be to complicated i guess
Tuso, you might wanna try putting the attribute before registering the type
Idk
Like in modding we usually just do it with an event (as thatโs when I touch nms the most)
and when do you call? at what stage do you have some snippet of code where do you use it?
in the constructor of the CustomEntity:
registerGenericAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
registerGenericAttribute(Attribute.GENERIC_ARMOR);
bruh i got stuck in a piece of code for so long thinking that PotionEffectType is enum
and was comparing them via == ._.

sometimes public constants of class with names ending with Type do be misleading
normally there is smth like
Tag.UNDERWATER_BONEMEALS.isTagged(material)
Hello. I'm encountering a trouble with PAPI (it doesn't set the placeholders).
I use this code: PlaceholderAPI.setPlaceholders(player, s);
PlaceholderAPI.setPlaceholders(offlinePlayer, s);
Output:
ะะฐั ะฝะธะบ: %player_name%
ะะฐั ะฟะพัะปะตะดะฝะธะน ะทะฐั
ะพะด ะฝะฐ ัะตัะฒะตั: %player_last_join_date%
(I have this expansion installed on my server)
hmm i have the same error, but could it be any fault only on my part? I mean, on my localhost it didn't work now, but on some other server it started normally without error.
I got it working, I had to overwrite the entityData
//Set outer skin lines
SynchedEntityData entityData = greg.getEntityData();
entityData.set(new EntityDataAccessor<>(17, EntityDataSerializers.BYTE), (byte) 127);
hmm i never rly tested to register the entity into minecraft because i got some errors .... i spawned the villager and just overwrote the moving/attacking data stuff and also sended a player spawn packet instead of the villager spawn packet ... if a chunk gets unloaded i saved the custom villager in a extra file and removed it from the chunk .... when the chunk loads again the file gets readed and spawn the customvillager again
Make sure you use the string that it returns
case "stats": {
if(!DiscordUtils.isVerified(event.getAuthor())) {
event.getChannel().sendMessageEmbeds(embedManager.errorEmbed(Message.ACCOUNT_IS_NOT_VERIFIED.getText())).queue();
return;
}
String messageToSend = "";
for (String s : Message.STATS_FORMAT.getStringList()) {
messageToSend += s + "\n";
}
Player player = DiscordUtils.getPlayer(event.getAuthor());
System.out.println("isEnabled: " + Main.getInstance().getPapiManager().isEnabled());
if(player != null) {
Main.getInstance().getPapiManager().setPlaceholders(player, messageToSend);
} else {
OfflinePlayer offlinePlayer = DiscordUtils.getOfflinePlayer(event.getAuthor());
Main.getInstance().getPapiManager().setPlaceholders(offlinePlayer, messageToSend);
}
event.getChannel().sendMessageEmbeds(embedManager.infoEmbed(messageToSend)).queue();
break;
}
lol
I'm so dumb
I didn't assign the value
XD
ouch
ty anyways
hi, i have a problem with setDeathMessage. So what happens is, The error message only displays for a short period of time on the death screen. How do I fix this?
does the player get respawned or what happens with the death screen ?
The player does not get respawned and the death screen will update so that it doesnt have any death messages
public class Killer implements Listener {
static String message = null;
public static void kill(Player player, String newMessage) {
message = newMessage;
player.setHealth(0.0D);
}
@EventHandler
public void onDeath(PlayerDeathEvent e) {
if (message == null) {
return;
} else {
e.setDeathMessage(e.getEntity().getPlayerListName() + " died because " + message);
message = null;
}
}
}
how can i make passive mobs agressive?
maybe check if a passive mob has touched a player or something like that and then deal damage?
I would also like to see the answer to this question
stracted?
then will give the damage
ok so I am pretty sure that you have to use NMS
*attracted sorry
you can make pathfinders I believe
ohh
I can't help you on the topic on nms tho... I am terrible at it and it is just bad
is it possible that i can make invisible food(which attracts the mob) on teh player so he will come towards u
ohh nice i will try that
I am pretty new to making plugins, anyone knows of a way to make items with custom textures?
with resourcepacks
if you have the resourcepack and for example inksack with durability 10 is a gun you need to set the durability of t he item to 10
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if (e.getAction().equals(Action.PHYSICAL)) {
if (e.getClickedBlock().getType() == Material.HEAVY_WEIGHTED_PRESSURE_PLATE) {
Location spawnpoint = e.getPlayer().getBedSpawnLocation();
YamlManager manager = new YamlManager();
if (manager.getStartCheckPoint().equals(e.getClickedBlock().getLocation())) {
if (!startedAnAttempt.containsKey(e.getPlayer())) {
new ParkourAttempt(e.getPlayer());
e.getPlayer().sendMessage(Parkour.prefix + "You have started a parkour attempt. get to the end checkpoint as fast as possible!");
startedAnAttempt.put(e.getPlayer(), true);
} else {
e.getPlayer().sendMessage("You have already started a parkour attempt");
}
}
so i have this piece of code but the problem is, it spams alot if a player stood still on the pressure plate, any help?
check if he is in startedAnAttempt ^^
I did that
oh ... the msg "You have already started a parkour attempt" spams ?
Ye
create a new list that contains players that already got that msg
public class Killer implements Listener {
static String message = null;
public static void kill(Player player, String newMessage) {
message = newMessage;
player.setHealth(0.0D);
}
@EventHandler
public void onDeath(PlayerDeathEvent e) {
if (message == null) {
return;
} else {
e.setDeathMessage(e.getEntity().getPlayerListName() + " died because " + message);
message = null;
}
}
}
Can anyone help me with this? The custom death message works fine, but it disappears after a few seconds. The player does not get respawned and the death screen will update so that it looks like it doesnt have any death messages.
aight that sounds like a decent solution
thanks
bad idea to store a string static because you want a custom kill msg on the screen ^^
Cant think of any other solution
if the e.setDeathMessage wont work its probably a version bug
It works, but it disappears after a period of time
