#help-development
1 messages · Page 546 of 1
do potion effects effect spectator
Yes, but most of them are useless if they are in spectator mode.
Nightvision is the most prominent example
Right. Things like night vision will work though
Give them darkness. 😛
So I have a /sell command and ShopGUI+ has a /sell command too, how can I disable or override the ShopGUI+ /sell command?
Ideally you don't expose that ResultSet at all. You return some data object that contains the result of that query
That's especially required because when you close your connection (like all good boys and girls should, RIGHT!?), all statements and result sets close with it
Maybe try putting ShopGUI+ in the loadbefore list of the plugin.yml. May or may not work, but I think the first plugin that loads gets the priority. Could be wrong on that though.
Alright, I'll try that, thank you.
Also wanted to point out that you need an open connection in order to read the ResultSet. I learned that during my database setups. But like Choco said, you'd ideally want to return an object that copies the data from the ResultSet.
Not with that code it won't. Try-with-resources closes all object connections once it completes. So you'd lose access to that specific ResultSet's data.
Ehh, maybe. Your code confuses me a little.
Since ResultSets need a connection in order to be read, that means that you lose a connection from your total pool. So if you ever reach a point where multiple people are using those connections, you'll lock up. That's why Choco and I recommend that you just take whatever data you need from the ResultSet and return that instead of the ResultSet itself.
That way the ResultSet auto closes from your try-with-resources, returning a connection to the pool.
If you're getting valid ResultSets out of it then sure, but I still advaise against doing it that way.
Then what does your #invoke interface method do with it?
Also, something that's bothering me is the return statement in the try block. I'm pretty sure the resources get closed first before the return statement gets executed, which will mean that the ResultSet that is passed through might be null.
Ohh, I see how you are doing it now. The generics are what were throwing me off. They confuse me. :3
It's why I hardly use them. lol
What in the fuck? I need to brush up on them again. I didn't even know Z and H were types.
Generics aren't types. They're just names for things
They don't actually even have to be single letters either
Right because standards, but they definitely don't have to be
Wait what? I thought they were tied to specific things. Or is that just how it's taught?
Nah, can be whatever you want
public class Foo<MINECRAFT> {
private final MINECRAFT something;
public Foo(MINECRAFT something) { this.something = something; }
}
Foo<String> foo = new Foo<>("Hello world!");```
Probably fine. Though I personally hate having to deal with consumer hell
I would at least have your Query method throw an SQLException or something, otherwise you'll have to try/catch every lambda you make
Well, this sure changed my understanding of things. xD
No I get that, but all ResultSet methods throw explicit SQLExceptions so you're going to have to try/catch
The lambda body doesn't care about its calling context
Right, I'm used to that, but I thought those were more specific?
Take a List<String> for instance.
It can only ever contain that one specific object type.
I know, this is what I'm saying
database.executeQuery("foo", result -> {
try {
result.getString("bar");
} catch (SQLException e) {
e.printStackTrace();
}
});```
If you don't have a try/catch in that body, it will fail to compile because you have an uncaught exception
Because Query's #executeQuery() method doesn't explicitly state that it can throw an SQLException
(at least not in the paste you sent)

