#help-development
1 messages · Page 1522 of 1
like in vanilla, if you type /tp a 90 90, the command will be highlighted
above 1.13 that is
Oh yeah implement the TabCompleter
because it knows where a is should be an number
Even tabcompleter doesnt care about arguments
I think at least
yeah but tabcomplete requires me to return an array of possible arguments
not if this argument is valid or not
Hmm maybe that’s some sort of brigadier feature or nms stuff then
Best bet is accept and parse them
and infinite CPU
if invalid send usage
I have both. maven still complains about not being able to find the symbol, and neither can my IDE
Yeah adding every number to a list sounds like a terrible idea
I am doing that but it's just not ideal innit
it is not spigot-api for artifactid
quite impossible, in-fact
just spigot
Reload the maven project, if you haven’t done that
or maybe doesn't matter for your case
Well it isn’t impossible theoretically
spigot artifactId requires BuildTools
i mean, spigot requires buildtools
is there a way to make this code more fluid
you mean more clean?
more fluid as in?
yes
like smoother camera?
there are several ways
and maybe reduce some lines or improve the back end
i think too
and that sometimes the crosshair went from where it was
would firstly divide into various methods
Hey guys, this is my fluffly recoil system, i'm not using shake cam and spray. It's dynamic with blueprints: curves, timelines, vectors, lerps, rotators, delta, time by handle, custom events, arrays, etc etc
So... i hope you like it
original idea
In that case get a curve and send multiple packets
what do you mean curve
a mathematical curve
spray pattern
yes...
make one for the speed the the camera should be moving at
I don't know how to handle it
dont bother with this yet
you mean float
the speed
?
distance/time
make one ??
say the player's camera goes up by 10 degrees from firing the shot
yes
say you seperate it into 5 parts of 2 degree
then the delay between you sending each packet to move the camera up
would be determined by the curve
but in this case it would be interesting to go up faster and faster because of the shots, right?
the camera would get a bit stuck
that's why I created a lerp
well every tick is 50ms
so if you do it real fast the stutter wouldn't be as noticeable
this is the only way to get a smoother camera
unless you require the client to install mods
but if you think that's too messing, just setting their looking direction works too
Is there a way to run an action before the plugin get disabled without using the onDisable() ?
I reloaded my maven configuration and removed the javadoc dependency, and I'm still having this issue. There must be something else.
it's saying server#Spigot() doesn't exist
what are you trying to do?
for like reload? or restart
I'm writing a library and I need to close the sql connection when the plugin that has the library shaded get disabled
So your lib is has an entire plugin shaded in
and when the plugin gets disabled, you close the sql connection?
no, the plugin has the library shaded
plugin.jar
| my library
yes
and why do you not want onDisabled?
because I got the plugin instance with JavaPlugin.getProvidingPlugin(MyLibraryClass.class) and I prefear to not ask to the user to add a string on the onEnable and onDisable
I see
is your lib an independent plugin?
like if you build it and drop it into plugins folder would it work?
How can I prevent an item in an player inventory from dropping if the player dies?
So nobody can pick it up, just remove it
cause the best way to do it is make it a plugin and have its own onDisable
like How protocolLib doesn't do anything by itself
but is still a independent plugin cause it needs event from bukkit and spigot
Do you already have an event for player dropping their item when after they died
No, I just listen to PlayerDeathEvent, this is the right event maybe?
that is correct
What can I do in there?
and they have a method called getDrops()
that returns a List of ItemStacks
do you know where to go from there?
Yes just remove it from the list?
correct
Ok thanks
that will directly affect the items dropped
Yes I understand
Good luck
I mean why not, adding a shutdown method is more flexible
not sure, try adding the symbol yourself ig?
what is the symbol for bold?
iirc it's b?
no
First the color then the text decoration
oh okay
right l yes
I think overwrites
I think color codes overwrites the color code
Yo, quick q, which repo should I be using for the releases of the spigot API? https://hub.spigotmc.org/nexus/#view-repositories
As they all seem to be SNAPSHOTS in org.spigotmc.spigot-api
for maven/gradle?
Just Fucking Google It helps you help others to use Google and search on their own!
Ah, why didn't I think of that!
yep
If only I'd of searched for it for the past half hour before coming here!
Anyone with any idea what they're talking about have anything actually useful to bring to the conversation?
so what do you want
Which version of spigot are you going to build against?
1.17, but the repo's are all listed as snapshots and not releases? Just wanted to double check if that's normal, or if there's a releases repo I'm missing somewhere?
they are all snapshots
to build against 1.17 (as its not a full release) you need to run BuildTools to get it locally
all release builds are under xml <repository> <id>spigot-repo</id> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> </repository>
That's the snapshots repo, no? - https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/
all of them are in snapshot :)
the link I gave you is the repos
Right, so the idea of having the releases and snapshots repos (which both just contain snapshots) are just there purely to cause confusion?
you use the repo root and the id and version you pick selects which snapshot
Right ok, so the tl;dr is basically just use whatever file is in any of the repo's, even if the filename suggests it may be an unstable snapshot?
you are using gradle so you are not interested in the individual files
I have to specify implementation 'org.spigot:spigot-api:1.15.2-R0.1-SNAPSHOT' in my build.gradle file, for example
You provide gradle with the repo, the groupId, artifactId and version and it selects the correct files
yes
groupId, artifactId and version
groupId is org.spigotmc
artifactId is spigot-api
yes, which is fine - but I was getting at why there's a release and snapshot repo? (as shown on https://hub.spigotmc.org/nexus/#view-repositories) - yet all the files contained within each repo are just named "SNAPSHOT"
the R0.1 is the release version, snapshot is a prerelease as far as I know
Why doesn't the entity get effect?
Right, I see, the release is denoted by the R in the filename, and pre-releases are denoted by pre
I was mistaking snapshot for pre(release)
Thanks for helping me clear that up @eternal oxide 🙂
You are trying to apply a potion effect and an explosion when a Zombie hits a Player?
exactly
I mean you could just skip version and use something like + I believe or latest to always target latest @timid kestrel
Have you registered the listeners?
I did
@ivory sleetOh does it? That's handy to know :), I assume in the case of Gradle, you'd use implementation 'org.spigotmc:spigot-api:+'?
Does anything happen from the listener?
it gives me an error at line 44 (if (!(e.getDamager()).getCustomName().equals("§4§lSanta Claus")) return;)
What is the error?
EventException
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.entity.CraftZombie cannot be cast to org.bukkit.entity.Player
at me.thamessia.santaescaper.Santa.onPlayerHitted(Santa.java:44) ~[?:?]
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_281]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_281]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[craftbukkit-1.8.8.jar:git-Bukkit-18fbb24]
... 34 more
No
implementation is if you shade it such that you provide the dependency at runtime
When the dependency is provided and runtime and you only need it at compile time use compileOnly
can you help me?
@ivory sleetAh, okay, something for me to look abit more into (I'm still fairly new to Gradle) - Thanks 🙂

That can not be line 44. You do no cast there
((Player) e.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60,10));
((Player) e.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 10));
``` prob this?
yes
how can I fix this?
From the code you have shown it should be impossible to have that error. You exit early if getEntity() is not a player
ok I see your error
You really need to post the correct line numbers
((Player) e.getDamager()).addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 60, 2)); getDamager() will be a Zombie not a player
these lines give me an error saying that you can't go past kb 2 does that apply to all of these? java Netherite_Axe.addEnchantment(Enchantment.KNOCKBACK, 10000); Netherite_Axe.addEnchantment(Enchantment.FIRE_ASPECT, 10); Netherite_Axe.addEnchantment(Enchantment.DAMAGE_ALL, 10);
Hey guys, two questions:
- is there any difference between the player1 and event.getplayer add potion effect as shown here or would they accomplish the same thing?
- It seems like my potion effects are being added to the player before the player logs into the game because I see debug msgs in the console. What am i doing wrong here?
@EventHandler
public void playerJoin(PlayerJoinEvent event) {
Player player1 = (Player) event.getPlayer();
player1.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 60, 50));
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 60, 50));
}
player1 points to the same player object which event.getPlayer() returns, if you want to add it later, use the BukkitScheduler and delay the addition of the potion effect.
thanks!
Does Player#getVelocity() return a clone of the player's velocity?
Yeah
Damn
idk if it’s a clone or just a reconstructed instance
Is it mutable?
Vectors are mutable I think?
Yep
👍
Thanks, you saved me from a bit of trouble. Have a good one.
lol
I have another question
Similarly, does setting a velocity set a clone of it?
RE: bukkit scheduler and ticks, the L means ticks right? so 5L = 5 ticks where 1 tick = 0.05 seconds? Just want to make sure I understand the time/length lol
Unsure, probably smtng like that
Well if u update ur vector instance after, the changes won’t reflect on the player
Or the entity for that part
is 1 tick 0.05 seconds?
Is an Invulnerable Entity instanceof Damagable?
good question, you tell us
I can't really test rn
I'm on crappy hotel wifi
Does this mean that Invulnerable Entities will not implement Damageable?
yes they will
whether you can damage them via the methods is another question
Yeah, I was wondering because I was checking if an entity was damageable to include them in a certain attack...
What's a good way to make sure you can't knock back holograms or NPCs with special attacks?
give them knock back resistance?
Can I give them 100% knockback resistance?
no, it has to be shaded
Should I be using bukkit scheduler or scheduleSyncRepeatingTask for repeating methods? I want to add a potion effect to all players that are alive every x seconds
How difficult is it to make a class that extends EntityPlayer to make fake player bots?
runTaskTimer
Every time I try to spawn in one of my EntityPlayer bots my server crashes
does anyone know why my list isnt sorted https://paste.md-5.net/azayetarex.cpp
could someone help what are this imports right now in 1.17 spigot please the imports : IChatBaseComponent, PacketPlayOutPlayerListHeaderFooter, ChatSerializer
Is there a way to use persistent data storage in 1.8?
net.minecraft.network.chat.IChatBaseComponent
net.minecraft.network.protocol.game.PacketPlayOutPlayerListHeaderFooter
and the chat serializer
ChatSerializer is a inner class in IChatBaseComponent
thanks very much
ou thanks
a tab plugin
ok
does anyone know why my list isnt sorted https://paste.md-5.net/azayetarex.cpp
So there’s no other way to do it in 1.8? I want to create a player vault plugin but was wondering how I would store the item info
Terrible work around as you wish to develop for such an old version.
Store your stuff in linked maps, and save the maps to a config / database at restart.
Persistent data containers replaced the need for that
Got it
Hello, how do I check if inventory is empty? I tried getContent() method, but it returns as it would be a full inventory, but all values are null when I checked it by printing
I was thinking about using stream to filter null values, but there should be another way lol
ok nvm, I'm dumb, I forgot about isEmpty() method -_-
How can I get the attacker of entity X from EntityDamageEvent
Check if this event is instance of EntityDamageByEntityEvent, then cast it, and use getDamager() method
or just use EntityDamageByEntityEvent event
Does spigot have a built-in Sqlite/jdbc connection? Cos It seems to be outright fucking my p6spy/sqlite connection I'm trying to make
yes
wicked, good that's it's been documented precisely nowhere and has been causing me problems for the past 2 days trying to work out wtf is up
take a look inside the spigot jar. you will see everything thats shaded
I can't remember where to look to know which packet is used for what in protocollib
Their docs are really bad so I don't really know
?paste
?
I don't suppose anyones ever tried using p6spy on spigot? I'm having real trouble getting it to play nicely
thats whats shaded in the spigot jar
All this to simply try and log the SQL querys in terminal...
What does that mean and how does this help me ?
You said it wasn;t documented
So I gave you the list
Hmmm
List? What list?
Protocollib is just a wrapper. Use wiki.vg for packet info
Okay thx
Sorry wrong person tagged
Okay
My code here:
@Override
public void onEnable() {
System.out.println(ChatColor.GOLD + prefix + ChatColor.GREEN + "Initialised");
Objects.requireNonNull(getCommand("duel")).setExecutor(this);
Objects.requireNonNull(getCommand("accept")).setExecutor(this);
}
Is producing this error:
java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:221) ~[?:?]
and I don't know why?
either duel or accept is not in your plugin.yml
This is my plugin.yml:
name: Miniplugin
version: 1.0-SNAPSHOT
main: com.miniplugin.org.miniplugin.Miniplugin
api-version: 1.16
commands:
duel:
description: "Duel player"
usage: /duel [Player]
accept:
description: "Accept duel"
usage: /accept
i dont have that many lines
paste your full error
20.06 17:10:29 [Server] ERROR Error occurred while enabling Miniplugin v1.0-SNAPSHOT (Is it up to date?)
20.06 17:10:29 [Server] INFO java.lang.NullPointerException: null
20.06 17:10:29 [Server] INFO at java.util.Objects.requireNonNull(Objects.java:221) ~[?:?]
20.06 17:10:29 [Server] INFO at com.miniplugin.org.miniplugin.Miniplugin.onEnable(Miniplugin.java:27) ~[?:?]
20.06 17:10:29 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:591) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:281) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-"809466f2e"]
20.06 17:10:29 [Server] INFO at java.lang.Thread.run(Thread.java:829) [?:?]
20.06 17:10:29 [Server] INFO [Miniplugin] Disabling Miniplugin v1.0-SNAPSHOT
Miniplugin.java:27
lines 27 is:
Objects.requireNonNull(getCommand("duel")).setExecutor(this);
it says duel is not in your plugin.yml
ill try again
I fixed it (apparently I had 2 plugin.yml?)
ok
thanks for help
(you really should use intellij and not eclipse)
Eh, just telling my opinion
ok i use eclipse bc i installed it
and mainly use it to do some random stuff with java
Thanks for telling your opinion, but i prefer Eclipse
Okay
I started with eclipse and moved to IntelliJ
Same
both are pretty good
i have to use builds too and git bash?
type this command in bash? java -jar BuildTools.jar --rev 1.8
I use intellij - I tried eclipse and I didn't like the UI - and also intellij and pyCharm (which I both have) fit nicely together
does someone mind explaining what is bStats and what is its metrics?
only if you are using nms
what is nms
its minecraft code, not spigot api
if you are only using teh API you don;t need nms
Is there any way to specifically prevent certain structures from generating, such as villages?
does anyone know how to sort items by its displayname with the comparator
Second example uses a Comparator https://www.javatpoint.com/java-list-sort-method
does anyone know why my list isnt sorted https://paste.md-5.net/ujikinonuv.cpp
i tried it also without reversed
I think the list is sorted, but you update the inventory everytime before fully populating the list so it is only as sorted as possible at that point
did you saw the code corectly?
yes
you add a new friendInfo to the list
and then directly add the item to the inventory
the inventory is never sorted tho
i logged the informations with and without the reversed mevod both doesent work
okay but how can i fix this problem
you first populate the entire list list
do not touch the inventory at all
then sort once after adding all the friendInfo instances into the list
after that iterate over the sorted list and add the items into the inventory
@eternal night i tried something like that
private void sortFriendsInfo(Player player) {
List<String> friends = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(player.getUniqueId().toString()).getValue().friends;
for (int i = 0; i < friends.size(); i++) {
playerInfo = SpigotServices.getService().getPlayerService().getPlayersInfo(friends.get(i));
FriendsInfo friendsInfo = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(playerInfo.uuid).getValue();
list.add(friendsInfo);
list.sort(Comparator.comparing((info) -> friendsInfo.isOnline).reversed());
sendConsoleFriendsInfo(list.get(i));
}
}
would it work tho
where do i put the sort method then
outside the loop ?
no just outside the loop
what is the easiest way to send colored messages to an user?
probably legacy chat colour codes
but am I going to need any dependency on my plugin in order to send colored messages?
na example player.sendMessage("§bHELLO");
player.sendMessage(ChatColor.RED + "This is red");
would work perfectly fine
just legacy 😭
and we all hate old stuff
WHY please surround it with 3 of these > `
yea it would work too but you can also use example player.sendMessage("§bHELLO");
Yes but then you need to know what the b character is mapped to
yea right xD
or you can just use translateAlternateColorCodes
please for the love of god USE CODE BLOCKS
oh, someone already said that
god it hurts
damn chill whats the probleme there
its ugly
very ugly
okay
and hurts ur eyes
is there any way, without plugins, to do something like player.sendMessage("&4This is red")?
and you cannot read it
and why cant you read it
There is 0 contrast and syntax highlighting
do you mean something like /tellraw?
It is good enough for normal message, trash for code
hmm idk what is that sorry
use chatcolor.translateAlternateColorCodes
There are a bunch of message generators out there
well, player.sendMessage would be a plugin in the first place
and why do you ask in #help-development
Install 1.17 with BuildTools: https://www.spigotmc.org/wiki/buildtools/
?eta
There is no ETA. Having an ETA leads to unrealistic deadlines, false hope, and a bad product. It will be ready when it's ready.
@eternal night whats wrong there lmao https://paste.md-5.net/babuyohopu.cpp
this is driving me insane
ive tried clearing dependencies, getting the server in different ways, using different API versions, nothing works
one line java if(plugin.getServer().spigot().getConfig().getBoolean("settings-bungeecord")) {
is there no statistic for pets tamed? kinda surprised
can someone say why this doesent sort my list https://paste.md-5.net/babuyohopu.cpp
Is 1.17 nms out? I can't import it in my plugin
Ofc it's out how else would the server work 👀
lol
How are you importing it
How do i check if i dont get a real offlineplayer from java OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
Wdym?
I mean see if the offplayer is a player because if i enter daosadhasoidhasiodjhasiodhasiodhos it will return an object
NMS aren't packed inside the spigot api, you need to import the actual server jar to get the nms
It used to be like:
import net.minecraft.server.v1_16_R3.*;
But I cant import 1.17 one. It should look like import net.minecraft.server.v1_17_R1.*;
EzBedwars I believe you could just use some regex to determine if the name is valid
guys can someone give me link to the best plugin for OnePlayerSleep-1.17?
I have
nms package versions don’t exist in 1.17
It uses the official package names now
Ohh. There's no NMS versioning any more. It's back to the old way.
So how do I import it?
You just use the new package names
Look at the package tree and you'll be able to know what to import
guys can someone give me link to the best plugin for OneSleeper-1.17?
Wrong Channel
You need #help-server
ohhh wow
Lets say I am pushing values into a ConcurrentMap frequently. If the Map already contains a key, I'd preferably not push the value into it (to save performance), because the values are always the same.
Is it worth checking if the map already contains the key? (performance wise)
I read a stackoverflow page, someone said for a normal Map its not worth it, but for ConcurrentMap its a different story
Does anyone know why? and can they confirm that this is true?
putIfAbsent exists right?
🤷♂️ Maybe you could make a performance test
Hmm thought it had a special implementation to avoid unnecessary locks
But yeah putting an entry in a concurrent hashmap uses its internal locks so might be worth checking contains
okay so turns out sound group for blocks is implemented really poorly
so do i use putIfAbsent
it only exposes the pitch/volume of the step sound of all things
Yeah I think that’s best retrooper
Ok Conclure
is there a non-NMS way of playing a block break sound properly?
Thank you for your assistance Conclure.
with the correct pitch
what api version were you using? i have almost the exact same implementation and it still isnt working
was it removed? whats the alternative?
He want's the spigot config
I'm using 1.16.5
how the hell would I do this
does anyone know why my list isnt sorted
private void sortFriendsInfo(Player player) {
List<String> friends = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(player.getUniqueId().toString()).getValue().friends;
FriendsInfo friendsInfo = null;
for (int i = 0; i < friends.size(); i++) {
playerInfo = SpigotServices.getService().getPlayerService().getPlayersInfo(friends.get(i));
friendsInfo = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(playerInfo.uuid).getValue();
list.add(friendsInfo);
}
FriendsInfo finalFriendsInfo = friendsInfo;
list.sort(Comparator.comparing((info) -> finalFriendsInfo.isOnline).reversed());
sendConsoleFriendsInfo(list.get(0));
sendConsoleFriendsInfo(list.get(1));
}
?paste
in a codeblock, preferably
code 👏 blocks 👏 please
wdym how
youve been told twice now
What would be the best way of making an update to a plugin that adds a new config key, and doesnt require resetting the config
```java
your smelly code here
```
code go brr
yeah that
Add a system to parse and reset all values
i cant screenshot yet on linux ;(
np pal :)
you are so funny
so since Server.spigot() just straight up doesn't work, how would I go about getting the Server.Spigot instance
thanks
why does Server#spigot not work o.O
good question!
what are you trying to do?
no like, what is the error
compile time error, not found
see if the settings-bungeecord key is true
getConfig is a method of Server.Spigot
@eternal night why isnt that working https://paste.md-5.net/babuyohopu.cpp
Method in method
@dusty sphinx can you show me your pom.xml ?
I can compile a test plugin calling this method perfectly fine
works fine for me too
already shared it
im using API version 1.13-R0.1-SNAPSHOT now, but i had the error then too
im not sure what is happening
any specific errors when running mvn package ?
als @lofty junco ```java
list.sort(Comparator.comparing((info) -> finalFriendsInfo.isOnline));
okay how can i fix it
finalFriendsInfo.isOnline is the same for every element
info is the placeholder for the lists contents
in your case
huh. Maybe you have a screwed up local repo ? Could try to purge the spigot api artefacts
Does anyone know how to get spigot 1.0.1
already cleared ~/.m2
tried building under windows, same thing. tried building under wsl, same thing.
any other dependency in your pom that exports the same class ?
you have left out a bunch
👍
how can i write it without the Lambda
How can i get all items from shift-clicking while crafting
Because i have a plugin that adds lore to a crafted item
But if you shift click multiple stacks
it breaks
Anyone know how can i make something like spawn void that if you fall into the void youll be teleport to spawn
just check for damage type
first bit of void damage, teleport them and cancel the damage
I dont want players to get damage
Hence the cancel
Hey there, when a scaffolding block is broken, is the BlockBreakEvent called for every block broken as a result?
don't think so
It should but don;t count on it. It may just trigger through a physics update.
if i have two instances of the same event can it be the cause of above, or what does this want to tell me
no
read the full error you have a null somewhere
look through the stacktrace until you find a mention of one of your packages.
The first one mentioned will list the class and its line number
Also checking, it's safe to cancel a physics event? (In this case a breaking scaffolding block)
yes you can
Sweet. Thanks
I think there might be some client desync for falling blocks
oh yeah right im actually dumb since that error message is completely from another thing, still quite confused i am, well whatever, ill have to mess with it more
Learning to read a stacktrace is like a god power for a Java dev.
ture lol
its just that i cant get a thing to work in period of last two days, thats what is mildly infuriating, and the 30degree celsius temperatures are also killing me since im living on the top floor
is there a command for changing @p (closest player) gamemode
yes, "/gamemode @p <gamemode>"
It's good but i don't want to teleport players from y -50
That exactly what you asked how to do
I mean thanks for help but how can i teleport player from +5 and lower to spawn?
.
What should i check?
Is it recomended to do that?
Its a heavily used event though and should be used carefully.
I want to use less server resource
then detect void damage as I said earlier
Those are your two choices
Do you know how to that?
yes, PlayerMoveEvent
And?
Hm, cancelling the physics event does not stop the block from breaking 🤔
How can i check if player is lower than +5 Y
if (event.getTo().getBlockY() <= 5)
Oh Thanks!
learn java
sorry sec
fixed
loadbefore acts like an inverse depend
if you have a dependency, that dependency will be fully loaded before your plugin loads
Try BlockFaceEvent @lunar schooner
it will also be fully loaded when your plugin unloads
therefore the inverse would imply that a loadbefore will not be loaded when your plugin is loaded
is there a way other than using singletons to expose my plugin's api to other plugins
maybe through di?
and that the loadbefore would not be loaded when your plugin is unloaded
that is, it gets unloaded first
bukkit has a service manager
you can register an implementation instance for you API interface
is there a specific way to find the location where the dragon egg spawns after killing the dragon? or would i need to find it manually?
I'm making my first plugin and i get this error:
org.bukkit.plugin.InvalidPluginException: Cannot find main class
You sure about that one? I cant find it in the javadoc 🤔
perfect thanks
BlockFadeEvent ?
Yep thats it
I can see it o.O
Though that doesnt appear to be the correct event
give it a try ❤️
I just mean, looking at the docs I dont think it applies to scaffolding 😅
yeah but looking at the source it seems like it
the docs sux
Odd though that cancelling the physics event does not work
I'm making my first plugin and i get this error:
org.bukkit.plugin.InvalidPluginException: Cannot find main class
Can someone help me please? Because nothing in my plugin loads.
is it possible to acces the data from a config.yml using another plugin? for example
join plugin
message plugin
messages plugin creates the message "Welcome"
and then join on join event takes the message created by message plugin and then sends this
and use that concept for multiple plugins
to they all share 1 messages plugin
and if you edit the message in the config file of the message plugin
they all change
It's working!
OfflinePlayer target = Bukkit.getOfflinePlayer(clicked.getItemMeta().getLore().get(0).split(" ")[1].split(".")[0]);``` If the lore is `Ban Ezbedwars.` will this get ezbedwars?
can my spigot plugin have a constructor with no parameters?
@eternal night seems you're right 😂
oh wait nvm doesn't matter anyways
perfect xD
your main class? yes, the main class must have a no-args constructor
no better docs than the source code
can someone tell me how to write this without lambda list.sort(Comparator.comparing((info) -> finalFriendsInfo.isOnline).reversed());
why do you want to get rid of lamda here 😭
to test something pls tell me 😦
does the new version of windows make f5 work for the networks menu
because I don't know of any way to refresh the fucking network list
you can always implement a lambda as an anonymous class
I gave you a link with an example of using a Comparator to sort a List.
yet another thing that win8 actually did better than win10
everything just gets worse every year
your code doesn't even sort anything poxh
how can i prevent water from flowing out of a region with Worldguard?
if you want online people first, you'd have to compare the info isOnline value
how do i make a sword that when you block it , it shoots like a lightning where your curser is
like hypickle
Now I'm curious if this also applies to things like e.g falling sand
Just listen to interact event,do ur checking,call gettargetblock call a lightning on it
no I don't think it does
the block doesn't "fade"
it is just converted into a falling entity
So PhysicsEvent wouldnt work there either.. damn
Are you trying to prevent scaffolding falling?
Sand, in this case
When specific conditions are met, the sand shouldnt fall 😄
Hm maybe I can change the block data to have it not falling? 🤔
on block break, test the block above it. If its sand, cancel the event, set the Broken block to Air (without physics) and manually drop a block as loot.
yes it would
Not if the sand block falling isn't directly a neighbor to the block broken, afaik
you test whatever direction you want to detect sand
This is what I tried in a BlockPhysicsEvent, however it does not work
//We don't want gravity blocks to fall when they (could) have a torch attached/ontop
if(event.getBlock().getType().hasGravity()) {
if(!Common.checkSurroundings(event.getBlock().getLocation())) {
event.setCancelled(true);
}
}
not in physics, do it in block break
Yeah I don't think there is an event that fully cancels sand falling
block break definitely is not called when sand falls
you don;t detect each block falling, you detect the supporting block break
aah
Then I'd need to do massive amounts of calculations to figure out if a sand block is attached that could fall though
I mean, that gets you in the same trouble as PDC on blocks
Id think there would be a more efficient route
you only need test in each BlockFace
I assumed he only wanted to prevent players breaking blocks causing sand to fall
No, all sand falling in general (Under specific conditions)
Hence why I was looking at PhysicsEvent 😄
Yeah there isn't any event for that
would kind of be an issue because it would be called each tick
if the sand block is eligible
Yeah, in that case Physics is your only option
physics is not called for a sandblock falling is it
it will be triggered by a physics event
idk I am looking at the source rn
each falling sand block fires a physics event to all neighboring blocks
Yep can confirm
that ? xD
That a falling sand block triggers a Physics Event
ah perfect
now just the question of how to properly cancel the thing, since event.setCancelled(true) doesnt do a whole lot of anything
Can any1 help me?, I put my Ip address in server ip, everything normal, but when I put an Domain in, It always says Failed to bind port
Correct, that field only accepts ipv4 and ipv6, it's the bind-address.
Though this is more something for #help-server
You need #help-server
I'm updating a plugin of mine that uses a custom inventory menu thing, but it is crashing the server whenever i try to open it
I did a bit of testing and found that it crashes right when it actually runs the player.openInventory function
I can't exactly find it. If I sent a whole pom, would it help?
https://paste.md-5.net/vekepusezu.xml
I should mention that I'm creating a version of VentureChat that doesn't depend on certain parts of spigot
Hmm, concerning you have two legacy things there, not much I can really guess.
Maybe run mvn dependency:tree to generate a full dependency tree
if craft bukkit shows up there somewhere
you might be in trouble xD
vault hmm
thats just about the only thing i see that could possibly cause an issue
i dont know what i did wrong https://paste.md-5.net/hawasiseko.cs
Yeah
vault seems to be providing bukkit
for whatever reason
try to exclude it
I don't know if this is weird behavior or if I'm misunderstanding something. I'm trying to get the type of inventory that an item is being placed into:
holder instanceof Player works
holder instanceof Chest works
holder instanceof EnderChest does not work
event.getInventory().getType() == InventoryType.ENDER_CHEST works so it's not a big deal but i'm curious as to what i'm misunderstanding
ah, okay, great. that's good with me
thanks!
easier to check against a list of inventory types from config this way anyhow 👍
java.lang.NoClassDefFoundError: org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap
out of one issue into another
i think this one may have been present before though
what is throwing this issue o.O
let me get the traceback
oddly
doesnt happen in versions earlier than 1.17
just works
or maybe
Yes 1.17 changed a bunch of the server internals
Can anyone show me how I can customise tab, or link me to a tutorial? I've looked online and can either only find plugins or find tutorials which just deal with headers/footers and I would like to be able to do complete customisation
i should elaborate
when the plugin is compiled with jdk 11 it raised the exception
but when it was compiled with jdk 16 it seems to work
¯_(ツ)_/¯
im going to keep testing to see if its actually something else
wait 1.17 using java 16??
yes
cool
cool until you try to port your plugin to 1.17
You don't need to compile for java 16 for it to work on java 16
yeah that's probably a headache
Java is backwards compatible
You can run code compiled for java 7 on java 16 if you really want
i still dont know why, thats just the working theory
should nonetheless
still testing
can anyone help me with this?
Player#sendPlayerListHeaderFooter
Java 16 is pretty awesome tbh, so much better than the ancients of J8
And you can use the scoreboard and teams to set player prefixes and sort tab
100%
Is java 17 when we're getting the simd stuff?
Should be promoted to stable then, since it's been incubating in J15 and J16
what does it do?
simd stands for Single Instruction Multiple Data
They're instructions that exist in most modern CPUs
That allow it to process much larger amounts of data in one clock cycle
For example, you could add to as many as 8 32-bit ints at once
Or move them
😮
You should always use System.arraycopy when you can because its native implementation uses simd
But this api will allow you to use all sorts of simd stuff
And it will fallback to scalar operations if there's no support for simd
Isn't it mainly vector API ?
Which is so much better than how C++ simd intrinsics work
oh yeah we are getting/have gotten Vector :pogg
abolish the bukkit vector
and record classes!
whats that project valhalla?
generics overhaul and value types
oeh that sounds pretty neat
Project valhalla has me drooling
But god it seems like we're never gonna get it at this rate
what I would love for Java to get is Rust's enums
they're the best thing ever
though I doubt we will
I mean. You can very much create those yourself
eh
can you recreate ```rs
enum Option<T> {
Some(T),
None
}
If they fix it with project valhalla, java will be substantially better
And also faster
technically I guess you could with some fun instanceOf crap
that would be awesome
thats pretty neat
no more auto-unboxing npes
so I then wont need my helper methods to go from List<Integer> to int[] anymore :"D
And we won't need shit like DoubleBinaryOperator
JEP was closed
I havent ever worked with that one I think
Yeah the good DoubleStream needs it
Because it's much faster than what I was using
most of my stuff nowadays I do in rust, only thing that I still do in java is PDF generation and spigot plugins lol
I was using BiFunction<Double, Double, Double>
math parser xD
lol
library is for books
I'm honestly fine with stuff like IntStream
Cause they provide extra functionality specific to ints
range, for example
And sum
Though sum is just the same as reduce(0, (a, b) -> a + b)
yea
It's still nice though
https://paste.md-5.net/anoxihojer
okay so
my server is crashing when trying to open a custom inventory menu
i debugged a bit and found that it crashes right when it runs player.openInventory
i was a fool
i instinctively yupped for i knew it was recent but then realized
probably not latest
Im not running latest either, I update the thing once every couple of days
i dont need to redownload buildtools right? just re-run it?
yup
rad
hahaha
who uses degrees
how to ban people from spigot discord for saying something unacceptable
like e.g calculating all (x, z) on the edge of a circle required radians
man it sure is cool how i was using paper in my development environment and not spigot
5head
well it depends I suppose, if I'm working with trig functions I do tend to use radians
Of all the things they teach in math class, trig is the only thing ive actually used in code 😂
yeah it depends on the situation whether i use radians or degrees
Yea was about to ask what your cos of 90 is doing for you lol
yeah not much good lol
if its like. precise angles that're like, semi-arbitrary, i'll go with degrees
for trig stuff, usually radians
but personally i havent really done anything with angles in code
https://github.com/TheDutchMC/HaroTorch/blob/v2/src/main/java/dev/array21/harotorch/commands/torchSubCmds/HighlightAreaOfEffectExecutor.java#L258 this is the only place i've used trig in code
or anything i've learned in math class for that matter 😂
known paper mapping issue, oh well
at least it works in spigot
and it will eventually work in paper
Yeah give them some time, they have a lot of remapping things to fix
question, is there not just a library or anything out there to take care of serializing/deserializing all the things? Like Itemstacks n such? Cos it's a pita
Put an itemstack into a database
itemstacks are really easy to use and handle
hi everyone, im asking for a few tips, in my project i have a minion class, i have to save the Minion class every 5 minutes or so, the only thing is that if the server goes down and you put it back up i have no way on getting the player since its offline, how could i go around it?
There is no Player object for offline players
that is sad
i need to save the player somehow
since i need it for the reward system etc.
you could save the info in the config file
im doing it
what i have is something like this
data:
count:
uuid:
location:
sadly tho i load the data on start and getting the player by UUID can return null
so i don't know how to actually save the player
if you are saving the info in a list you could save the list
go 1 by 1
and when you load it
you make sure theres no problem
you can always get an offlineplayer but they have to be online for there to be a player
wdym
as I said, you can;t
we need a work-around
there is none
impossible.
ig you are gonna have to edit how you use the minion
at this point don't tell me i have to load data on player join
or whats requesting it
no you cna load it when you want, you simply can;t get a Player. Only an OfflinePlayer until they login
still tho i tried using offlineplayer here but didn't work
still gave me a NPE
yes, because you still tried to get a Player from the OfflinePlayer
Is there a way to stop a teleportation ?
and what should i get instead?
You use the OfflinePlayer. Nothing else
I don;t care
wtf
Cancellable#setCancelled(true)
cracked = no support
sad
I don't seem to be able to do Cancellable.setCancelled
hmmm yes today i will do Cancellable.setCancelled and expect it to work
Cancellable is an interface
implemented by certain events that can be cancelled
i.e. PlayerTeleportEvent, EntityTeleportEvent
Man why are you so annoying
Cancellable is just an interface implemented to cancellable event classes
You would use event.setCancelled(true)
Or whatever you’re calling your event
the # i used above indicated that the setCancelled method was to be used on an instance of an object that implemented the Cancellable interface
he's a beginner, I don't think that he would understand that tbh
Please let me know what makes you think I'm a beginner
From your actions lol
We all makes mistakes but that doesn't mean that I'm a beginner
i said it
i assumed...
because those actions are most likely to be caused by a beginner in java
i am not insulting you in any way
so hasPlayedBefore() for some reason isn't working, or i'm using it wrong
What event is run when an anvil breaks?
what version, how are you using it, etc
I need 1.17 get Item
1.16.5, and using it in PlayerJoinEvent
so use buildtools
before i get error Caused by: java.lang.RuntimeException: Failed to find NMS class: Item
OfflinePlayer#hasPlayedBefore?
@EventHandler
public void join(PlayerJoinEvent e) {
if(!e.getPlayer().hasPlayedBefore()) {
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String cmd = (Main.command).replace("$$P", e.getPlayer().getName());
Bukkit.dispatchCommand(console, cmd);
}
}```
hmm
guys (
it kinda seems to me like when the player joins it would create that data
but has it worked before?
how does it detect if a player has played before? i don't have an alt but i deleted the usercache and playerdata folders
no
whether or not the player data exists, probably
i deleted that and the command still didn't run
did you register the listener
yes
any clue what event runs when an anvil breaks or should I attempt to find it manually?
it worked before without the online check
block break event?
played before check*
Isn't that for players mining blocks though?
not the anvil actually breaking (through the whole damaging stuff)
I don’t think there is a specific event for that, surprisingly
time to resort to NMS to fix dupes
hmm
i mean
nms
BlockPhysicsEvent probably works
playerdata only gets generated when a user leaves or the server is stopped or /save-all
it's called for almost everything
what about BlockDamageEvent maybe?
heeeelloooooooooooooooooooooooooooooooooooooooo
goodbye
that might actually work
no, BlockDamageEvent is for player damaging