#help-development
1 messages · Page 44 of 1
So would be:
CompletableFuture<ResultSer> query(String query) {
return CompletableFuture.runAsync(() -> {
try {
executing query
} catch (bla bla) {
priting
}
});
}```
yeah kinda. but, and now the monkey dies:
You probaby will again simply do stuff like this in your code:
ResultSet myResult = MyClass.query("...").get();
and that breaks it again
for some reason, my plugin.yml isnt being packed into the jar
ah lol doing /reload invalidates my custom player object
do you use maven to compile?
yes sir
sadge
?paste your pom pls
mvn package
Ohh ok
sounds like someones not generating a new one for all the already online players smh
Wait but that oblise me to do a new try.catch 😡
Cuz of get() method
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
it should be like this ^
is it okay?
its not really a player object but more like a wrapper, meaning my usermanager sucks :/
you can also add fancy comments like
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<!-- mfnalex is the best, I truly love him, nohomo though -->
</resource>
CompletableFuture::supplyAsync
this won't help you at al
@tender shard Your parser is ready
its work stuff
else i wouldve added it after everyline
I am 100% sure that you will still query the results instantly, hence eliminating the adventages of futures
WHERE
parser for what
csv files
But mate the ComplatableFuture#get() still throw shity exceptions 😡 😡 😡 😡 😡 😡 😡 😡 😡 😡 😡 😡 😡 😡 😡
u need a parser for that?
thx ❤️ did you test whether it works with weird symbols etc too?
xd
Why wouldn't it?
redempt can u make a toe pic parser for me
Yes it handles quotes
oh fuck i thought this was dms
make me a custom file configuration format ‼️
# Name, Last name, Address
Alexander,Majka,"Junkerstraße 17, 48153 Münster"
the third value should be exactly Junkerstraße 17, 48153 Münster (including the comma, but excluding the quotes)
Yep
hmm reloading server wipes my own cache :/
Sidenote though alex
🥲
This does assume that all rows have the same number of columns
Replace it with out.toArray(new String[0]);
I dont think that any normal csv file will have differences in length
It makes it slightly faster
I am pretty sure that it's basically required or a de facto standard to have the same amount of rows
erm
columns
hm I'm thinking about allowing comments
is that even a spec in csv
Must it
either it would check every line, if it starts with #, or it only checks the first line whether it starts with #
not that csv really has a spec but
no idea
The spec is usually that the first row is headers
I just don't want people to be surprised
Everything under the first row is data
yeah but it can also easily be empty
So there's no real need for comments
e.g. no header
I think simply ignoring the first line if starts with # is good enough
lol I was just thinking out loud lol
I'll just check if line 1 startsWith("#"), continue()
or sth
well yeah but beyond the first line saying heres what ur data represents and anything after it being the data
csv is free space
oh nice
I was already trying to figure out where I could add it myself lol
thanks
Enjoy your tiny parser
?
what kind of weird error message is that
obviously the file is called CSVParser.java
Click rename file I guess?
is the package right
lol?
LOL
Just delete the file and remake it
who else needs a parser
ini files
sure
yeah systemd uses it
I wonder if it supports nested "headers"
or whatever its caled
oh wait, arent those toml files?
yep it's toml https://en.wikipedia.org/wiki/TOML
TOML is a file format for configuration files. It is intended to be easy to read and write due to obvious semantics which aim to be "minimal", and is designed to map unambiguously to a dictionary. Its specification is open-source, and receives community contributions. TOML is used in a number of software projects, and is implemented in many prog...
Root
do you allow users to edit systemd files? lol
You make an admin account with your name or something usually
isnt that kinda useless if you sudo everything anyway, then
who can I get the ammount of letters before a specific symbol
String#indexOf
hello ?
Im trying to paste a screenshot but I cant
!verify
Usage: !verify <forums username>
!verify William404
A private message has been sent to your SpigotMC.org account for verification!
it only takes a minute 🙂
ah it works, trying to call class method inside my command check
it's sorted by the number automatically
so you wanna use the highest number for the highest row, and 0 or 1 or similar for the lowest row
huh
weird
i cant help with that
method 1 or 2 ?
whatever you prefer
I always go for the static getter
some people however claim it's bad, while giving weird arguments
some of those weird arguments are true though, but imho the disadvantages of the getter are less than the advantages
so yeah, fuck DI, it doesn't make code better testable at all, unless you're living in 2013 when mockbukkit didnt exist yet
al that DI does is make your code longer without gaining anything
that's my opinion lol
🧢
ah right ok
The issue with static mono state or singletons is partly testability, but also thread safety
Once you ascend to the level where you understand DI frameworks are more more pain than good you can call yourself a spigot Dev
Well not to mention, just because you use DI doesnt mean you did it correctly subsequently implying that you may not gain any significant advantage of it either
I usually use DI for registering events and commands and such
Yes because you have to there more or less, at least for registration
But when it comes to the design in your hands you could go for the non DI options (although I’d avoid that unless you have justifiable reasons)
Additionally, when I mean DI, I dont mean just populating your main class with getters to all your managers/high level facades and then pass your main instance around everywhere, as thats a clear example of when DI is wrongly used
i just don't see any reason to waste time into using DI for things that are singletons anyway
still struggling 😬
👀
public static void sendBlockDamageToEveryone(@Nonnull final Block, final float progress) {
for(final LivingEntity entity : block.getWorld().getNearbyEntities(block.getLocation(), 25,25,25)) {
}
}```
Would this work for only players within 25 blocks?
how i can modify player velocity to make practice servers knockback
i think so
Entity#setVelocity
how would I use entity as a player tho?
whut?
a player always is an entity
you can just do somePlayer.setVelocity(someVector)
yes but i dont know values to set or multiplayer?
if(entity instanceof Player) {
entity.sendBlockDamage(block.getLocation(), progress)
}```
this?
wait
that's wrong
ok that
you cannot send block damage to entities
you can only send it to players
so cast your entity to Player
yes
So (Player) entity
setY is vertical knockback ?
I said "Players are always Entities" but I didnt say that "Entities are always players"
Y is up/down
true
not helpful
👀
then maybe you should rephrase your question
Any seasoned veteran can teach me how to convert value from json file to a String using Jackson
sadge
A scalar value?
wtf is a seasoned veteran
public static void sendBlockDamageToEveryone(@Nonnull final Block, final float progress) {
for(final LivingEntity entity : block.getWorld().getNearbyEntities(block.getLocation(), 25,25,25)) {
if(entity instanceof Player) {
((Player) entity).sendBlockDamage(block.getLocation(), progress)
}
}
}```
that sounds like some vietnamese dish
Or like an entire structure?
this makes no sense in my brain
I'm trying to use a method from a class in my onCommand listener
let's say I have like "name": "Alex"
looks good. Btw, looping over the nearby entities is probably heavier then simply sending the blockdamage packet to EVERY player who's in that world
i want to get the value and put it into a string
Oh
You’d have to parse the entire json tree tho iirc
And then grab what you actually want
in gson it's like this IIRC myWeirdJsonObject.get("name").getAsString()
ajeiaoaknfskkakdn
no idea about jackson
but sending a packet to every player in the world and can't even see it should be heavier??
Lmao
i don't think so
Gson is a bit more sophisticated, not a bad choice
Vector v = event.getDamager().getLocation().getDirection();
v.setY(-0.3);
event.getEntity().setVelocity(v);
player who been hited get extreme left/right knockback
I only did that so it wouldn't make lag
This api already uses Jackson so I didn't want to import another dependency
why do you get the vectors direction?
sadge
You have multiple ones
you cannot
that's like asking "how can I turn 5 chairs into one". well you could throw away 4 chairs
There is no clear notion of how to transform one to the other and vice versa
you probably want to loop over your collection
Wait why is he using Collection 🤔
for(ItemStack myItem : myCollection) {
// Now you can access "myItem". It runs once for every itemstack
@ivory sleet mind helping me ?
I sent you a link that explains exactly this
you just said it's "not helpful" without explaining what you need help with
no! conclure help only
?conclurehelponly
i provided a screenshot
it was completly ignored
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
i did ask
no, all you said was "ah it works, trying to call class method inside my command check "
and your next message was "not helpful"
and now you start asking why people don't answer to you
I've seen that. and what is your question?
are you joking ?
I think that you are joking lol
You keep saying that you wanna call a method and deny explaining what your problem is
i dont have time to go into an argument with ya
I don't see a question mark
at first I thought you just need the reference to that class in the other class
but you just said "not helpful" so I really have no clue what your fk problem is
anyway, I wish you a nice day, I'm out
yeah see ya
all gae people are the same
all toxic
oups
Yeah bye
this gets you banned very quickly here
ban him
I'd be just as toxic and I'm straight as an arrow lmfao
i use this players get knockback on to left direction
event.getEntity().setVelocity(new Vector(1, 0.4, 1));
i need damager direction to set knockback direction
i was just trying to help bro
No he tried to help
can we get this dude banned now pls
when i posted a screenshot
I think I was realy patient
noone has to help you, it's voluntary
.
i know it is
class BootlegClass {
void callMe(){
sout("Conclure is NOOOB");
}
}
class NoobCommand implements CmdExecutor{
private final BootlegClass cluzz;
public NoobCommand(BootlegClass cluzz){
this.cluzz = cluzz;
}
void onCommand(…){
cluzz.callMe();
}
}```
Here this should be clear enough
Just because you can't ask a question doesn't mean we can read your mind
but where else am im i suppose to get guidance from ?
documentation, Google, but not spreading hate here
Ayo, lets calm down now shall we, william have a look at my dodo example and see if it might help
i wasnt spreading hate
I said stop
I was toxic?
Alright ask your question with code in a pastebin
I wasn't toxic at all, I simply asked you what your question is
me ?
So that we can see it. Don't leave anything out of your question be as specific as possible
yes you
?kick @quaint mantle stop already
Done. That felt good.
Well it was just there to move the convo xD
Just disappeared:(
now that it is done
Ahhh
I figured, I'll just remove it xD

but now I wonder too
its block data
rude, i was asking a question
this comunity needs to chill
is my disc broken or are they still here
Snowable alex
Does Block#breakNaturally make the item drop?
I’m fully interested in helping you william, but dont continue a dead debate
the only time you get specific block interface names
is if you are combining two sub interfaces
I just answer against bomb threats and please dont call me a jerk, respect my friend 🙏
Alr back to this
or the drop the block is about to drop?
Did u look at that at least 😅
alr back to this
I'm trying to use a method from a class in my onCommand listener
okay let's to a fresh start. what exactly is the problem?
yo uwant to call a method from somewhere else
so you need an instance of the other class
Alright, so is the method static?
you can pass an instance of the class via the constructor, like in the example conclure posted
You're trying to use a non-static method, I'm guessing?
In which case you need an instance
What class is it? Is it your main class?
https://blog.jeff-media.com/getting-your-main-classes-instance-in-another-class/ I already sent this but he said it's "not helpful"
When asking a question please format it with as much detail and provide code examples
But as everyone will tell you and none have ever heeded, you should learn and understand basic OOP before attempting to write plugins
Hey my code https://haste.miketheshadow.ca/ehotefaxol.nginx isn't working. I want to get a method from my class https://haste.miketheshadow.ca/ojigamakay.kotlin and it's not working
that's what you do ^
No it's not
and then I'd send ?notworking
Yeah yeah well you add more detail
I'm not typing an essay today
I write it too often
Asexual spectrum flag
ah ok
YourCommand command = new YourCommand(this);
Bukkit.blah.blah.setExecutor( command );
// to access a method in yoru command class.
command.method();```
there's so many flags, I cant remember them all lol
yoru
sounds japanese
Aspec flag is niche but it's really aesthetic
I love purple which definitely helped
is there private channels ?
Make a thread
spigot help
you can do ImageIO.read on the stream
while(block.getDrops().iterator().hasNext() ) {
System.out.println("Item dropped in slot " + i + " " + block.getDrops().iterator().next());
i++;
}```
why does that create an infinite loop and doesn't reach the end of the item stack?
how to I iterate the list then without creating a new one?
you don't really
you need to get it signed by mojang to get a signature
sooo you gotta upload it to minecraft.net
you store the iterator in a variable ?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
How can I make some entities bigger?
just scale them up
NMS
final var iterator = blocks.getDrops().iterator(); while(iterator.hasNext()) ....
you cannot
thanks
ohh..
for skins:
mineskin.org
great site
u only need Texture Value
i meant link
why buffered img?
r u requesting textures runtime?
yeee idk
never used their api
a texture value is {"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/ae58d8bc5f6a5b1a9ab28cf939eec51e2b4945294eae45d544cbb853d29e"}}}
it must use textures.minecraft.net
oh by the way
that is converted to base64
so it will look like this
eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYWU1OGQ4YmM1ZjZhNWIxYTlhYjI4Y2Y5MzllZWM1MWUyYjQ5NDUyOTRlYWU0NWQ1NDRjYmI4NTNkMjllIn19fQ==
yes
I can give you a web request method
Would it be possible to make players not be able to take armor/stuff from the armor stands?
@small peak this was literally on mineskin's website
A simple viewer for OpenAPI definition files
?paste
so was this
you didnt really do much digging didy ou
hello, i need do something when player activate end portal. I can't find what event to use for this. I tried PortalCreateEvent but it doesn't work. What event can I check it
Thsi is reading the json for a player profile skin. same kind of thing for all skins https://paste.md-5.net/aqagaxirer.java
I'm using the mojang mappings and i get this error java.lang.NoClassDefFoundError: net/minecraft/server/level/ServerPlayer, how do i fix?
yeah, ill send now
you need to use SpecialSource
i think i am, as the ItemStack class didn't give any error
yes
are you copying the correct jar from your target folder?
are you sure?
well what are the jars that are outputted
from shade
ook yea thats not gonna work
so.. in remap?
Why does storing the getDrops() in an Itemstack type variable doesn't work ?
you should use <outputDirectory>...</outputDirectory> in the remap-spigot configuration
ok
could I turn this:
into this? :
big squid
ye ikr
but as u can see
someone smhw made it
texture pack isnt problem for me
since I depend on it
works, thanks
ok so just... use a model then?
ig
but to answer your question for the second time
you cannot just "scale up" an entity
without a mod or texture pack
you can only do so for slimes
Hi i don’t know how to Get hashtags in config files but i need it how pls help tag me
like comments?
?nms
I have a BlockBreakEvent listener where I got the block, when I add items to the .getDrops() they don't drop
why's that ?
Yes like comments so pepole know what it does
The #getDrops() method probably returns an immutable list of drops. You'll have to copy the drops, add your items, cancel the event and then drop your copied list.
Gotcha, any method to give an item directly to a player?
getInventory
thanks, I'll test its bhavior
Would it be possible to make players not be able to take armor/stuff from the armor stands?
at me.nuclearkat.main.privatemessaging.messageCommand.onCommand(messageCommand.java:23) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.8.8.jar:git-PaperSpigot-445]
... 15 more```
```private HashMap<UUID, UUID> messageMap = new HashMap<>();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player p = (Player) sender;
if (sender instanceof Player){
if (Bukkit.getPlayer(args[0]) != null){
Player msgTarget = Bukkit.getPlayer(args[0]);
messageMap.put(p.getUniqueId(), msgTarget.getUniqueId());
if (args[1] != null){
StringBuilder messageString = new StringBuilder();
for (int i = 1; i < args.length; i++){
messageString.append(args[i]).append(" ");
}
msgTarget.sendMessage(ChatColor.YELLOW + p.getDisplayName() + " <- " + messageString);
p.sendMessage(ChatColor.YELLOW + msgTarget.getDisplayName() + " -> " + messageString);
messageMap.remove(p.getUniqueId(), msgTarget.getUniqueId());
} else p.sendMessage(ChatColor.DARK_RED + "Usage: /msg <player> <message>");
} else p.sendMessage(ChatColor.DARK_RED + "That player may not exist or is offline /msg <player> <message> ");
}
return true;
}```
Problem in console says its this line "if (Bukkit.getPlayer(args[0]) != null){"
args.length is 0
Would it be possible to make players not be able to take armor/stuff from the armor stands?
Works thank you @glossy scroll
If there's an event in spigot api where a player takes something from an armor stand then yes
@desert frigate
e.setCancelled(true);
}``` @desert frigate something like this I believe
e.setCancelled basically puts it back?
I'll try it
what an event name
my god
Lol
also one more thing, I saw someone use a nbt tag to not be able take armor from armor stands https://gaming.stackexchange.com/questions/317817/how-do-i-prevent-players-from-editing-armor-stands
But idk how to use nbt tags
I mean that method above should work fine, although it looks like it cancels everything
Wdym?
As in you nor any other player can add armor or take it off
that method is really bad but it was the only one I saw
well yeah as the plugin puts armor on the stand and I don't want anyone to change it no matter admin or not
but I was wondering how to put nbt tags on armor stands
why do invulnerable entities via Entity.setInvulnerable() still take damage from players in creative?
I would recommend writing it out so that it's a permissions based thing so it doesn't effect every single player, could do something like if (!p.hasPermission("<permission>"){ e.setCancelled(True); }
@desert frigate
so if the player doesnt have a permission then it wont let them do anything to armor stands
Also I dont know anything nbt tags
Just check on entity damage if entity is invulnerable. Then cancel 🤙
Yeah
Ah alr
does the EntityDamageByEntityEvent trigger even if no damage is done to the target?
ex player punching invulnerable entity
I have a quick question about slash commands on my server. I have a few plugins running (like essentialsx, luckperms, all the other basics) but whenever I type "/" it induces severe lag while it indexes the commands available (I'm assuming, there are about 1000 available for general use). Is there a way to disable indexing of commands? Look at mineplex, for example. There are commands available to use, but they aren't shown when the user types "/", reducing lag. I've observed this on bedrock PC and mobile.
when you say lag, is it server, ping, or FPS?
What version?
I'm pretty sure you can turn this off in settings
As in, your client settings
ok why doesnt this event trigger?
If you have that many commands, you might have an issue
its registered and everything
the if statement is not satisfied then
output some messages to the chat maybe to see which if statement isn't satisfied
gamestate thingy didnt work
is the config saved / reloaded when you check?
if the gamestate is changing whilst the server is running then it might not be best to use it from the config. By all means save to the config if that's what you want, but it should probably be it's own object if you need to access it
oh
that has an underscore
theres the problem
the game state you are checking doesn't
yeah you can checking gamestate and game_state
I think i would use presistant data container instead of config
?pdc
i mean i could
reason why i use config till this day is that i had beef with declaring variables in the code itself (i think its a thread problem)
Wdym
so i went "fuck it" and started using configs as data storage
when i would declare a variable
and try accessing it again
it would return it to its default value that java assigns
no idea
pretty much soemthing to do with atomic variables
how long does it take for a premium resource to get accepted? all forums ive found are 4 yrs old
How can I detect when a player punches an entity when the target is invulnerable? The EntityDamageByEntityEvent does not fire if damage is not actually done
The most I'll ever tend to use static access is for my plugin instance, everything else is an instance specific to my plugin. Since your plugin can only be running once it doesn't really change anything, but maybe you could try not using static variables?
i have tried that
Player interact event
i.e getters
if you mean player interact entity event that only checks right click
No
I'm trying to register this EntityDamageEvent
registerEvent(EntityDamageEvent.class, (listener, ev) -> {
EntityDamageEvent event = (EntityDamageEvent) ev;
System.out.println(event.getCause());
if (event.getCause().equals(EntityDamageEvent.DamageCause.SUICIDE)) return;
if (!(event.getEntity() instanceof Player)) return;
Player player = (Player) event.getEntity();
event.setCancelled(true);
player.damage(event.getDamage());
EntityDamageEvent dmg = new EntityDamageEvent(
player, EntityDamageEvent.DamageCause.SUICIDE, player.getHealth()
);
player.setLastDamageCause(dmg);
Bukkit.getServer().getPluginManager().callEvent(event);
});
```and to prevent recursion im setting the damage cause to be SUICIDE then I try to filter out that damage cause, but the event still causes itself. i can't figure out why because I am doing (pretty much) the same thing as https://www.spigotmc.org/threads/how-do-i-set-the-last-damage-cause-of-an-entity.509421/ and it just doesn't work
can you ellaborate
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
You could try firing a custom event that extends EntityDamageEvent
this doesnt check what entity got interacted
Yes ;)
It checks if player right/left clicks
Then check if it's an entity
yes, kotlin is completely interoperable with java and compiles to the JVM so it provides a jar. The set up is slightly different to get things working with spigot because you'll need to provide the server with the kotlin library somehow (be it with plugin.yml libraries or shading kotlin into your jar making it quite big). But I personally think it speeds up the development process and leads to you writing safer code that is less likely to break
so you mean getting the interaction point and getNearbyEntities or something?
you're mixing the two events
What?
playerinteractentityevent has a method for getting the target entity but only checks for right lickcs
playerinteractevent has a method for which action but not the targetted entity
i was either A thinking of doing that or B since im using paper actually i do have the getinteractionpoint method which i could use to find the nearby entity
how can I get an item var on crafting event and I mean Item not Itemstack
how would i use that to prevent the loop? to register it i would have to call it with EntityDamageEvent, then using it I would damage the player, which would then cause EntityDamageEvent & my custom one again, right?
haven't used the event before so I'm not sure if it's called when the player attacks an invulnerable entity but you could check
if you call your custom event which extends the normal event, other plugins will register the damage as normal, but in your listener you can check if the event is an instance of your custom event and then cancel
you might have to upcast the custom event to the parent when calling it, though I'm not sure
not something I've done before
an Item is an entity, so you would have to drop the item first to get an Item class.
I'm trying to send packet's to update the gui's texture.
I was doing:
PacketContainer packet = new PacketContainer(PacketType.Play.Server.OPEN_WINDOW);
packet.getModifier().writeDefaults();
packet.getModifier().write(0, invId);
packet.getModifier().write(1, invSize);
packet.getChatComponents().write(0, WrappedChatComponent.fromText(title));
// Send the packet to player
it was working on other versions than 1.19. Now on 1.19 it throws an error on
packet.getModifier().write(1, invSize);
line. Does anyone know what can I do about it?
Error:
Caused by: java.lang.IllegalStateException: Unable to set value of field private final net.minecraft.world.inventory.Containers net.minecraft.network.protocol.game.PacketPlayOutOpenWindow.b
Caused by: java.lang.ClassCastException: Cannot cast java.lang.Integer to net.minecraft.world.inventory.Containers
the second field of the open window packet is now the window type
refer to https://wiki.vg/Protocol#Open_Screen
so how would I go about doing that
so you should be setting the inventory ID https://wiki.vg/Inventory @crisp forum
the world class has a dropItem method which returns the Item
why do you need that?
actually I'm not sure this is true since this seems to have been the case in earlier versions, I might be wrong?
took me maybe a week?
I try making a plugin where everytime you pick up / craft a new item then it gets counted an a message gets send to player with the item name
How long before someone buys my premium resource 
what is it
been 2 months, no downloads
you shouldn't need the Item class for that
I don't have one. My ideas arent worth money
lol
Now I've set the field 1 to 2 (9x3)
packet.getModifier().writeDefaults();
packet.getModifier().write(0, invId);
packet.getModifier().write(1, 2);
packet.getModifier().write(2, WrappedChatComponent.fromText(title));
packet.getChatComponents().write(0, WrappedChatComponent.fromText(title));
But it still throws the error :/
Yes I realised that might not have been correct
who then when I craft a wooden button the material it returns ar
haven't got access to an IDE at the moment so I can't check NMS. Maybe the second property of the packet is now a Containers enum rather than an integer ID?
that's what the error leads me to believe
you mean "1" with "second" right?
lol :p
I have a set of float/double coordinates x,y,z (e.g the coordinates of an entity but not necessarily)
How do I get the coordinates of the block? Do I have to round, ceil, floor, do any other kind of translation?
I've set it packet.getModifier().write(1, Containers.GENERIC_9X3); but still throws error :/
same error?
scala
kotlin is basically a way to make your code worse
and make it worse faster
🤮
stfu
dude
stop spreading nonsense
No to be fair I can't judge scala I haven't used it
Not talking about scala
oh no not the same error now the error is Caused by: java.lang.ClassNotFoundException: net.minecraft.server.v1_16_R3.Containers
do you understand what the error is telling you?
kotlin is basically a way to make your
Is there a straighter forward way than doing
Location loc=new Location(x,y,z);
int blockX = loc.getBlockX();
int blockY=...
...
?
Remember What block the player interacted with
looks like your trying to use 1.16NMS with 1.19
if I had an IDE it would be easier to help but you need a net.minecraft.world.inventory.Container
it was working with 1.18 but looks like not working with 1.19
the most recent error says you are trying to use this class: net.minecraft.server.v1_16_R3.Containers
which is because you are working with 1.16 spigot in the code
Hello. Can someone told me flag for armorstand if I dont want player put armor on it? I need this for holograms.. I thought of making InteractEvent on cancel if the armorstand is invisible but it seems complicated...
@lunar mica public void onTake(PlayerArmorStandManipulateEvent e){ e.setCancelled(true); }
I would recommend writing it out so that it's a permissions based thing so it doesn't effect every single player, could do something like
e.setCancelled(True);
}```
Okay, ty ^^
How to get a localized enchantment name, the name of enchantment but in lang of player
that?
looks like it could be bugging because its a depreciated thing
why am i getting this error org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event com.jere.xkits.api.BoardUpdateEvent. Static getHandlerList method required! from ``` private String name;
private static final HandlerList HANDLERS_LIST = new HandlerList();
private boolean isCancelled;
public BoardUpdateEvent(String name,){
this.name = name;
this.isCancelled = false;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.isCancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return HANDLERS_LIST;
}
public String getName() {
return name;
}``` when trying to use the api? i have 3 other events like this 1 that work perfectly fine and dont give errors
how can convert in lang of player, like this
I'm not sure how you would check for the player's client language setting
Ideally you'd just make it a translatable component, but Spigot doesn't expose lore as a BaseComponent yet
I didn't quite understand
Modern Minecraft text makes use of components. Y'know the whole {"text":"Hello world!", "color":"red"}. Yeah, that thing. That's called a text component (or a literal component). There are also translation components which lets you do something like {"translate":"enchantment.minecraft.sharpness"} which would then translate that key into "Sharpness" on the client in the client's language
Spigot has an API around that called BungeeChat, which includes a class for TranslatableComponent (or TranslationComponent, I can't remember), but what Spigot doesn't have, is an API to set an item's lore using that API
You could in theory do player.spigot().sendMessage(new TranslatableComponent("enchantment.minecraft.sharpness")); and you would get in chat Sharpness (or whatever equivalent verbage would be used for your selected language)
like this?
No, because that would force it to call toString() which won't look at all like you expect it to
You're wanting to add this onto an item, right?
Yeah, Spigot doesn't have API for that
😐
It has the TranslatableComponent API from BungeeChat, but it does not have a way to set an item's lore to said component
I keep telling myself to get to implementing that shit but I keep getting distracted
So I have to make an enum file for example to define an enchantment and its name?
Pretty much, yeah, you're limited to that. If you care all that much, the most you can do is make it a configuration file so users can change what language to use for themselves
Though you won't be able to change that per-user
Actually, that's a lie. You technically can lol
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#getLocale()
English users might use either en_us, en_ca, or en_uk, in which case you would use an English translation. Alternatively, fr_fr for France French
thanks for your help!
o/
@dim bronze is it normal :p
yup, that's NMS for you, all obfuscated
I believe you can map them to logical names now with mojangs mappings, but never done it so not sure how
but I was able to use sth like
entityPlayer.playerConnection
when using 1.16
--remapped
yeah playerConnection shoudn't be obfuscated
fixes everything
im getting Illegal Entity Teleport with java.lang.Throwable: null when trying to teleport a mob on the entity unload event. does anyone know what could be null here? is the entity somehow null? my code is pretty much just entity.teleport(location)
there is no getHandle :p
what type is nms
EntityPlayer
getHandle() is on CraftPlayer
handle is on CraftPlayer
nms.playerConnection.sendPacket is now nms.b.a lol
the obfuscation has always existed
?paste
Run buildtools with the --remapped switch, then use a pom like this https://paste.md-5.net/amujaweyob.xml
shame there's no nice way to do it with gradle, just have to use a plugin for it
I'm using org.spigotmc
1.19-R0.1-SNAPSHOT which is from spigotmc repo
but still a lil annoying
you using a plugin for it?
lol emoji
It's a dependency
you gotta do it with paper
Then suffer using obfuscated code.
can't really use spigot directly
but
you also gotta add some lines to your settings.gradle
I think using buildtool is easier
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = "https://repo.papermc.io/repository/maven-public/" }
}
}
yeah, but like I said, uses a plugin
behind the scenes a lot more complicated
but, yeah, if you're using a plugin, its fine
it's easy for the end user to just copypaste the build.gradle and move on with their lives
yeah and I have no problem using a plugin
just saying for the person who had to write it, its a lot trickier
I'm adding these to my settins.gradle right?
anyone have a solution for this?
?paste the full error
I imagine it's because either the entities or the chunk you are teleporting to is unloaded?
You don't
Bungee doesn't have any understanding of ItemStacks
because the entity unload event isn't cancellable I imagine there's nothing you can do to stop them from being unloaded at that point, you would potentially have to respawn them?
Any good callback recommendations? Because i need to create a database callback which i pass a query argument and then be able to get the result
You would need both a bungee plugin and a spigot plugin working together
I was thinking something: MyClass.query(query, (result) -> {});
how does one do that?
this adds itemstacks too?
Spigot Itemstacks do not exist on the bungee proxy
in the example on the readme it shows itemstacks tho. Thats why I asked whether that also adds it
somehow
That plugin simply tells the spigot plugin to create an inventory and open it for the player
example?
Those are not Spigot ItemStacks. Read teh code
the plugin needs to be added to spigot as well so the bungee server can tell the spigot server what to do
I've added them to my setting.gradle and added the dependicies to build.gradle what should I do next?
package me.gabryosas.fiftyinfo.listeners;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
public class Info implements Listener, CommandExecutor {
private Inventory gui;
public void openNewGui(Player p){
gui = Bukkit.createInventory(null, 45);
ItemStack vetro = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7);
gui.setItem(0, vetro);
p.openInventory(gui);
}
@EventHandler
public void guiClick(InventoryClickEvent e){
if (!e.getInventory().equals(gui)){
return;
}
e.setCancelled(true);
Player p = (Player) e.getWhoClicked();
switch (e.getSlot()) {
case 0 : {
p.closeInventory();
p.sendMessage("ciao");
break;
}
}
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;
if(sender instanceof Player){
openNewGui(player.getPlayer());
player.sendMessage("§7[§9FiftyRP§7] §7Imparerai le nozioni base...");
}else {
sender.sendMessage(ChatColor.RED + "Non sei un giocatore!");
}
return true;
}
}
With the command opens the gui, but when I click on it it does not delete the event .. why?
do not close nor open inventories in the InventoryClickEvent
how come?
read teh javadoc on it
gui shouldn't be global since the next person to run the command is going to change the object that gui points to, and so the if statement won't return true for the first person as gui has changed
ok
Is it possible to list every config section under a section?
thanks
yeah, i think it only happens when swapping worlds as well which i dont understand
public int determineOpenedInventoryId(Player player) {
CraftPlayer craftPlayer = (CraftPlayer) player;
return craftPlayer.getHandle().inventoryMenu.containerId;
}
public void updateCurrentInventory(Player player, Inventory inventory, String title) {
CraftPlayer nms = getNativePlayer(player);
MenuType nativeType = CraftContainer.getNotchInventoryType(inventory);
nms.getHandle().connection.connection.send((Packet)new PacketPlayOutOpenWindow(determineOpenedInventoryId(player), nativeType, (IChatBaseComponent)new ChatComponentText(title)));
}
public static CraftPlayer getNativePlayer(Player player) {
return ((CraftPlayer)player);
}
when I use org.spigotmc:spigot:1.19-R0.1-SNAPSHOT the craftPlayer.getHandle().inventoryMenu.containerId part gets broken and when don't use it I can't import PacketPlayOutOpenWindow, IChatBaseComponent, ChatComponentText
is the world definitely loaded beforehand?
you're importing spigot mappings and wondering why mojmappings get broken
if you import spigot directly, you gotta look at all the fields to determine the container id
yeah
why am I getting this exception?
What is that console 🤮
You're using shape() incorrectly, yeah
Only one call to shape, 3 expected strings
In your case, recipe.shape("XX1", "32X", "33X")
You didn't have you delete your messages
You were right too
thx
transparent
when a entity gets killed, does the persistentDataContainer get deleted?
also why is there no PersistentDataType#BOOLEAN
maybe MD5 has assumed that Byte is good enought
anyway you can make your own PersistentDataType type for example new PrimitivePersistentDataType<>(Boolean.class)
ah alr
ty
well you can't since PrimitivePersistentDataType has packet private constructor, my bad
or with String, 'true', 'false' but that would be less optimalized
more hard
what about this?
setOwningPlayer
no, can be online or offline
so confusing smh
all online players are also “offline”
what-
Players are also OfflinePlayers
oh alr
is there a way to check when the player died
Anyone know about this ?
Tried using these item flags but hasnt made any difference: itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_DYE, ItemFlag.HIDE_ENCHANTS);
nvm got it
is there a way to check when a player dies and get the killer as a variable
PlayerDeathEvent
it says it dosent work
?notworking
"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.
#help-development message but thank you regardless
Someone knows if there is a ProtocolLib development discord comunity?
I'm trying to develop a plugin that modifies chat messages when a player receives them from another player. But I'm having trouble understanding ProtocolLib
Why did they obfuscate nms?
getPlayer() dosent work it has red underline on it and says getPlayer() dosent associate with PlayerDeathEvent
I believe it’s getEntity
How would I make it so the entire time an egg is alive after throwing, it spawns anvils underneath it?
My code rn
@EventHandler
public void EggThrow(ProjectileLaunchEvent e) {
Entity egg = e.getEntity();
}
?scheduling
so Player player = event.getEntity();?
how do u get the killer as a var
Player should have a #getKiller
how do u get the killer and then set the killers max health to + 1 heart and the player who got killed loses a heart
Lifesteal plugin #636?
why can't I just make 1 good lifesteal plugin in like 5 minutes
I'd get a trillion downloads
do u make lifesteal plugins?
uhm lol they are super easy to make it'd prob take like 10 minutes max to make one
well then again idk what life steal entails its just you kill ap layer you get there heart right
then once they have 0 hearts they are eliminated or whatever
you can probably find the other 635 on the spigot website or on github
yea easier said then done
I'd think its as easy said as done
Unfortunatly my standards are too high for my first plugin on spigot to be lifesteal
what do u use to make it
probably java
im trying to develop one but for me its super hard
please put a comma in that sentence
lmao
i read it as, I code in javaskript is icky
i dont like kotlin
its basically a young kid in there rebellious phase version of java, but there isn't any maven
yea lol
anyways all you gotta do is edit the players max health attribute
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(aDouble);
how do u get the killer as a variable and
in your case its setAttribute
I'm sorry to ruin this for you but I'm about to make 90% of a life steal plugin right now
i do it for the experience
bru
Player player = e.getEntity();
if(player.getKiller() == null){
return;
}
// set health attribute I'm way to lazy
// remove health from killed player way to lazy to type
in BlockPlaceEvent how can i get the item persistent container?
is this an event?
slap this in your Player death event
than just set the attributes properly
BlockPlaceEvent#getItemInHand()
why is e not defined
bakka
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockPlaceEvent.html :P spigot docs ftw
declaration: package: org.bukkit.event.block, class: BlockPlaceEvent
whats adouble
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
ik but does itemInHand return nothing cause they placed the block? or does it show the block that was placed
its not defined
this
It will reflect the item before anything is placed
Most events run before the actual action, hence why they can be cancelled
its a decimal
learn java primitive types
ik but whats should i set it as
is there a way to list resources in spigot?
the players current max health Plus your increase amount
wdym by this
i want to make my plugin extract a folder from inside my jar
same way you do in normal java
and i don't want to manually program each file
I've gotcha. 1 sec, Temmie
Does saveResource handle folders?
cant i just do +1?
Yes
I think you need to do +2 for a full heart iirc
^
also don't forget to subtract the other palyers health
thanks choco, ill take a look
That one is obviously a save method that will recursively save a directory's files, but if you want it to do something else, you've got the base of it there
and then how do i get the player who got killed
how
Good Ol JarFile
alright awesome
Just replace the saveResource() call is all
this is super helpful
That method's a classic lol. Any time someone asks a similar question I just pull that one up 
lol makes sense
part of my plugin involves automatically creating and hosting a resource pack
so i want the plugin to extract the assets folder from resources
this will help a lot
the assets folder has part of the resource pack but the rest has to be built at runtime
ahhh nice resourcepack generating at run time is a pain though because you need to upload it to some form of cdn
Just hosting it at runtime sounds pretty cool
how do i get the other players health
just "player.setMaxHealth(-2);"?
there current max health minus 2
also make sure it doesn't go under 0
No that will set their max health to -2
Which sounds
Painful at the least
I wonder what would happen
spooky
Even if it deals 0 actual damage
so like 8?
20 health 10 hearts
1 heart = 2 health
or "player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(+2);"?
player#setAttribute probably
oh nvm
so -2?
Still no
You need to actual add or subtract from their current max
Not just set it to a flat +/-2
think through how you would subtract there current by 2 :)
you sent it like fifteen minutes ago
what
#getBaseValue
Is there a way for me to change the rate of natural regeneration for players only?
I have some simple code, and it gets a list of blocks and then loops through and breaks them naturally with the users pick. It isnt breaking the blocks. block.breakNaturally() is just returning as false. Here is the code: https://paste.helpch.at/duqayeguxo.java
Then it’s failing
Does the method Player.sendMessage call the AsyncPlayerChatEvent?
no
That event only triggers when a player sends a message
not when it receives one
but, I cant seem to find why, the blocks are there, idk what I am doing wrong
Something else is probably cancelling the event
Anyone know good utilities/libraries for making custom mobs?
package aioplugin.aioplugin.events;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class PlayerJoinEvent implements Listener {
MongoCollection<Document> NewJoins;
@EventHandler
void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event){
if(event.getPlayer().hasPlayedBefore()){
@NotNull String PlayerName = event.getPlayer().getName();
UUID uuid = event.getPlayer().getUniqueId();
Document document = new Document();
document.append("Name", PlayerName);
document.append("UUID", uuid);
NewJoins.insertOne(document);
} else {
System.out.println("User has Played Before.");
}
}
}
``` Im trying to make it so whenever a user has joined for the first time, it saves their info like their name and UUID. but whenever a user logs in for the first time it doesnt log their name and uuid in mongodb
Not plugins I mean utilities or libraries for making them in a plugin lol
this plugin has API
declaration: package: org.bukkit.entity, interface: Player
what would be best the way of going about detecting a left click on an invincible entity?
the entitydamagebyentity event does not fire because it is invincible.
playerinteractentity event only detects right clicks
playerinteractevent only detects the location