Then you're all good
Plugin measaging
how can i make fall damage off for players with a specific luckperms permision?
I appreciate this. This was a good watch and helped clarify some things.
public void onDamageEvent(EntityDamageEvent e) {
if (e.getCause() == DamageCause.FALL) {
rabbitEffects(e);
e.getPlayer();
}
}
how would i get the player who fell?
e.getPlayer() doesn't exist
"Cannot resolve method 'getPlayer' in 'EntityDamageEvent'"
public void onDamageEvent(EntityDamageEvent e) {
if (e.getCause() == DamageCause.FALL) {
if (e.getEntity().hasPermission("venson.rabbitrole")) {
e.setCancelled(true);
}
}
}
any reason why this wouldn't work even though i have the permision
i removed the permision checker and it still isnt working
did you register it
register the class to receive events
and annotate it as @EventHandler
the method that is
if this was all the code, it wouldnt compile
public static void Read(Player player, String tts) {
String[] split = tts.split(" ");
for(String letters : split) {
player.playSound(player.getLocation(), letters.toLowerCase(), 1.0f, 1.0f);
}
}
A question related how can i make wait inside the "for" so when the tts says a word that word as a space between them
inside the "for"
Looks like their trying to just wait after each iteration in the loop so the TTS speech doesn't say every word instantly
yes
You need to make a scheduler and then increment an int counter each time the scheduler runs
Then play the array at int counter
ok thanks
Hey folks, is there any known places to go for commissions for plugins? I have two plugins I'd like to see, one of which is extremely simple (cancels bee water damage event, they drown 24/7), and another horse based one. If you can point me in the right direction let me know!
?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/
Wonderful, thank you!
after a day, i've just realised how dumb i was when I was thinking for how to iterate single dimension array as 2d one column-wise:
int array[] = {
1, 2, 3,
4, 5, 6,
7, 8, 9
};
int arraySize = sizeof(array)/sizeof(array[0]);
int rowSize = 3;
for (int i = 0; i < arraySize; ++i) {
int row = i % rowSize;
int column = i / rowSize;
int element = array[row*rowSize+column];
// do something with element
}
this would literally iterate it column wise [1, 4, 7, 2, 5, 8, 3, 6, 9]
how couldn't I thought of this before lmao
this is so simple
you can iterate both ways with one for loop too
just by creating another element variable with swapped row and column places inside index
real
real
why cant i import this?
probably because you're using spigot api
as a dependency
you need a full blown spigot jar file to import this, you need to generate that jar with buildtools afaik
i cant help you with this further sorry
Or add authlib
hello i just made a item display on chat event (the thing when someone type [item] it show it on chat when hovering on that)
i used HoverEvent.Action.SHOW_TEXT
and i need add any possible information i can from the item (color, enchantments, lore, nbt tag and ech)
then i noticed have the thing called HoverEvent.Action.SHOW_ITEM
so my question is how i can convert ItemStack to be use inside that?
here my code of SHOW_TEXT
if(message.contains("[item]")) {
String new_message = "<" + player.getDisplayName() + "> " + message;
String[] parts = new_message.split("\\[item\\]", -1);
BaseComponent[] messageComponents = new BaseComponent[0];
for (String part : parts) {
TextComponent textComponent = new TextComponent(part);
ItemStack item = player.getInventory().getItemInMainHand();
if (item.getType() != Material.AIR) {
ItemMeta itemMeta = item.getItemMeta();
if (itemMeta != null && itemMeta.hasDisplayName()) {
TextComponent itemComponent = new TextComponent(ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + item.getAmount() + "x " + ChatColor.RESET + itemMeta.getDisplayName() + ChatColor.DARK_GRAY + "]" + ChatColor.RESET);
BaseComponent[] hoverTextComponents = getItemHoverTextComponents(item);
itemComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverTextComponents));
if(messageComponents.length != 0) messageComponents = TextComponentUtil.append(messageComponents, itemComponent);
} else {
TextComponent itemComponent = new TextComponent(ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + item.getAmount() + "x " + ChatColor.RESET + item.getType() + ChatColor.DARK_GRAY + "]" + ChatColor.RESET);
BaseComponent[] hoverTextComponents = getItemHoverTextComponents(item);
itemComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverTextComponents));
if(messageComponents.length != 0) messageComponents = TextComponentUtil.append(messageComponents, itemComponent);
}
}
messageComponents = TextComponentUtil.append(messageComponents, textComponent);
}
for(Player p : plugin.getServer().getOnlinePlayers()) {
p.spigot().sendMessage(ChatMessageType.CHAT, messageComponents);
}
event.setCancelled(true);
}
early returns please
what you mean?
google it
you want the functions i made too? TextComponentUtil? and getItemHoverTextComponents?
@tardy delta
private BaseComponent[] getItemHoverTextComponents(ItemStack itemStack) {
ItemMeta itemMeta = itemStack.getItemMeta();
int number = 1;
if(itemMeta.hasEnchants()) number++;
if(itemMeta.hasLore()) number++;
BaseComponent[] hoverTextComponents = new BaseComponent[number];
// First line: Display name
if(itemMeta.hasDisplayName()) hoverTextComponents[0] = new TextComponent(itemMeta.getDisplayName());
else hoverTextComponents[0] = new TextComponent(String.valueOf(itemStack.getType()));
if(itemMeta.hasEnchants()) {
ArrayList<String> enchantmentsText = new ArrayList<>();
for (Enchantment enchantment : itemMeta.getEnchants().keySet()) {
enchantmentsText.add("\n" + enchantment.getKey().getKey() + " " + itemMeta.getEnchantLevel(enchantment));
}
hoverTextComponents[1] = new TextComponent(ChatColor.GRAY + String.join("", enchantmentsText));
}
if (itemMeta.hasLore()) {
hoverTextComponents[2] = new TextComponent(ChatColor.GRAY + String.join("\n", Objects.requireNonNull(itemMeta.getLore())));
}
return hoverTextComponents;
}
class TextComponentUtil {
public static BaseComponent[] append(BaseComponent[] baseComponents, BaseComponent... components) {
BaseComponent[] newComponents = new BaseComponent[baseComponents.length + components.length];
System.arraycopy(baseComponents, 0, newComponents, 0, baseComponents.length);
System.arraycopy(components, 0, newComponents, baseComponents.length, components.length);
return newComponents;
}
}
?paste
Learning proxy and channel crap am i just slow or something bc this isnt getting the simpe message
the plugin on the proxy is sending the message but this isnt getting it
(simple rn but im having problems and cant get any plugin on spigot to get the message on the network)
Is there a way to change the AI of existing mobs to act like others? I'm trying to make zombies ride zombie horses but the zombie horses won't attack the player. I tried setting the zombie horse's target to the target every time a zombie targets something but it still isn't walking towards it - can I make it have the AI of a zombie?
I'm trying to use reloadConfig(); but the game is not updating, can someone help me? 
@tardy delta hello? can you help me pls?
well whats it sending
So it would be String.format("Minutes: %d Seconds: %d", 100/60, 100%60)
could probably use a DateTimeFormatter with a custom pattern 👀
currectly its SHOW_TEXT, and i need know how i put inside SHOW_ITEM that ItemStack
because HoverEvent get only Component[]
not ItemStack
@tardy delta the code i sent you working, but that not what i wanting i wanting using SHOW_ITEM
yes
thats how maps work
or well
actually
now im doubting myself
but should be very easy to test
new HoverEvent(Action.SHOW_ITEM, hoverTextComponents)?
😭
what game
Am I missing something here, how do I change my password on hub.spigotmc.org?
Ah you have to change it through JIRA lul
jira is seperate
Nope it seems to use the same password for Stash/Jira
only iof you set it the same
I'm not on about the forums
they are different auth but your browser gets confused because its not taking sub domain into account
No I'm on about these two:
Stash doesn't let you change the password because it must be managed by JIRA
ah
No 2FA tho 😦
?paste
it can send the message but it wont get them from the proxy and yes the proxy is sending them
https://paste.md-5.net/uvusumozuy.java
you get no incoming message at all?
What's your proxy code
And also idk if you can add custom stuff to the bungee channel
BungeeCord channel https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
zero
and let me remove my database stuff from it rq
?paste
I'm trying to use reloadConfig(); but the game is not updating, can someone help me? 
are u saving the config before reloading?
show your code
Omg md i didn not mean to ping u didnt know u were staff mb
thats the plugin running onthe proxy just trying to get the simple thing to work before i move on to bigger stuff
the proxy gets thje message from the spigot when i do /testbungee but the spigot isnt getting the "simplemessage"
Tired it with 3 networks dont ask why i have 3 setup
these r 100% wrong i feel
bc im using thos lol
try {
MainKits.getPlugin().saveConfig();
MainKits.getPlugin().reloadConfig();
sender.sendMessage("§aConfigurações reiniciadas.");
} catch (Exception error) {
sender.sendMessage("§cOcorreu um erro ao reiniciar as configurações.");
}```
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
im getting to much errors
but i need some1 on vc
on the BungeeCord channel you don;t have a subchannel. you have fixed requests
saving it then reloading it is redundanT?
i will screenshare
what are you trying to achieve
its easier, bc its alot
like PlayerCount
so will some1 help me?
Dont think anyone will get on vc, just write it out with accuracy and we can help
plus more people will see the issue and be able to help
pastebin
?paste
i think you're better off sending your code 💀
are you trying to implment enchantment
I just put " MainKits.getPlugin().reloadConfig();" it's nothing.
The configuration is not saved.
Put the classes in separate files and dont make them static
on your project view here, right click in the same folder that all your other code isin
then go new > java class for each of the enchantments
close stuff that uses that file
I only have dc and the cmd prompot
also whats getDefaultPlugin?
check spigot hub
You use Eclipse? Maybe it's still open in the background and keeping those files open for quicker launchspeed?
I use IntellJ and no its closed
but i have smthing else then u
and i cant paste photos here
for some reason
alr hop in a call ill help
?img
Not verified? Upload screenshots here: https://prnt.sc/
restart PC and try again
ah you have to be verified for call aswell
ok
!verify
Usage: !verify <forums username>
still nothing
just verify i dont do private dms
the spigot part just isnt getting anything
ok
but the proxy is feeding the messages
you are sending custom messages so use a custom channel
did
whats the point if it cant even get basic ones
you don;t reply to "basic ones" they are already handled by Bungee
PlayerCount, PlayerList etc are already handled by bungee
im just trying to get the spigot part to actually get the message but sure ill waste time to use custom channels so it still doesnt work brb
You are not listening
all i want to verfiy is the spigot is getting anything from the proxy idc what and its not
thats why im here asking
stop trying to overide the built in messages then
how is this a built in message
String message = "Hello from proxy!";
didnt work
That is not a standard bungee message so shoudl not be sent on teh BungeeCord channel
The Bungeecord channel is for accessing the pre programmed BungeeCord messages
but what is hoverTextComponents
how i trasnfer ItemStack to that
hoverTextComp is just the list text i want
but i know you can convert full item to SHOW_ITEM
so showing any infomation of item
Try to delete C:\Users\hp\Desktop\BuildTools\Bukkit\.git\index.lock like the exception message suggests?
wow its almost like i called it a total waste of my time and the spigot plugin still isnt getting the messages wow
it doesn't exist
You did it wrong
you can pass in a net.md_5.bungee.api.chat.hover.content.Item into HoverEvent constructor
can u explain
https://paste.md-5.net/onecahivoh.java
channel name is the full text including the bit before :
i just fixed it and it still doesnt fget the messages
the proxy gets the message from the command tho
show your proxy side
code or logs
code
bc the code is in it
sorry I didn't scroll
its sending broadcastServerInfo that should just be the
04.06 12:04:30 [Server] INFO [BroadcastLogger]: Sent message to player: Person98
04.06 12:04:30 [Server] INFO [BroadcastLogger]: Simple message broadcasted: Hello from proxy!
Learning more and more i dislike this and might just start hiring people for bungee crap
so i can foucs on the spigot side of crap
yes
or i hope
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
getLogger().info("Received a plugin message on channel " + channel);
if (!channel.equals("test1:customchannel")) {
getLogger().info("Channel is not CustomChannel, it's " + channel);
return;
}
player.sendData("test1:customchannel", out.toByteArray());
Plugin message channeling wasn’t intended to be used as a message broker
redis
as it wasnt even getting player count of the servers on the network before
it just doesnt get anything from the proxy
even the basics
with the correct channel it should work
well it relies on player connections
I've used it myself so I know it works
Have u enabled bungeecord in spigot yml, and like done the configy stuff correctly?
yea spigot is true bukkit is -1 and the other thing is set to flase
false
ip fowards is true
servers work as i can swap to each
settings:
debug: false
sample-count: 12
bungeecord: true
player-shuffle: 0
user-cache-size: 1000
save-user-cache-on-stop-only: false
moved-wrongly-threshold: 0.0625
moved-too-quickly-multiplier: 10.0
timeout-time: 60
restart-on-crash: true
restart-script: ./start.sh
netty-threads: 4
unless i missed a step that isnt the 3 of them lol
Is there a way to spawn just the firework effect without actually playing the sound of the firework launching and possibly hiding the firework itself?
ig ill try swaping to spigot not paper to see if that makes a diff
if (!channel.equals("customchannel")) {
Shouldn’t u compare against test1:customchannel?
yes
Yeah and then also send to test1:customchannel and not just customchannel mayber? 😅
at least point i just have the network setup wrong tbh
bc if i add
private void checkIfBungee()
{
if ( !getServer().spigot().getConfig().getConfigurationSection("settings").getBoolean( "settings.bungeecord" ) )
{
getLogger().severe( "This server is not BungeeCord." );
getLogger().severe( "If the server is already hooked to BungeeCord, please enable it into your spigot.yml aswell." );
getLogger().severe( "Plugin disabled!" );
getServer().getPluginManager().disablePlugin( this );
}
}
```it always show sthe message even tho the bungeecord is true in the spigot.yml
You are checking settings.settings.bungeecord
I see no code on that page
Ah ur blind
Oh wait
thats cool
I don;t see that code anywhere
Ah
Speaking of which
yeah bad page
but is their anywhere else that i could have setuip wrong
for the spigot server to not get messages
Yes, u have to use test1:customchannel everywhere
i am
🙏
tbh bungee seems like a pain i miss just if block do that if that do this
I dont see why its not getting the message from the proxy tbh
and now u said not to trust the wiki so
lol
idk how to feel
typo player.sendPluginMessage(this, "test1:customchannelor", out.toByteArray());
Its a different channel
customchannelor
it can send them
that was a typo while copying bc i was 2x checking before sending the code
but that wouldnt even break the onPluginMessageReceived
as ik the plugin can reach the proxy and the proxy can get messages from the plugin
but test1 (the spigot plugin) isnt getting simplemessage
I cant build remapped 1.16.5 with BuildTools?
Does it work the opposite direction tho?
Like does any direction work?
yes
I see nothign else wrong in your code
the spigot can send a messagfe to the proxy and it gets it
when the proxy trys to talk to the spigot it doesnt get it
i tired it on 2 differnt proxys and 2 differnt networks that r hosted in differnt palces
the proxys are hosted both at apexx 2 servers on one proxy is a custom panel the other is on pebble
I cant build remapped 1.16.5 with BuildTools?
1.18.3+ definitely doesn't exist 
probably meant 1.16 and not 1.18
It was added to BuildTools in 1.17
You can try to send it through server info
I could swear it was there before that...
I can;t test anything at the moment
ill just go back to making fukin blockbattles instead of learnign new crap
if ur on later im sure ill probs wanna try again lol
Maybe use redis 😊
But yeah I can try to look into source, see if it blocks any channels or filters out sth specific
Cuz iirc it def prevents certain channels from being used etc
try asking chatgpt
Don’t
it tells me im dumb as shit
You’ll get trolled
chatgpt cant even calculate me a tangent properly
Def a user error their
Wait fr?
like just any number or when cos(x) approaches zero?
well in some formula
Ah
it had to simplify it and it decided to mess with it
free calculus lessons
half of its responses are "no your answer is wrong, the answer is <repeats input>"
Imaginary numbers, sin/cos formula for Z
Isn't it just f'(n)x + f(n)?
gimme free differentials lesson
ok start
any better docs for bungee or what u think ill need later on plz dm me them
what's wrong with ?jd-bungee
read up
If I get time later I'll throw a demo together
thx dm me when
its 9 am i need sleep
rn i have the proxy odin the other styuff it needs
you can't send a plugin message to proxy or what
umm
Is there even a player connected?
probably you are doing something wrong
Bungee cannot send data if no players are connected
yup
Really i couldnt tell
NAWDIP
showcode
was just a simple thing bc it wasnt even getting player count numbers
or the basic messages
so i went to helloworld type shit
Look - it gotta be something obvious
the spigot sends the test mesage find and the proxy gets it
but the spigot isnt getting the message from the proxy and it sends it
Okay in that case a connection is actually made
so in bungee you registered it
and what is your code in spigot part
its test1
i mean
FelyProxy is the code on the proxy
spigot plugin code
oh
to me it seems how i think it would work
so that's not triggered
yea
like at all
nothing triggers it
once i get a plugin that can get messages the rest is easy lol
Than i get to break even more code in a working gamemode to use bungee lol
i'm quite sure official bungeecord guide on spigotmc is hella obsolete
i had one somewhere on my pc
theirs not much on bungeecord that i could really find
just need to find it
this is 1.19 btw
I guess you could just check whether wireshark or any other packet analysis program picks up on the packet (make sure to disable compression beforehand though)
i coded for 1.16 but i don't think anything really changed
Dont think much did tbh
but those won't change PMCs, or?
Tf is a PMC
i fotgot about thos
bungeecord guide is stuck somewhere on 1.12
pdc?
its stuck somewhere pissing me off
or display entitites
plugin messaging channels
And jesus, is discord getting DDoSed right now? The ping I'm getting is otherworldly
SAME
Yes
they haven't been changed since like 1.14
true
same
thought russian government started blocking discord for me heh
💀
ah that's why just now I sent a message and it wasn't sending(not here)
messages deleted ?
shaded it?
I think showing the class might help
do you have a pom.xml
damn discord going brr
set the scope to compile for that dependency?
bruh cant even sent my message
NoClassDefFoundExceptions can also hint at classloading failures
NoClassDefFoundExceptions can also hint at classloading failures
ye
Yeah, switching to IRC might make sense at this point
18 secs response time 💀
Yeah, switching to IRC might make sense at this point
heehee i respond to your message and mine arrives earlier than yours
Could you give us the entire log?
NCDFE hints at classloading failures. Usually the class is not in the jar but sometimes other reasons could cause this
bruh what aabout that scope i was talking about
how do i get all faces of a block? with loop ?
Okay it is caused by the class file NOT being present in the jar
You don't even use maven. So that is your issue
just sent pom.xml
... or apparently not - though how do you build the jar anyways?
bruh what aabout that scope i was talking about
That should work, but setting the scope io.socket:socket.io-client to compile should work better
it's compile
Also is your discord scuffed or do you send your messages a bazillion times?
dont even remember what i sent cuz the message is just gone
Also is your discord scuffed or do you send your messages a bazillion times?
Pong.
💀
Is there a method that takes all the faces of the block?
have you set scope to compile?
Could you send the fully compiled jar?
loop over BlockFace.values() and call getRelative
BlockFaces.values() or what exactly do you mean?
BlockFaces.values() or what exactly do you mean?
Yeah, try explicitly setting the scope to compile for good measure, though it should be compile by default
okay it is shading it
im doing custom block system if player have paper and right click to every block set block on the clicked block face
Why the hell are you using cc.craftlink.utils.WebsocketClient in source code and cc.craftlink.Utils.WebsocketClient in the jar?
Try nuking all caches I guess. Something is fishy
i have lag or ...??
Could you show pseudocode of what you are attempting to achieve @quaint mantle?
Yes it is really painful. I'm available on IRC (#spigot@irc.spi.gt) if it is too unbearable for you
Just do mvn clean
I still have no idea what you are going for
test
I still have no idea what you are going for
no it's under "target" in your project folder
These is also maven local located under "%userhome%/.m2" but it is irrelevant for your issue
I still have no idea what you are going for
@EventHandler
public void onPlace(PlayerInteractEvent e) {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (e.getItem() == null && e.getClickedBlock() == null) return;
ItemStack item = e.getItem();
Block block = e.getClickedBlock().getRelative(BlockFace.UP);
if (item.getType() == Material.PAPER) {
block.setType(Material.TRIPWIRE, false);
item.setAmount(item.getAmount()-1);
}
}```
this flower is paper
and when player right click to target block face puts block to face
this line should be an || if (e.getItem() == null && e.getClickedBlock() == null) return;
geols message keeps returning for me lol
It's like playing whack-a-mole
fixed
oh finally
I have no idea how discord managed to mess up that bad. Shouldn't messages have UUIDs to prevent double-posting in case of routing issues?
OH NOT FIXED IM STILL LAGGING OMG
Discord is probably getting DDoSed, the only "cure" would be to wait until it is over
Or just use IRC
whats irc btw
?irc
IRC Chatroom: https://www.spigotmc.org/pages/irc/
lol
OH NOT FIXED IM STILL LAGGING OMG
oh finally
lol
test
oh really?
more like "you sent 4 times that you deleted it"
how can i start the server with java 11 instead of java 8????
ikr
sudo alternatives --config java
linux :)
reminds me i need to fix my dualboot
that message took a suspicious amount of time to be sent
test
sure you can do
public class X {
public void m() {
m();
}
}
if you want to
oh man im going to be called 8 times now
You can call a method from inside a method, even itself. If you call the method you are in it's called "recursion", which can lead to many weird issues.
However you cannot create methods inside methods. Except if you consider "lambdas" methods.
you good?

discord is going brr but i think your internet is also going brr
Hello how I can drop each item from ArrayList of ItemStacks?
There is array
private final List<ItemStack> BrewingBarrelItemsList = new ArrayList<ItemStack>();
This one add items to this arraylist from slots
@EventHandler
public void onInventoryClose(final InventoryCloseEvent event) {
if (!event.getInventory().equals(invBrewingBarrel)) return;
final ItemStack slot1 = event.getInventory().getItem(0);
final ItemStack slot2 = event.getInventory().getItem(2);
final ItemStack slot3 = event.getInventory().getItem(4);
final ItemStack slot4 = event.getInventory().getItem(6);
BrewingBarrelItemsList.add(slot1);
BrewingBarrelItemsList.add(slot2);
BrewingBarrelItemsList.add(slot3);
BrewingBarrelItemsList.add(slot4);
}
And now I want on BlockBreak drop each of this items on the ground
@EventHandler
public void onBlockBreak(final BlockBreakEvent event) {
Block block = event.getBlock();
Player player = event.getPlayer();
if (block.getType() != Material.BARRIER) return;
FurnitureMechanic furnitureMechanic = OraxenFurniture.getFurnitureMechanic(block);
if (furnitureMechanic == null) return;
if (!furnitureMechanic.getItemID().equals("medieval_market_decoration_v1_barrelsword")) return;
block.getWorld().dropItemNaturally(block.getLocation(), BrewingBarrelItemsList.);
}
ikr
ikr
Thank you
iterating my friend
man sent ikr and i received it 8 times 💀
oh now your LOL is also arriving again
iterating your friend or iterating is your friend?
ikr
hasnt happened
Discord have issues today and messages got sent like 2-4 times 💀
oh god
LMAO
I'm confused what you want to do
lol
Is that on the main thread?
If so, definitely make a seperate thread for that.
Is that on the main thread?
If so, definitely make a seperate thread for that.
bruh my messages keep coming back
woohoo its going down
bruh my messages keep coming back
LOL
HAHAHA
ICANT
Nah, I already had my fair share or disruptions
man resends his messages on purpose 💀
Then make a cache for all players that need to be verified and make so that your API can take multiple players as input. So you can dump the cache quicker and the responses are faster for more players.
no, but you can use locks
There's something called CompleteableFuture
Or just use CF
@rare aurora yeah this is good
i hope i wont get called the moment i go to my bed
Ye
im scared
i dont believe in trust
Lost to the aether
Fixed
?jd-s
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
how can i start the server with java 11 instead of java 8????
So
Bukkit.getScheduler().callSyncMethod(myPlugin, () -> {
// Sync stuff
return null;
});
how can i start the server with java 11 instead of java 8????
sudo alternatives --config java on Unix and then java -jar stuff as you are familiar
C:/full/path/to/java/java.exe -jar spigot.jar on Windows (+/- a few stuff)
Yep
Do note that you may need to install a Java 11 JRE in both cases (via https://adoptium.net or similar)
thx
thank you
If you can use PDC. But generally doing that won't be the end of the world (I'm doing both in EnchantmentsPlus (see https://github.com/Geolykt/EnchantmentsPlus/tree/4xx/src/main/java/de/geolykt/enchantments_plus/compatibility/enchantmentgetters))
How do I rename the item (I have the ItemStack and the ItemMeta) without that font that happens when u rename items on an anvil
okay morice_0 I made it and it's working, really thank you but now when one of this slots are empty then it's print null error
Is there any easy way to avoid this eg in loop like of any of ItemStack are null then skip it and go to others?
Ok
will this make a work?
ohh thank you now I learned a new one thing that continue exist and what it makes
Void air and cave air be like
Hi I have a question regarding fat-jar creation in gradle...for some reason when I build a fat jar in a task and not through the default jar{} I get a "Could not find or load main class" error even though everything is exaclty the same just in a custom task
Thx in advance
what is your build.gradle?
application {
mainClass = "$main"
}
// THIN JAR
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Main-Class': "$main"
}
}
// FAT JAR
tasks.register('fatJar', Jar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Main-Class': "$main"
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
archiveBaseName = project.name+'-fatJar'
}
If I add the from part to the normal jar it works with my dependencies
Is this spigot-related or nah?
the error no because I haven't added the spigot stuff yet sry if this is the wrong place but I thought some people here might use gradle a lot xD
just wanted to be sure you didn't do stuff you aren't supposed to
Generally I don't use the traditional manual fat jar task way but rather use the shadow plugin so I don't have much experience with this but it seems like it is correct for the most part
Did you verify whether all classes are present inside the jar?
No how can I do that again?
The way I understand the shadow plugin it always shadows the dependencies so that there are no conflicts when different jars bring the same included dependencies but if I have multiple plugins for example that use the same then I only want it once and not shadowed...is that possible with the shadow plugin?
If you wisely make use of the compileOnlyApi and implementation scopes there is no difference
However there is absolutely no difference between what you just did and the shadow plugin from what I know
No how can I do that again?
Just open the jar as a zip file
Only the dependency is included xD
I feared that
Add
from jar.getSource()
dependsOn javaCompile
to your fatJar task
It's a little bit hacky but whatever - it should work
yeah it works and it seems like the shadow plugin does exactly the same thing...so does it not "shade" the dependencies or is that just not visible through the classes?
Well I have no real idea what shadowing is called shadowing to be honest
I just know that it basically means adding all the classes that need to be present at runtime into the shadowed jar
it probably does a few extra things though
Yeah ok I read this https://stackoverflow.com/questions/33779185/what-are-the-differences-between-uberjar-fatjar-and-shadowjar-in-gradle
but it seems like it doesn't create a shaded jar by default then so yeah I'll just use the shadow plugin thx for the help 🙂
that person complaining about shadow jar being a plugin is wrong. But oh well
yeah but what would be the way to go when two plugins for mc use the same dependency (and you know it and don't want it packed in each jar) would I use implementation on one and compileOnly on the other and then just build a fatJar on both in case of other dependencies needed?
That would raise a dependency from plugin b to plugin a
Use spigot's libraries feature
true but lets say plugin a is a dependency anyway because its an api
In plugin A:
dependencies {
api myLib
}
In plugin B:
dependencies {
compileOnlyApi pluginA
}
pluginA and myLib won't be on the runtime classpath of plugin b and thus won't get shaded
hi guys
im trying to make block place with item when player right click the clickedblock's any face will form the block on clicked face
so i how can i get face from clickedblock ?
Is this explanatory?
However mylib is on the runtime classpath (as per api) of plugin a and thus will get shaded into plugin a
ok makes sense thx 👍
thank you bot which one to get all block fce ?

magic
wait
there is no such thing as the all block face
There is just an array of all available block faces called BlockFace.values() and the method you are searching for, PlayerInteractEvent#getBlockFace()
Unless you mean the facing of a block
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Directional.html#getFaces() would be for getting the facing of a given block
Or https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Orientable.html#getAxis() if it is orientable
for(Entity target : nearest){
if(player.hasLineOfSight(target) && target instanceof LivingEntity && !target.isDead() && target != player){
arrow.setVelocity(target.getLocation().toVector().subtract(arrow.getLocation().toVector()));
// make the arrow travel slower
arrow.setVelocity(arrow.getVelocity().multiply(0.25));
}
else{
cancel();
}
}
Shouldn't this only make the arrow fly towards a target that is in line of sight of the player using the bow? It keeps shooting the arrow backwards into entities, but it it should have oine of sight for the arrow to target someone.
??
List<Entity> nearest = arrow.getNearbyEntities(HomingRadius, HomingRadius, HomingRadius);
it is thats the problem. its trying to target someone the player cannot see.
itll shoot the arrow behind them and hit a cow or something
its not suppose to.
what?
The server cannot know what the FOV of the client is
so it does 360 fov
Obviously
Testing for the FOV would be interesting - I'd guess you'd compare the LOS vector with the vector of the player's eyes. How exactly it is done is not instantly clear to me though
how can I get all the boss bars that were ever created (Bukkit.getServer().getBossBars() only returns some created by commands!¨)
the ones I created with createBossBar();
lol now I have the current ones and idk how to remove them
when I created them I did not store them anywhere
they just are still there (on my screen) and idk if there is any list of them
I know but HOW because I don't know if there is an list of them
oh I think I "found" a solution lol
Bossbars can be made with namespaced keys and they will persist
I'm trying to make a plugin for a gear enhancement system, but I've been having some issues. Would anyone be able to look through my code?
It’s better if you explain what issue you’re having, what is not working that should be, and relevant code snippets. Very few people will engage with that
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
there is a section of my code where if a player clicks on a "enchanted anvil" within a custom GUI that opens up, it consumes a certain item.
right now, the player is not able to click on the enchanted anvil at all.
yeah that saved my life...
firstly, do not use the title to detect the inventory, use the inventory holder
and the problem is because you cancel the event immediately
If I had a dollar for every time someone suggested abusing the InventoryHolder for custom GUIs, I'd have a lot more loonies than I'd be comfortable having
ok but it’s better than the inventory title. You can use the inventory instance though and store the instance
InventoryView, yes. The preferred means of doing this
yep
what do you mean?
sorry, still quite new to plugin dev
If I have a method for updating a custom items data, should I place that in the class I have to create that item, or should I give it it's own class in my itemfactory package?
for the first time my plugin is functioning as intended
this must mean I need to abandon it now so it doesn't break
I want to build a spigot jar with a custom class in NMS, how can I add a .java file to NMS?
i have problem i just one tap but my code puts two tripwirejava public void onPlace(PlayerInteractEvent e) { if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return; if (e.getItem() == null || e.getClickedBlock() == null) return; BlockFace blockFace = e.getBlockFace(); Block block = e.getClickedBlock().getRelative(blockFace); block.setType(Material.TRIPWIRE, false); }
need i do scheduler for fix this ?
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
you didn't cancel the event
can someone explain to me why i cant do anything with the wither? like I dont get any options to modify the creature.
@EventHandler
public static void witherSpawn(CreatureSpawnEvent event){
if(event.getEntity() instanceof Wither wither){
wither.setCustomName(ChatColor.DARK_RED + "");
}
}
The setCustomName has a red line, and wants me to create the method. But the method already exists.
static doesnt change anything. I have all my spawn classes static.
sir those are methods
- if you have anything with dependency injections, that wont work
how can i set a blocks facing back to its original facing after I have set the type ?
dont got any, but i found my problem it was stupid. the class name was the exact same as the entity so it was using that instead of the class from Bukkit.entity
Use Material#createBlockData with the new type
thank you
Then .merge the BlockData that’s already at that location
this is giving me an error
Caused by: java.lang.IllegalArgumentException: Data not created via string parsing
Yeah hang on that’s the wrong method
What can I do to check to see if the inventory that is clicked on is the player's inventory or not?
I thought for sure there was a method to copy matching states from one BlockData to another
I guess I was wrong
i actually just found the answer
BlockFace facing = ((Piston)event.getClickedBlock().getBlockData()).getFacing();
event.getClickedBlock().setType(Material.STICKY_PISTON);
Piston data = (Piston) event.getClickedBlock().getBlockData();
data.setFacing(facing);
event.getClickedBlock().setBlockData(data);
thanks
?
null not false mb
What
maybe ender dragons dont have that attribute?
dont they?
Could it be a paper thing?
im not sure
try to get one like
GENERIC_MAX_HEALTH
see if it works. if it doesnt its probably that dragons just dont have attack damage like that
I thought about using HolographicDisplay plugin for that, thought about using API but some dude told me that this NMS code is very specific and it can't be replaced with API.
I'll try that out later, have to finish login plugin
does anyone know why this is happening? placeholderapi not replacing any values, the chat message is my own code, and the other one is a premade one
only the wings and head of the enderdragon is able to attack
also the ender dragon is technically like 4-5 entities
one of the reasons it is a pain to work with
how do i get the durability of shears?
does that mean I can delete the dragons wings or use pathfinders to split them apart? lmao
oh my god please try
you probably technically could do this, just not sure how the client would respond to this if at all
its no different then how doors are 2 blocks
and you could therefore have half doors
guess that depends on what packets exist. Whether all 5 entities send packets or only the one "dragon"
Why would you need the vault extension for player name
Aah the scoreboard
IIRC the extension for player name is just Player
Hello guys I want to make a plugin that on block click its open custom inventory and then when player put there a specific item eg apple and click on "accept" item in gui then it will change a block on to another one, is there even a way to make it? Like thrue pdc or smth?
Because in InventoryClickEvent there's no way to get the block and I think pdc needs what block it's need to save
So store it somewhere when the player clicks on your block
Like a map, or make a custom inventory wrapper class that takes it as a parameter
Player insted of valut i guess
how can I stop it?
How can you stop time?
Idk if we are qualified for that question
Use PlayerCommandPreprocessEvent and link it to a function
Instant expires = Instant.ofEpochMilli(pdc.getOrDefault(key, PersistentDataType.LONG, Instant.now().toEpochMilli()));
I want to stop the instant
When the player leaves calculate how long is left and save that
you don;t stop an Instant. it's just a number
Then when they join create a new instant with the saved value
thanks
all you needs to to set a PDC value of teh Instant they log off
I need log out event im guessing
PlayerQuitEvent
thanks
when they rejoin you take the Instant you saved on quit, subtracted from Instant.now() when they rejoin and add that to their clock
okay so I set up that when player click on block
actually no that will not work
and now how I can get this there:
I lie it will work
yes makes sense
yes so I can change block that player clicked when opening Inventory
can I create a method in deathclockutills to save time
public static void saveTime(Player player, Instant time) {
PersistentDataContainer pdc = player.getPersistentDataContainer();
pdc.set(key, PersistentDataType.LONG, time.toEpochMilli());
}
you need to create a second NamespacedKey(plugin, "paused")
makes sense
then pdc.set(pause_key, type.LONG, Instant.now().toEpochMilli())
private static NamespacedKey pause = new NamespacedKey(JavaPlugin.getProvidingPlugin(Main.class), "pause");
you don;t need to pass in an Instant, just the player
call that method on PlayerQuitEvent
create another method for unPauseClock
public static void saveTime(Player player) {
PersistentDataContainer pdc = player.getPersistentDataContainer();
pdc.set(key, PersistentDataType.LONG, getTime(player).toEpochMilli());
}
public static void saveTime(Player player) {
PersistentDataContainer pdc = player.getPersistentDataContainer();
pdc.set(pause, PersistentDataType.LONG, getTime(player).toEpochMilli());
}
pause
public class BlockBreakEvent implements Listener {
@EventHandler
public void block(BlockBreakEvent event) {
Block block = event.getBlock();
}
}```
"Cannot resolve method 'getBlock' in 'BlockBreakEvent'"
private static NamespacedKey pause = new NamespacedKey(JavaPlugin.getProvidingPlugin(Main.class), "pausekey");
This is namespace key
which one do I use
pause or pausekey
pause
ok now I need to do quit event
no, you need to create an unpause method
ok
public static void pauseTime(Player player) {
PersistentDataContainer pdc = player.getPersistentDataContainer();
pdc.set(pause, PersistentDataType.LONG, getTime(player).toEpochMilli());
}
public static void resumeTime(Player player) {
PersistentDataContainer pdc = player.getPersistentDataContainer();
Instant expires = Instant.ofEpochMilli(pdc.getOrDefault(pause, PersistentDataType.LONG, Instant.now().toEpochMilli()));
pdc.set(key, PersistentDataType.LONG, expires.toEpochMilli());
}
no
huh
no to both methods
wy
to pause you are storing the time it is NOW, not the players time
pdc.set(pause, type.LONG, Instant.now().toEpochMilli())
can i silent to block break sounds ?
I posted that three times now
I like Instant
pdc.set(pause, PersistentDataType.LONG, Instant.now().toEpochMilli());
because this is time relative, not a count
instant is basically wrapper around system.currenttimemills
this is correct
whats wrong with the other method
hi bro i can't fix this, still
@EventHandler
public void onPlace(PlayerInteractEvent e) {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (e.getItem() == null || e.getClickedBlock() == null) return;
BlockFace blockFace = e.getBlockFace();
Block block = e.getClickedBlock().getRelative(blockFace);
Block block2 = block.getRelative(BlockFace.DOWN);
if (e.getHand() == EquipmentSlot.HAND && e.getItem().getType() == Material.PAPER &&
block.getType() == Material.AIR && block2.getType() == Material.GRASS_BLOCK) {
e.setCancelled(true);
e.getPlayer().swingMainHand();
block.setType(Material.TRIPWIRE, false);
}
}``` need i add scheduler ?
PersistentDataContainer pdc = player.getPersistentDataContainer();
Instant expires = Instant.ofEpochMilli(pdc.getOrDefault(pause, PersistentDataType.LONG, Instant.now().toEpochMilli()));
pdc.set(key, PersistentDataType.LONG, expires.toEpochMilli());
to unpause you read the value under "pause" then set key to key + (Instant.now() - pause)
PersistentDataContainer pdc = player.getPersistentDataContainer();
Instant expires = Instant.ofEpochMilli(pdc.getOrDefault(key, PersistentDataType.LONG, Instant.now().toEpochMilli()));
Instant paused = Instant.ofEpochMilli(pdc.getOrDefault(pause, PersistentDataType.LONG, Instant.now().toEpochMilli()));
expires = expires.plusMillis(Instant.now().until(paused, ChronoUnit.MILLIS));
pdc.set(key, PersistentDataType.LONG, expires.toEpochMilli());
does this look good
reverse Instant.now().until(paused, ChronoUnit.MILLIS)
wdym
paused.until(Instant.now())
expires = expires.plus(paused.until(Instant.now(), ChronoUnit.MILLIS), ChronoUnit.MILLIS);
looks ok
now to the quit event?
@EventHandler
public void PlayerLeftEvent(PlayerQuitEvent event) {
// get time and save in pdc
Player p = event.getPlayer();
}
you know the answer
public void PlayerLeftEvent(PlayerQuitEvent event) {
// get time and save in pdc
Player p = event.getPlayer();
pauseTime(p);
}
if (!p.hasPlayedBefore()) {
p.sendMessage(DIALOG + ChatColor.GREEN + "Welcome to the server!");
// set time
setClock(p, 10);
} else {
p.sendMessage(DIALOG + ChatColor.GREEN + "Welcome Back!");
resumeTime(p);
}
playerLeftEvent as it's a method
VC?
looks ok
it's 8 parts and no, the client does not like it
= doesn't react to changes
salb just try to describe it
i cant screenshar
i doubt its that hard to explain
so basiclly im tryin to make an plugin with custom enchants
Fr
with 4 in call now 💀
but i have alot of errors
Most active spigot discord bc
maybe show errors & code ?
maybe lol
3 out of 5 enchant are not working
ok so that doesn’t actually help
Why is nobody allowed to put the protection?
you need to screenshot the code/errors
send code
Is it hard or easy to do
The errors are too long?
?paste
yea and the code
Show the errors in whatever application you’re using there should be like an error section atleast
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
LMFAO
I’m new to coding in general and I wanted to try it to develop my skills
do you just use like listeners when something happens and check if the tool has certain meta data or smth
you would most likely want to use pdc for custom enchants
oh I see
help

