#help-development
1 messages · Page 1746 of 1
I need to detect it as soon as the air bar apperas on the client
just read it. easy
I believe as soon as your head goes underwater you lose your first tick of air
hmm, ok, I'll try it
but ticks should be exact enough even if you lose the first tick right after you go underwater
if (new Data().getPackageCount(String.valueOf(player.getUniqueId())) == null) {
new Data().setPackageCount(String.valueOf(player.getUniqueId()), 0);
}```
im getting a npe from this which doesnt make sense
why are you making a new object twice in comparison
because i cant develop correctly 🤪
you're so quirky 🤪
still shouldnt affect the outcome
what did I do wrong?
https://gist.github.com/ItzJustNico/619ca884137564c986c758062dd600ca
you are running 1.16 but the api version is 1.17
what do I need to change then?
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
I got it like this tho
in the plugin.yml
Ah will try that thank you
now I get this one:
https://gist.github.com/ItzJustNico/619ca884137564c986c758062dd600ca
it should be 1.16
okay wait
Yeah I got that haha
you're compiling with java 16 but you're using java 8
how can I fix this?
send your pom
Okay I will try that thanks
Yes it worked thank you a lot
Hello there
I want to ask for the best way to organize + optimize checks in InventoryClickEvent
I have like 20 if statements to check for the current item and handling the click
Is there any easier way to do that ?
I would to use switch statement but I can’t find the difference between it and the “if else statements”
Yes. You want only one single listener that has almost no logic in it.
Delegation is the keyword here. You should implement a way to check if the clicked
inventory is a custom inventory and then delegate the event to a handler for this inventory.
if - else chains are almost never a good option since we now have functional interfaces and hash maps to
route our workflow with O(1) complexity. Ill write you a short example.
Yes please write me an example it will be so helpful
Question, I checked if the block state is a shulker box but I want to cast it to a shulker box then open the inventory but the casting part won't work.
This is a lot to take in at first but if you get behind how it works you will be able to write very well designed GUIs.
You will see that you can write 5 different GUIs in like 20 minutes.
https://gist.github.com/Flo0/ddc0ffcad42d0cf95583720a96f0f0e3
What exactly do you cast to ShulkerBox?
what happens if I call hasPemission() with an empty string as a param?
does it always return true or false?
It will always return true
thanks
Thank you I really appreciate it now i can organize and optimize my GUIs by this method
Try to copy paste all the classes and open a new example inventory when a player sneaks. Then you can try and follow the setup.
The Block that was placed. The State of it
Show some code pls.
if(event.getBlock().getLocation().getWorld().getName().equalsIgnoreCase("MiningZone")) {
if (event.getBlock().getState() instanceof ShulkerBox) {
ShulkerBox box = (ShulkerBox) event.getBlock().getState();
event.getPlayer().openInventory(box.getInventory());
event.setCancelled(true);
}
}```
there
This works for me:
@EventHandler
public void onPlace(final BlockPlaceEvent event) {
final Block placed = event.getBlockPlaced();
final BlockState state = placed.getState();
if (state instanceof ShulkerBox box) {
event.getPlayer().openInventory(box.getInventory());
event.setCancelled(true);
}
}
public void consumeCustomArrow(Player player, CustomArrow customArrow) {
Arrays.stream(player.getInventory().getContents())
.filter(itemStack -> itemStack.hasItemMeta() &&
itemStack.getItemMeta().hasDisplayName() &&
ColorTranslator.translateColorCodes(itemStack.getItemMeta().getDisplayName()).equalsIgnoreCase(ColorTranslator.translateColorCodes(customArrow.getArrowType().getDisplayName()))
)
.findFirst().get().setAmount(Arrays.stream(player.getInventory().getContents())
.filter(itemStack -> itemStack.hasItemMeta() &&
itemStack.getItemMeta().hasDisplayName() &&
ColorTranslator.translateColorCodes(itemStack.getItemMeta().getDisplayName()).equalsIgnoreCase(ColorTranslator.translateColorCodes(customArrow.getArrowType().getDisplayName()))
);
}
Bruhhh..this is a total mess and i cant figure it out. Basically I need to search the player's inventory for the specific item, then reduce the amount by 1
trying to use streams instead of just a for loop
Dont use the names if ItemStacks for that. Imagine if someone just renames it. PDC is the way to go here.
NBT injection
the displaynames have colors tho u cant color things with anvils
But you can fk up already obtained items
ItemStack multiArrow = ItemUtils.makeItem(Material.TIPPED_ARROW, ColorTranslator.translateColorCodes(ArrowType.MULTISHOT.getDisplayName()), ColorTranslator.translateColorCodes("?B558Upon firing, splits the single arrow into 3"));
PotionMeta multiMeta = (PotionMeta) multiArrow.getItemMeta();
multiMeta.setColor(archery.getCustomArrowManager().getCustomArrow(ArrowType.MULTISHOT).get().getColor());
multiArrow.setAmount(amount);
multiArrow.setItemMeta(multiMeta);
can't get PersistentData of itemstacks?
ItemMeta is instance of PersistentDataHolder
ah..alright
also is there a better way to do this..? I need to set the Color property of the arrow and you cant do it with itemmeta so I gotta use potionmeta for it
hi i'm disable-player-collision For The Server Help me
Hello disable-player-collision For The Server, what can we help you with?
hey 7Smile - how to pronounce dijkstra - “dike struh” or “deek struh”
Does cancelling bow fire event still make it consume arrows..? it is for me
the fk should i know? Thats note even remotely close to any language i speak...
lol
anyone know how I can handle large amounts of tnt for my factions server
like does each world have its own thread ?
can i do that
not without a lot of effort
asking again bc cant test it rn, does a PlayerToggleSprintEvent get fired by calling Player#setSprinting
or only when player does it themselves
Every time i see a graph i just throw A* or Theta* at it XD. So probably not from me.
Only if you have each world on a different server. Which is totally possible.
@lost matrix Would you have any idea how to make it so when I shoot a bow, it doesn't just consume the first arrow it finds in my hotbar..? cancelling bow fire still consumes and so does setConsumeItem(false)
But you can simply configure how much tnt should be calculated per tick. This will greatly reduce the lag caused by tnt.
is there a way too make it so all tnt actions except the damage to blocks async ?
So setting EntityShootBowEvent#setConsumeItem(boolean) to false does not prevent the arrow from being consumed?
No
I could talk about how tnt is technically handled async if you set the tnt per tick value low enough but
thats probably not what you mean by "async". Just lower the setting in you spigot.yml and your problem is solved.
@EventHandler
public void onBowShoot(EntityShootBowEvent event) {
event.setCancelled(true);
event.setConsumeItem(false);
}
legit like
bruh tf
Same for me. Looks like a bug.
githuib isuseusi time
Wait now it works for me...
Try this:
@EventHandler
public void onPlace(final EntityShootBowEvent event) {
event.setConsumeItem(false);
if (event.getEntity() instanceof Player player) {
player.updateInventory();
}
}
@lost matrix how to disable player collision movement player help ?
Scoreboard teams
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
@lost matrix with use plugins work ?
This channel is for development related questions
its not work
Hi, does anyone knows how to change attributes through packets ?
Like the max health etc.
I need it to change the attributes of an EntityPlayer spawned by packets
The goal would be to set the max health to 0 to remove the rided entity health bar
iirc you need to provide an int as the entityId and a List
never used it tho, cant help much
No problem, thanks anyway ^^
I've made plugins before, no idea why spigot won't recognize this one
when i start up my server, it just doesn't load my plugin at all
theres my file structure
errors?
nope
[16:25:30] [Server thread/INFO]: Time elapsed: 6247 ms
[16:25:30] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end
[16:25:30] [Worker-Main-6/INFO]: Preparing spawn area: 0%
[16:25:30] [Worker-Main-10/INFO]: Preparing spawn area: 0%
[16:25:31] [Worker-Main-10/INFO]: Preparing spawn area: 43%
[16:25:31] [Server thread/INFO]: Time elapsed: 1381 ms
[16:25:31] [Server thread/INFO]: [PlugMan] Enabling PlugMan v2.2.2
[16:25:31] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[16:25:31] [Server thread/INFO]: Done (23.762s)! For help, type "help"
is it red?
it enables plugman but not mine
in /pl
I suspect that there is an issue in your plugin.yml, especially with the command
no
if that was the case, it would throw an exception
do u have the plugin.yml included in the artifact output:
i think so
Look in your jar (use an unzipper) to see if there is the plugin.yml
k gimme a sec
unrelated to your issues, but don't call your main class main
call it the name of the plugin
yup its there
why? is it just convention or something
yep
oh k
Have you started the right server ? I mean, it's in the good folder and you're opening this server ?
stupid question probably but is the plugin in the right folder
mhmm
and also did you restart
nope
when i try to delete the plugin while the server is running it doesnt let me
because its in use
so the server is doing something with it idk
are you sure there is nothing in the console
i dont see anything
PlugMan 
i mean as long as it's a small plugin
but when u have dependencies always restart
ye ye
you probably can tell why
hopefully yes
uhhh
you need to register the manhunt command in plugin.yml
also fyi TabExecutor exists
that needs to be in onEnable
what manhunt command
No need to use setExecutor if it’s just going to be the plugin instance itself
wait god damn im an idea i put the wrong command
i meant to put deathswap
but i doubt thats the issue
that is indeed
oh wait
yeah plugin.yml thing
i copy pasted some of the code from my other plugin so
you have deathswap in your plugin.yml and manhunt as a getCommand parameter
yeah i figured
u should be initializing ur command class in onEnable not at the top of the class
why
so i want a UDP socket in my plugin
i kinda just like it this way its neater
how do you construct a datagram socket?
i have this so far
try {
this.inet4Address = (Inet4Address) Inet4Address.getByName("ipstring");
this.datagramSocket = new DatagramSocket(8080, inet4Address);
datagramSocket.connect
}```
idk what to do exactly. i need to read info from a config file for sure
it's personal preference but vivian's way is more explicative to who reads ur code
so anyone can tell immediately that is a command
Set EntityPlayer max health through packets
why am i still getting errors hold up
[16:47:30] [Server thread/ERROR]: Could not load 'plugins\DeathSwap.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.okay.DeathSwap.DeathSwap.getCommand(String)" is null
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[spigot-1.17.1.jar:3187-Spigot-d03d7f1-b8c522d]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.17.1.jar:3187-Spigot-d03d7f1-b8c522d]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.17.1.jar:3187-Spigot-d03d7f1-b8c522d]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:384) ~[spigot-1.17.1.jar:3187-Spigot-d03d7f1-b8c522d]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot-1.17.1.jar:3187-Spigot-d03d7f1-b8c522d]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:995) ~[spigot-1.17.1.jar:3187-Spigot-d03d7f1-b8c522d]
public class CommandListener implements CommandExecutor, TabCompleter {
private DeathSwap deathSwap;
private String helpMessage;
public CommandListener(DeathSwap deathSwapClass) {
deathSwap = deathSwapClass;
deathSwap.getCommand("deathswap").setExecutor(this);
// ...
yup
main: me.okay.DeathSwap.DeathSwap
name: DeathSwap
version: 1.0
author: okay
api-version: 1.17
commands:
deathswap:
Hey everyone, just a question as I'm wondering if this is even possible... can you add items to MC with plugins in a way other than changing existing items or using OptiFine CLI to render custom models?
You can't change existing items either
that crashes the client
It's very possible with a texture pack
I mean I know with a resource pack you can reskin ingame items and give them custom data. But I was wondering if I could say, add a new armor set without needing to reskin an existing item.
commands:
GiveHunterNote:
description: Gives you a hunter rank note!
try adding a description
also
getCommand("GiveHunterNote").setExecutor(new GiveHunterNote(this));
also put it in your main class
Yes you can
With a texture pack
and a usage
usage: /<command>
Is there a guide somewhere you can link me by chance?
Wynncraft has thousands of custom textured sets
with a texture pack
You cant change an armor items model with a texturepack sadly
its amazing
then ur outta luck idk
wym?
then
how you do it
So if I understand correctly, you can add custom items with a resource pack to give it a texture?
Armor Models cant be changed .-.
ik
yes
Then how does cosmicpvp does it @ gardian
and you don't have to reskin existing in game items?
provided its configured correctly
Using something with item durability then it's possible
So I can add my own custom armor sets with a plugin?
and not have to be rid of existing base MC ones?
It only reskins items with that custommodeldata which is set via a tag
regular armor has no cmd
Oh ok. So give the item a custom NBT tag, then set the plugin to add the necessary things/textures to that item with that specific tag?
If you want to have custom armor then you need to generate player skins. But you will need quite a bit of clients for that as every combination of armor
items has to be generated. This means that 10 armor sets need at least 10.000 generated skins.
what?
Yeah.. what?
Which requires about 8 - 10 player accounts
alternatively make the model urself in blockbench??
theres a resource online that generates skins lol
But this changes the player skin based on what armor they are using no?
no
this is what I believe you want
having like 500 armour sets
with different models
Yeah i also use that. But im not sure if they like it when you just generate 10k skins on their site ^^
rate limit go brrrr
So it changes the Armor texture applied to the items when a player is wearing it?
Armor items are not used at all. You need to change the skin of a player.
Ohhh I get it. So the player isn't actually wearing the model. The texture is applied to their skin?
Right
Hello, I'm Geegaz ! As you may know, the first snapshots of the 1.14 introduced a new format for the JSON item models custom model data . It's also a...
Was wondering how to use the method #setCustomModelData(Integer data) Not sure what the parameter "data" would be for this method.
1 vote and 8 comments so far on Reddit
Thanks!
Does anyone know a up to date api for getting input through a anvil or sign? I tried like 3 or 4 of them but all they did was just produce errors I couldnt make out.
it shouldn't be hard to make one of them, just use a packet listener
both should have an event anyways
It's probs your version
what ver u using?
1.17.1
yeah they probs not on that
can someone help me get eclipse setup with the buildtools library added
and they said it was for 1.17
eclipse 🤮
start here
intellij is way better in my opinion
???????
how is eclipse better then intelliJ
intelliJ is better in EVERY way
Nah I just like annoying people
:3
truth is I don't have much experience with either
Well then you should learn java
before spigot
spigot is a java api
I thought spigot was a c++ api
hello! why does my plugin say Process Terminated when i build my plugin?
what compiler?
pom.xml
ye
?paste
the error is Process Terminated
are you clicking the big red square after you click build 
means ur not good enough
yes just Process Terminated
be nice to your ide next time
WHAT DID I DO?
i tried tehe

pls help me i have been working on this plugin for almost 3 months i do not want to lose it! PLSSS
you wont loose itr
ok
it's not going to self destruct lmfao
so should i give you some context and what i have been doing since the last time it actually worked?
also you should have it on github
this might sound dumb but i have never used github
you should learn it, it's very useful
have you tried deleting your .m2?
.m2?
what will that do?
also just look on stack overflow I can see alot of "processes terminated errors"
what was it?
i was missing an > on one of my dependancies...
that wouldn't return "processes terminated"??
it did
well i added that and it built just fine
ok
u2
player move event LOL
PlayerChangedWorldEvent I think
yeah that
wait ahh
i have code below:
@EventHandler
public void onWorldChange(PlayerChangedWorldEvent event) {
System.out.println("onWorldChange executed.");
currentWorld = event.getPlayer().getWorld();
Player player;
player = event.getPlayer();
if(currentWorld.getName().equals("bwlobby"))
{
System.out.println("worldislobby executed.");
PlayerInventory inv = player.getInventory();
inv.clear();
ItemStack compass = new ItemStack(Material.COMPASS, 1);
ItemMeta im = compass.getItemMeta();
im.setDisplayName("§6Game Navigation §7[Use]");
compass.setItemMeta(im);
inv.setItem(4, compass); //Slot 1 = 0
System.out.println("item given executed.");
}
}
but it doesnt work as well
i wanna check if player moved to world bwlobby
and if player moved to world bwlobby, player will be clear inventory and given a compass
how can configure git for avoid making .patch with "line separator difference"?
but when i try the move player to another world, the System.out.println("onWorldChange executed."); dont even be executed
which mean the onWorldChange() function is not even called
then you didn't register teh Listener
uh how
im new
in spigot development
in your onEnable you should register your listeners
registerEvents(new ListenerClass, this)
just like this?
look up the correct code, thats just a snippet
u mean onWorldChange(new PlayerChangedWorldEvent, this);?
br ;-;
lemme search real quick
google "spigot registerEvents"
oh so i have to create a new class that implement listener?
yes
yes
error
Main extends JavaPlugin, implements Listener
public final class Main extends JavaPlugin implements Listener
oh , i just press Make 'Main' implement org.bukkit.event.Listener
lol
alright thats all right, lemme try
ok my code mostly worked
so i moved myself to world bwlobby
and these log is given
24.10 21:14:17 [Server] Server thread/INFO onWorldChange executed.
24.10 21:14:17 [Server] Server thread/INFO worldislobby executed.
24.10 21:14:17 [Server] Server thread/INFO item given executed.
BUT
i didt get my item
code inside the function:
System.out.println("onWorldChange executed.");
currentWorld = event.getPlayer().getWorld();
Player player;
player = event.getPlayer();
if(currentWorld.getName().equals("bwlobby"))
{
System.out.println("worldislobby executed.");
PlayerInventory inv = player.getInventory();
inv.clear();
ItemStack compass = new ItemStack(Material.COMPASS, 1);
ItemMeta im = compass.getItemMeta();
im.setDisplayName("§6Game Navigation §7[Use]");
compass.setItemMeta(im);
inv.setItem(4, compass); //Slot 1 = 0
System.out.println("item given executed.");
}
try at the end an inv.update();
u mean add
I assume your inventory was cleared
in that world its always empty? do you have some other world inventory management plugin?
ye
perworldinventory
but it doesnt block me doing this i guess..
then it will be that which is causing your issues
You have discovered the wonderfull world of event priorities
but my other plugin work fine with that perworldinventory
your plugin needs to run this event after yoru per world inventory plugin runs its own
lets solve this first?
ye ik
lets add a sleep() function
lemme google search
yeah, the code is actually player.updateInventory()
no sleep
never sleep
these events have a priority system already
you just have to set yours to run later
how
priority?
Its been a while since I played with priorities
eventPriority iirc
Does anyone know how to make an explosion particle at the players position? I cant find a good one.
(kotlin)
Maybe it is just priority, idk
this cannot work?
Bukkit.getScheduler().runTaskLater(plugin, () -> {
// code
}, 20L);
you could run it delayed, yes
ok but what should i replace with the Bukkit.getScheduler().runTaskLater(plugin, () -> {}, 20L);?
The problem with priority is a lot of plugins like to use highest
it say plugin name in google
coll is correct @EventHandler(priority = EventPriority.HIGH)
And then you can't go after them
oh so i use this?
Anyone?
you can use your task, just replace plugin with this as you seem to be using a god class
a waht class??
a God class is a class you put everything into (common for beginners who don;t fully grasp the OOP design).
oooh
oh yea
the 20L mean what
ms?
or second?
ticks
oh ticks
How do I adapt my code to work with the new method? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#setPlayerListHeaderFooter(java.lang.String,java.lang.String) Code: https://pastebin.com/gjqnDiaE
20 game ticks to a second
yes, my minecraft expirience is not that bad les goo
imma put 10L and see if its enough
1-5 shoudl be enough
Is there any good way to make sure your events go after other plugins that are using HIGEST
I guess you could softdepend on them
this is an un cancellable event which means its already happed, so very minimal delay would be needed
My sbs usually update every 2 ticks (assuming there is something to change) and there is no lag
Not really, its a crap shoot
Thread.sleep(100000); then wonder why your server is "crashing"
Not exactly helpful
@ancient plank The server room is on 🔥!!!
I really don't want to have to add specific support for protection plugins
Because they tend to use highest
What are you attempting to do?
The only other is Monitor, and so long as you are not wanting to change the event...
Problem is I generally am
LES GO IT WORKED, thank you so much @eternal oxide
np
is everything we can make using datapacks we can make it in spigot too?
Error:(2, 13) Invalid main class trying to commit the project to github, getting this error
even though
Main-Class: com.squallz.archery.Archery is in fact my main class..
Spigot plugins don't have a proper main class
With public static void main(String[] args)
sooo..ignore the error?
Pretty much
bet
where do you have main-class
when i was trying to commit it opened MANIFEST.MF and had that but i think its fine now
Why do you even have a manifest
Why would protection plugins use highest?
so they could override any action
Anyone how hypixel does their inventory serialization
Yeah but shouldn’t they use lowest so other plugins know not to execute their code if it’s cancelled?
??
They don't want other plugins to be able to un-cancel it
Seems like a dumb way to do it
how do i use player.location and bump it up one block?
a good protection plugin would run on two priorities
Hi prince
Location#add
hi 
player.location.add(0,1,0)
thx
Lowest is generally for permission plugins, so they setup perms first, then protection plugins on low, so they can cancel before anyone else.
The majority of other plugins would run on Normal
When would permissions plugins listen to events?
Lowest
No like in what case
PlayerJoin, change world etc
Isn’t that what other plugins would do? Shouldn’t permissions plugins just keep track of permissions, and other plugins use those permissions?
Yes, which is why they listen on Lowest, so they can update the players permissions before any other plugin needs them
Oh I see
I thought you meant they were like blocking people from joining / changing worlds
I need like
Something between Highest and Monitor
When you can't un-cancel an event, but you can do other stuff
I don;t see why a protection plugin would run on Highest
it should (in theory) run on Low
I second that - any sort of protection plugin should always run on low
Events can then just ignoreCancelled on normal priority
Towny uses high
The towny dev is on crack
🙂
And EssentialsProtect uses highest
Much of the odd priorities is down to the naming. Years ago when we wrote these plugins everyone was seriously confused as to what ran first
Fair
if (!isAcceptingRegistrations()) {
throw new IllegalStateException(
"No longer accepting new enchantments (can only be done by the server implementation)");
👀
thast why people do it using reflection
Compatible but not supported
:D
How should i serialize my players inventory to a string for storing in a database (1.8)
do you want to make an entity pathgoal or an entity itself?
ok lemme find the forum post about it
for the latter, it's extending Entity something
pathgoal is just a method i believe-?
ah, thanks!
(also targetselector is bP in 1.17)
unless you have special source
EntityLiving.targetSelector.a() turns into EntityLiving.bP.a()
ohh
how do i check if a block is in an ocean biome?
while (teleportLocation.getBlock().getBiome().equals(Biome.OCEAN)) {
this is what i got, however it doesn't really work properly
use ==
because a cold ocean biome doesnt count as an ocean
how does that work
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.
I know the difference between == and .equals
so you should know that you use .equals with Strings
and how you should never use .equals with objects
and == with objects
uh what
so you should know that an Enum is an object
I was taught to use .equals as well
only use .equals, .equalsIgnoresCase with strings
it works better, not sure
is there a way to apply creeper shading to a player's vision without having to manipulate packets? I.e. gain the green tint that a player gets from spectating a creeper. The forum posts boiled down to either use packets (https://wiki.vg/Protocol#Camera) or spawn a creeper, set it with no ai and then make the player spectate that somehow.
There has to be a better way to do this
probably a resource pack, considering Super Secret Settings are strictly client side, i imagine your best bet is Packets unfortunately
if you're not using a pumkin you could pack it to look green
its literally from right clicking a creeper when in gmsp, so it doesnt really need to be changed with a pack
I would rather avoid having to use a resource pack as it forces players to load it when they join or download it
yeah, there's no good way then tbh
rip
packets
lmao i am trying to get if mob's health drops below 50% of health defined in confg, how do i do it
if(wither.getHealth() > plugin.getConfig().getInt("Boss.Wither.Max-Health") * (50/100)){
didnt work
._.
If this is built into the game there should be a way to make the client view it. Same as there are ways to make a client see border effects with no border nearby
still doesnt detect deep_ocean as an ocean
if (teleportLocation.getBlock().getBiome().equals(Biome.OCEAN) || teleportLocation.getBlock().getBiome().equals(Biome.DEEPOCEAN) || /*etc*/)
this will not work fyi
and see if it contains the string "OCEAN"
couldn't you do that with the enum?
wdym
no?
i mean like this:
teleportLocation.getBlock().getBiome().toString().contains("OCEAN")
it does, but i just wanna know if theres a better way
50% * plugin.getConfig().getInt("Boss.Wither.Max-Health")
it is kinda same but meh just try that
or just
divide by 2
how do i set a timeout in java? (similar to setTimeout in javascript)
i also want to be able to cancel this timeout
a timeout for what exactly?
for example
if i just want to run a command
and 10 seconds later it says "hello"
and also have it possible to cancel the delay if another command is typed
then it isn't a timeout LOL.
it is in javascript
k thanks
could run a repeating scheduler that runs every second or so
about the cancle
then that checks if the other command was typed
you can check if the player run another command
then just cancle the scheduler
cancel i always forgot...
cancelling it would just not run the code after
unless you want to run the code again in that command but thats just unnecessarily doubling identical code
So i was here a few days ago, and someone reccomended me a new JSON Library, by chance would anyone know the name of it? It was supposed to be better than GSON
Jackson I guess ?
Nevermind found it, was named Moshi i think
Oh o.o
It was a lib that the GSON writers reccomended over GSON, and its package size is smaller
Moshi
So i have no idea how things like this are done, but is there any examples or tutorials online where im able to make something like this:
// Where "Inv" is my custom inventory class
final Inv inv = new Inv("inventoryName")
.onInventoryClick(clickEvent -> { // <- i want to replicate this
// on inventory click, code goes here
});
Basically what I want to do is to be able to make a lambda where onInventoryClick represents the Inventory click event, however i have no idea what this is called to look it up, and there's not really a lot of plugin API's that do this
Is anyone able to point me to any tutorials, or tell me what this type of lambda method is called? Really sorry if this sounds confusing but i saw someones Inventory library do this and i found it rather neat, i know how ide register the InventoryClickEvent and whatnot, but i have no idea how to create the actual method?
Not looking for a spoon feed either i just have no idea what this is called or how its achieved
The most i could think of was making a method that takes an argument of InventoryClickEvent but that didnt really achieve what i wanted
functional interface or "single method interface"
Ty!
Took a little break but got it working, thanks for telling me what that was called Borlea, little messy right now but ill get it fixed up
Is placing spawn egg will call BlockPlaceEvent?
No you are not placing a block
alright, thanks
Hello I am writing a permissions system with paperspigot 1.12.2, i override the hasPermission Method, i need this block that i can use the hasPermission() with player.hasPermission(). Because when i now use player.has... the player variable is null and its not working. The Problem is that CraftHumanEntity not exist in 1.12.2 i think and i dont know how to do that
Why not use Vault or LuckPerms permissions?
hmm okey yes i think i will use LuckPerms
IIRC if you access that Async you will get an error
I think im slowly falling in love with functional interfaces now jesus
My intellij color theme is doodoo tho i need a new one
Can you explain?
Either way i wouldnt cache that cause its called anytime a chunks loaded and IIRC the server automatically caches chunks until they go inactive and then theyre unloaded again
It really depends
Because when a chunk becomes unloaded it also unloads all the entities within the chunk
But if your planning on having 1 mil entities your really better off making a Stacking plugin that stacks mobs
This is the theme I use: https://www.youtube.com/watch?v=p2UR0HxhZto&feature=youtu.be&ab_channel=KodySimpson
In this short episode, I show you how to apply plugins and my custom color scheme to IntelliJ IDEA to make it look really good, since you guys have asked so many times. I hope you like it, this can be applied to any or most of the Jetbrains IDE's like CLion, PyCharm, etc.
⭐ Kite is a free AI-powered coding assistant that will help you code fast...
Im currently trying out the OneDark theme right now, but i just discovered that you can create your own intellij backgrounds....
What do you mean? Like for each team a custom tnt or like a tnt linked to a certain team
Yep
So i kinda make my background a repeating image of my friend, currently awaiting to see how he likes it
Ain’t that gonna give you headache
Lol
Was gonna add a dragon ball z background but...
yeeeeeah
looks like total shit
Lmao
You can use custom textures
Wooo! Custom textures finally :) Since this is my first custom textures video, I made it pretty simple. There is definitely a lot we can do with textures as well as multiple ways to apply it to a player but first, we need to learn the basics. In this video, I explain how a texture pack works, how we make our own, and finally how to apply it to a...
or just straight up custom names if you don't wanna use textures lol
because primedTNT is an entity
That too
Does intellij backgrounds not support transprent images?
what?
They get fed instructions and follow those instructions based on whats happening iirc
xCode dark theme?
try it
ill defo give it a try
Im just trying to get intellij to respect transparency on images
Its kinda doing it but its still not right
I think that transparency is completely the images fault
Idk because ive used about 7 different images now
imagine using a transparency picture instead of a solid color.
Maybe try mine?
Man im just trying to google a simple background image bwahaha
Nah i want it dragon ball z and only a small icon in bottom left to give me some motifvation
lel
Something big like that would distract me 100%
then try the 1st one
the 1st one actually is the same size as discord recommended for avatar icon
it's maybe not that big?
meh still want it dragon ball z
lel
i got the transparency to work a little but it has the little white ridges on it
finally i got an image that kinda works
Am I using this wrong? if (!playerLocation.getWorld().getGameRuleValue(GameRule.DO_MOB_SPAWNING)) continue;
what does continue; do?
foregoes adding a location later in the code
I've never checked gamerules before so I'm not sure if my use of that check is correct
oh I see
I've been lied to by a user
never mind
what part was the error?
So, i'm making use of the "onWorldSave' event but it turns out, it gets called multiple times when the server saves. Is there an event hook that gets executed just once?
I assume it gets called once per world
You're probably right
But is there an event that gets executed when the total save event has been finished?
Otherwise i'll have to dig deeper and find a solution myself
wel it will be called once for each world
so find the length of bukkit.getWorlds
and then if there are 3 worlds, on the third call it’s the last one
Yeah i already though about that, thanks though
You can look at the event package in the javadocs
hello, when making custom crafting recipes, is it possible to check if an ingredients has an enchant
aight thx
im not on pc but maybe there is a getingredients(slot)? Or get item in crafting table maybe?
ingredient.getItemMeta(); ?
ExactChoice probably accounts for enchantments
Yea its great
Keeping objects and memory close enough to keep in cache speeds up a threads performance
But this is an implementation detail the JVM worries about
List<UUID>
onCommand
if list contains UUID return
command ran >> add player UUID to list
run code
Bukkit.getScheduler().scheduleDelayedTask >> remove uuid from list
You can have a task already running or you can create a task for each player.
i was looking into some interfaces and i found two interfaces: Merchant and MerchantRecipe. what is a merchant in this context? https://helpch.at/docs/1.12.2/index.html?org/bukkit/inventory/Merchant.html https://helpch.at/docs/1.12.2/org/bukkit/inventory/MerchantRecipe.html
use set instead of list*
it is for trader villager
Read the description too:
Merchant: "Represents a merchant. A merchant is a special type of inventory which can facilitate custom trades between items."
MerchantRecipe: "Represents a merchant's trade. Trades can take one or two ingredients, and provide one result. The ingredients' Itemstack amounts are respected in the trade. A trade has a limited number of uses, after which the trade can no longer be used, unless the player uses a different trade, which will cause its maximum uses to increase. A trade may or may not reward experience for being completed."
can someone help? i have a config manager code i made a while ago while using a tutorial, but i've changed some stuff to match what i need, and i have an error now (last time i used this code i also got an error)
error: https://paste.md-5.net/fokuxekose.bash
main class: https://paste.md-5.net/uheqafejen.java
config manager class: https://paste.md-5.net/ravimocuya.cpp
tutorial i used: https://www.youtube.com/watch?v=pGkJwiJsMi0&t=19s&ab_channel={TheSourceCode}
any help is appreatiated
You're using the file before setting it
joinsFile
Up to him
hmm, where
It's not set at the top
honestly i don't really understand what's going on in this code, i am big nub
I recommend learning Java first
Then you should know that the variable you're creating is null
You're IDE should also warn you
ohhh
Yeah
so this?
joins = YamlConfiguration.loadConfiguration(joinsFile);
Yep
i put it after the ConfigManager method, and now joins has a red line below it and stuff
Show new code
That's not even valid Java
all i did was move it and now the world is falling apart
Why is joins in your class scope?
what's a scope
Yeah you moved it outside a method
this sounds about java tbh
Any programming language if you don't know it ^
i moved it to after the joins.set("test", "hello"); and now i get this error:
https://paste.md-5.net/xaponuraru.cs
how can i store a class in a yaml file?
and how can i load and parse it from that yaml file aswell?
Hey, I would like to know how I can do to put a player's connection on hold, the time to load / modify their inventory from the database (since we will be inter-server).
Pls ping me when reply.
I'm trying to teleport armorstands with falling blocks as passengers, but nothing happens. When I remove the passenger it works. Is this some kind of weird mechanic? I can provide code if needed
4 actually, i still need help
There are several ways of doing that. Either with Gson, Jackson or with spigots serialization API
AsyncPlayerPreLoginEvent:
Block and load the Data from your DB
then
PlayerLoginEvent:
Apply this data to the player
You can safely connect to your DB in a blocking fashion in the AsyncPre event
I have found a workaround for this by removing all passengers before teleporting and adding them back after having teleported
Ooohh thank 😮 🙂
Just ask, what is a blocking fashion?
Just don’t add them
Then teleport them and finally add the passengers
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I use this system with putting them as passengers because for some reason when I teleport falling blocks every tick they only update after like a second
Just using a connection on the current thread. You should never ever do that on the main thread.
I wonder where "player connection"'s thread is 😉
?ban @naive arrow
Done. That felt good.
Oops. finger slipped

public void onClose(InventoryCloseEvent event) {
Inventory gui = plugin.getInventories().getGui();
Player player = (Player) event.getPlayer();
if (event.getInventory() == plugin.getInventories().getGui()){
if (team.contains(player.getUniqueId())) {
team.remove(player.getUniqueId());
return;
}
player.openInventory(gui);
//player.kickPlayer(ChatColor.translateAlternateColorCodes('&', "§7Du wurdest rausgeworfen\n §7Grund | §7Wähle ein Reich aus!"));
}```
When i try to open my inventory again when it closes, it bugs the inventory and console spams this error:
https://paste.gg/p/anonymous/a829585b8bf94778810525966038c31f
what did they do lmao
bruh
It goes smoothly when using armorstands with the falling blocks as passengers, but for some reason when I try to lower their Y coordinate by 1 (so that it lines up) it just doesnt work, but it does when using no armorstands (but then its unsmooth)
are you trying to not allow player to close this inv?
try removing the player.openInventory(gui) , i think its opening the inv, erroring, closing, calling the event, opening the inv, etc
no i fixed it, i used this code:
Inventory gui = plugin.getInventories().getGui();
Player player = (Player) event.getPlayer();
if (event.getInventory() == plugin.getInventories().getGui()){
if (team.contains(player.getUniqueId())) {
team.remove(player.getUniqueId());
return;
}
new BukkitRunnable() {
@Override
public void run () {
event.getPlayer().openInventory(gui);
}
}.runTaskLater(plugin, 1);```
whats a plugin where you can exchage exp for vault coins
i can code for u lmao
what are you trying to do, i dont think thats the best way to do it
i am trying to reopen the inventory, if player tries to close it
you can replace the runnable with event.setCancelled(True)
this with stop the inv from closing
there is no event.setCancelled(True) in Close Inventory event
can anyone help me in #general please
apparently theres not, idk why i was so sure there was
Ik its stupid to ask since everyone use MongoDB rn, but I need a good MySQL API that could handle on low RAM usage.
Does this thing exists?
did you try to google it?
will u code it?
who knows (or can code) a plugin where you can exchage exp for vault coins?
Why do you care about ram that much? I'd recommend jdbi or jooq. You also may just use jdbc, if you care about ram that much.
try {
File myObj = new File("Tooty/uuid.txt");
myObj.createNewFile();
FileWriter myWriter = new FileWriter("Tooty/uuid.txt");
myWriter.write(uuid.toString());
myWriter.close();
logger.info("Your uuid is in Tooty/uuid.txt");
} catch (IOException e) {
logger.warning("An error occurred.");
e.printStackTrace();
}```
is this the best way to write to a file, i get the no file or directory `IOException` for it (plugin is called tooty)
Use plugin.getDataFolder
ahh ty
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
so i just toString() that to get the directory?
try {
File myObj = new File(dataFolder.toString() + "/uuid.txt");
myObj.createNewFile();
FileWriter myWriter =
new FileWriter(dataFolder.toString() + "/uuid.txt");
myWriter.write(uuid.toString());
myWriter.close();
logger.info("Your uuid is in Tooty/uuid.txt");
} catch (IOException e) {
logger.warning("An error occurred.");
e.printStackTrace();
}```
where dataFolder is my getDataFolder()
still raises the ioexception
How do i install NMS for spigot 1.16.5?
oh wait i can create a file off the datafolder hm
Is there someone could tell me if I can add a recipe to workbench, furnace, anvil or a forging table
same as you do for any other version
Server.addRecipe
Thank you!👍
try {
System.out.println(dataFolder.toString());
File myObj = new File(dataFolder, "uuid.txt");
myObj.createNewFile();
FileWriter myWriter =
new FileWriter(dataFolder.getPath() + "/" + "uuid.txt");
myWriter.write(uuid.toString());
myWriter.close();
logger.info("Your uuid is in Tooty/uuid.txt");
} catch (IOException e) {
logger.warning("An error occurred.");
e.printStackTrace();
}```
still get the IOException `No such file or directory`
you May want file.mkdir?
Is there any API for Integration/Unit tests in spigot? 
ah how do i add BossBar for my mobs/entities?
guys im making a plugin where you can exchage exp for vault coins
this is my code:
/expmoney do
give money```
it doesnt work idk whats wrong with it
has anyone ever made it
hii
lmao
hello
I can think of a few things
How do i add BossBars for my Mobs/Entities to trace the Mob's health?
Bukkit#createBossBar
why my code not work??
Because that's not code
it is
No one is going to code it for you for free, you need to go to services as stated earlier.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
@terse mason This guy is trolling
One can only hope they're trolling...
.
aww can you send me the line to detect my mobs health? Cause flags, style are confusing me
Yep looks great now go use it
in bossbar
LivingEntity#getHealth, just update the boss bar when the entity is damaged.
Bukkit.createBossBar("Skeleton", "Red", "style", "")
i am confused here
so many parameters
what do i put in Style
flags
etc
its working fine! there's only 536 errors!
It tells you the types on the Java Docs @last ledge, they're enums, not Strings
Player#getWorld
why would i know
cause you are the only Intellectual/brave/funny guy I can think of, out here
alalala sorry what
.exists
Are they within the spawn protection limits?
change spawn-protection in config to 0
ok
wait
@EventHandler
public void onBlockBreak(BlockBreakEvent event){
Player player = (Player) event.getPlayer();
if(player.getWorld().getName().equalsIgnoreCase("world")){
event.setCancelled(true);
}
}```
enjoy
no one is here, to work for free for you
Then code it yourself if you know how long it would take.
you cant tell me what to do
I can. whether or not you do what you're told thats a different story.
👺
Wait quick question,
If x is an integer < 1
If y is an integer >= 1
float z = ((float) x) / ((float) y);
Will z be a fraction? If so is there a better way of preventing integer division?
Are you after the mere outcome or what? Anyways you can store it as another data type.
?paste
What are you confused about
on how to do
Listen to EntityDamageEvent and set the progress with the entities health
How do you check when a block is being broken using event BlockBreakEVent
@EventHandler
public void onBlockBreak(BlockBreakEvent event){
Player player = (Player) event.getPlayer();
if(player.getWorld().getName().equalsIgnoreCase("world")){
event.setCancelled(true);
}
}```
change the code, to your need
ok
how can I add a tabCompleter to a command I registered with ((CraftServer) Bukkit.getServer()).getCommandMap().register();?
Hey i have an error:
at de.haikobra.tyko.kdcounter.Tyko.listener.JoinListener.onJoin(JoinListener.java:18) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)```
code:
```java
if (!plugin.getConfig().contains(p.getName())){
plugin.getConfig().set(p.getName() + "." + "kills", 0);
plugin.saveConfig();
}```
maybe try listening for the tabcompleter event
just Player player = event.getPlayer(), you don't need to cast it (Player) event.getPlayer
Just query a command instance by the map and mutate its tab completer?
hm?
u dont need to use nms to access the commandmap
im pretty sure there's no other way unless you register it in plugin.yml
CommandMap::getCommand
then check instanceof and cast to PluginCommand
then set its executor
commandmap auto registers it regardless
The command can also be registered without plugin.yml
Help me to make Bossbar to track my mob's health pls
i am trying
It isn’t exposed in spigot tho taahanis
So what he does is somewhat justified
Why don't you choose the .java file format ;-;
i swear it was???
or am i thinking of paprr
Apparently it breaks/is improper api in md5 and Chocos opinion
paper
yeah paper
ahh
But I’d say bad api > no api
ye
in this case, just make ur command class either implement TabExecutor if you're using commandexecutor
or just extend the regular Command class iirc
im extending BukkitCommand in the class where i have the command
and implementing TabExecutor
extend Command
not BukkitCommand
oke
hi u know how to make bossbar?
creates commands from config.yml
yes?
thanks i'll give it a look
i mean you can also use BukkitCommand and the method is tabComplete()
Server#createBossBar()
declaration: package: org.bukkit.command, class: Command
no need to implement TabExecutor if ur extending Command or BukkitCommand
not super
override the method
oke
That’d just call the parent method implementation.
Pog
probably with all the time i've spent making a command api i would've already made all the commands i needed :p
Can I add cooldown to sword in 1.8.8 like version 1.9?
Theoretically you could make a cooldown and just cancel the PlayerInteractEvent if the cooldown isnt over
How do you cancel events?
