#help-development
1 messages · Page 1511 of 1
they literally showed statistics on that in their 1.8 removal announcement
this is devolving into a 1.8 bad discussion can you please ask elsewhere about 1.8 questions
what are you talking about, we are all creating plugins :/
they are being toxic and tries to remove 1.8 plugin developers
Download issue: Cannot wget plugins from your website ( Ubuntu server). getting 503 Error. is there a location to get direct download links?
yes
yes
nah they aren't, its just not updated so why use it (i get people host servers on that version but yeah)
just update honestly
This is support for the latest spigot usually, so if you are wishing support for an older version go elsewhere
Don't think you can do that. You might have to grab it manually
minikloon, one of hypixel greatest developer, he would said that they will modify spigot or bukkit to compatible with newer version, but never removes 1.8
Oooof ok ty
the main problem is you're asking about the particle api which is absolute shit to work with in 1.8
take a look on mineplex
@weak mauve https://www.spigotmc.org/resources/anticooldown-1-9-1-17.51321/
here, have your old 1.8 pvp on 1.17. There's literally no other reason not to use a new version. k thx bye
via version is better
idiot
????
you can use viaversion
via version does nothing for 1.8 mechanics
@weak mauve please move this discussion elsewhere this is a development channel not a 1.8vs latest channel
or simply shut up
lol
yes you should ping md_5 @weak mauve
im not yelling at anyone
sure @dusty herald
Yes.
no big deal
yup, for being rude
yeah, then you cannot get anymore support
i am not sure
@ancient plank
but i cant remember his name
i use modded spigot, so just take a step closer and ask their owner
okay, nobody cares
im here cause it's "faster"
no1 cares
I'm here because it's faster.
Can we just chill out with this non sense
yeah my bad
im is i'm
l6ol you too
Hello, does anyone knows if the material IDs on the bukkitAPI materials class are like random or do they need to be specific?
what?
what do you mean
those ids are the ids from minecraft. just like 1 is stone, 2 is grass
if you mean that
put from:GiaKhanhVN#0001 into the search bar
id's aren't used anymore though
Yeah I already warned him
speaking of which, really wish they'd remove the legacy prefix stuff from the material enum
you can also send a message link if you right click the message and click on "copy link"
i hope it works #help-development message
yeah
was more about their entire message history but ok
ah
did you reload your maven/install every dependency/rebuild it?
Yeah, but the ordered ones like 1,2,3.. are marked legacy and there are new ones all random
im guessing it's just an identifier...
did you also shade it in? or is it a plugin which is already on your server?
Could be, I'll test with some random numbers, just gotta fix my wsl so I can build the jar
Thank you 🙂
👀
How can I save a player's inventory? (It should not reset on server restart)
Is this not default 🙃
guys how to set a Red Wool using Location.getBlock().setType(...) ?. For Minecraft 1.8.8
how can i call an event synchronously from an async thread for example i have a netty thread and i want to call an event when a specific packet is read but when i use Bukkit#getPluginManger#callEvent(new ExampleEvent(playerInjectedToNetty, InfoFromThePacket) the event is async and i can't use the api methods inside it's event handler
You need to call it from the main thread
so just do that just get the scheduler
Then it will allow you to call it
would that work Bukkit#getScheduler#runTask(Bukkit#getPluginManger#callEvent(...), plugin)?
sure
Hey, quick question:
I am currently programming a villager which, when clicked on with a described book, changes its custom name to the display name of the book. So it should be called exactly like the book.
Here is my code for it:
event.setCancelled(true);
```java
if(player.getItemInHand().getType() == Material.WRITTEN_BOOK) {
if(player.getItemInHand().hasItemMeta()) {
ItemStack Book = player.getItemInHand();
BookMeta bookMeta = (BookMeta) Book.getItemMeta();
this.NPC.setCustomName(bookMeta.getDisplayName());
} else
player.sendMessage("this item has no ItemMeta");
} else
player.sendMessage("you don't have the right item in your hand");
break;
default:
player.sendMessage("this NPC is not known to us");```
Unfortunately it doesn't work. Because whenever I then click on him with a book, he changes his customname to "Villager".
The console gives the following error message:
at de.straussfalke.questplugin.commands.NPCHandler.handleNPCRightClick(NPCHandler.java:95) ~[?:?]
in the 95th line I have opened a switch statement that queries the customname from the clicked entity.
Does anyone happen to know how I could solve this problem?
Thanks in advance
Is there any way to change the time a particle appears/force the removal of a particle?
I read that the duration of appearance was hard-coded in the game... Is there a way to get around this with packets?
What is line 95
we need to see
that is what is actually causing the error
That is not actually a thing - it is how you express that something is a method under a class
hmm
switch (NPC.getCustomName()) { is line 95.
or rather, since I have changed something else, it is now line 92.
What class is the NPC - just an entity?
it seems that the custom name is null to me
EntityPlayer
should i send you my whole class?
?paste yeah sure
It didn't work take a look in here https://paste.md-5.net/odeteleyod.cs
@opal juniper
try:
Bukkit.getScheduler().runTask(plugin, () -> Bukkit.getPluginManager().callEvent(new PlayerCompleteSignEditEvent(player, updateSign));
sure... wait
ye same error
is there a gradle version of the specialsource maven plugin (for mojang mappings)
https://paste.md-5.net/obapazetix.bash
@opal juniper
please do not be alarmed at chat output i make the plugin in german
https://paste.md-5.net/ocejufowez.java
this is the whole class
Hi, i'm having trouble while trying to modify a packet to send with ProtocolLib, I can't figure out how to modify the packet for each player with different data each time
and my method to inject a player
Im not sure
ok anyway thnx
I'm trying to make an armor stand have a custom name depending on the player (for now i'm using the player's name)
Yes - i saw this the first time however i am struggling to track down an error in 330 lines of code. Maybe carry on debugging urself 🤷
So how
I've tried sending another EntityMetadata packet but i think this just end up in recursion as the event is called when i send the packet
how do you make something happen every timespan
What say every 5 seconds?
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
something();
}, after_x_ticks, every_x_ticks);```
yep ^^
Hi guys, i wanna ask someone familiar with internals. For some reason when i try to use setBoundingBox to player, the player starts to burn. Could anybody explain why is this happening
Does anyone has an idea ?
after x ticks != every x ticks ?
difference?
I spent like 5 whole hours on google yesterday
the first is an initial delay
The task starts after x ticks and repeats every y ticks
so every 20 ticks, wait 1 tick and do x
ok
how would i do something like that for a player
just use that in a while player is online and use a scheduler?
No need for a while here, as the scheduleSyncRepeatingTask() method already provides a loop
just put an if inside
so
onJoinEvent(Playerconnectthing event){
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
if(event.getPlayer().isOnline()){
doSomething()
}
}, after_x_ticks, every_x_ticks);
}
something like that
Yes, but don't forget to unregister the task when the player goes offline, else it will add another task everytime the player reconnects
so an else if for a break statement
Just do else { cancel(); }
No, just unregister the task
yeah you can do that too
np
and how do you suggest saving a variable, such as a variable keeping a minute salary
Inside the event class I guess
You can and you should use a class with both a command and an event
so i just make a public variable
https://pastebin.com/zctCNtrL like so
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
but how does that save the variable
No the example is for the event + commandexecutor class
but how do you suppose i make player variables
Map
I don't know, i'm not really fluent in java
hashmap?
Map<UUID, WhatEver>
It's like Javascript objects but in java i guess
ok ty
Does anybody has an idea ?
Modifying the entity just end up in changing the name for everyone
I'm trying to modify the outgoing packet
But i can figure out
You can get the player from the packet event
You should be modifying the packet you have, not sending another one
Look up a guide for protocollib
Already did
Tried to follow like 10 different tutorials, all either outdated or not what i was looking for
oooooh
It's setPacket()
i'll try it, thanks !
Hmmmm
Tell the server owners to download the library themselves ?
I would really like to use spring data jpa in spigot, can somone point out what should i look for while doing so, is it just putting in the jpa dependecy from maven? Thank you (i know that i will probably require to create reposiotry implementation classes singleton myself but hey its much ezier for making queris)
Hi, anyone knows why Block.setType(Material.WOOL) isn't placing the blocks? I'm on Minecraft 1.8 and i'm not getting any errors
so i went over to persistent data container, how would i check if a variable is set in the on join event with that, and then set it
I'm making a plugin that will save a player's inventory every time they do /hub. (The data is saved in the config). I'm not good with configs lol and the inventory doesn't get saved.
Main class: https://paste.md-5.net/itikodikew.java
Hub Command class: https://paste.md-5.net/vedihihife.java
(This plugin is dependent on multiverse)
Which versions Is the Libraries feature available in
Hello. I have an issue. I update player's skin at LoginEvent, with the methods that allows that event. It works good, but for Premiun Players. I mean, they can see its skins and others (only premiums). But for people are not, they see (no-premium), TLauncher's skins.
Anyone knows how to resolve that? I had to use that custom way to set skin because I have a offline server and if you are in that, you can not set skins to others by packets or those things. I mean, they cannot see others' skins.
I need help with that.
Offline mode is not supported here. Concider buying the game and enabling online mode
I bought the game, but I want my server offline mode to allow no-premiums connect. I cannot turn on online-mode.
kk
TLauncher uses its own skin system
thanks
Well you're on your own then
We do not support piracy
how do i get a player in an argument
Why would you want that
profit
server hardware doesnt grow on trees
i do not support piracy, but that's how it is
Yeah, what I want is no-premiums see premiums skins, I mean, of others players skins.
What exactly? I want no-premiums see others players premium skin.
Oh right, thanks anyway
As far as i know there's no way to render premium skins on tlauncher clients
because they use some kind of rerouting or game modification to
I remember reading something about TLauncher shutting down soon or something lemme see if I can find it
route the skin requests to their own servers
that way client doesnt even know that premium player is legit
since there's no data on tlauncher side
Ahm, Bukkit#getExactPlayer(player name). Returns null if player is not connected
that's my hypothesis
i don't know if that's true but it should be i think
never tried looking inside auth libraries of mojang
Before I updated to bungeecord, I used to use packets and everyone see skins of others premium players.
i don't know how their backend work
on skin system
but if it worked
try creating bungeecord plugin then
idk
That is for other user that ask for that xd
That's what I did. Thanks
well actually
bungeecord is offline moded
so it should be the cause
you basically need bungee version of skinsrestorer
erm
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "org.bukkit.persistence.PersistentDataContainer.get(org.bukkit.NamespacedKey, org.bukkit.persistence.PersistentDataType)" is null
what to do about this lol
thats the command
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
mainclass
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
is anyone else experiencing issues with mobs being counted as players?
No?
Well it tells you what's wrong
exactly
Maybe do something about it 👀
Im new to java, how do i shrink something like this?
if (Blockname.equalsIgnoreCase("Barrel")) {
if (blockState instanceof Barrel) {
Barrel block = (Barrel)blockState;
block.getInventory().clear();
}
}
else if (Blockname.equalsIgnoreCase("Chest")) {
if (blockState instanceof Chest) {
Chest block = (Chest)blockState;
block.getInventory().clear();
}
}
else if (Blockname.equalsIgnoreCase("BlastFurnace")) {
if (blockState instanceof BlastFurnace) {
BlastFurnace block = (BlastFurnace)blockState;
block.getInventory().clear();
}
}
A null check is part of Java basics ;/
or use getOrDefault
Cast to an interface they all share
🤔
im not sure what that means
Do you know what casting is?
You just used it xd
im editing someone elses code 
but i barely know anything
?learnjava Highly recommend 🙂
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.
anyone know a better way then to use getNearbyEntities()
Better way for what
You shouldn't async thread what you're trying to do anyway
Bukkit API should be avoided off thread
Yes and No if you build it right
Just wondering if there is a better way to get the entities in a set location raduis
I can change my task to do a call back to the main thread with a SynchronousOperation on the async task
Just dont like what getNearbyEntities does
SynchronousOperation is still not a thing
hmm yes it is
That’s not in spigot api nor java std lib
But the idea of a threading practice is the same
Everything is a class the function of what you are doing to the thread is SynchronousOperation on aysnc thread to do a call back to the main thread and await a respond to keep going on the async thread from the main thread
That doesn’t mean the name SynchronousOperation makes sense in Java
Its advance threading.
Sure I get what you mean but that idea isn’t called SynchronousOperation, I am pretty sure that’s just a class in C# or smtng isn’t it?
la sigh...
Anyways the term async task or just sync task will make more sense to people here
15 years coding for a living make me think different, I guess lol
Well, just concerning most people here only develop in Java and haven’t tried .NET so talking about something like SynchronousOperation especially when you use it with the UpperCamelCase people here might get the wrong idea of that being some sort of class and what not. Anyways I guess the name is still self explanatory 
Like a task is a thread, and threads work the same in .net or java or anywhere, you hook into the main app pool or move it out side of the pool. Its all the same
And threading has way more option then async and sync when you start to get hit the advance stuff
Bukkit/Spigot is pretty limit on the threading
I mean a thread is a thread, a task is necessarily not a thread
Its just a fancy work for a thread
Uh well I disagree but anyways that’s besides the point
So in a nut shell I wont get much help here then that is what your saying lol
And also spigot being single threaded is quite advantageous since we don’t have to synchronize stuff all the time and use some sort of lock mechanism.
its not though
you can go out of that thread
the game it self is yes, but you can code outside and find a new thread
Of course you can but if we are working in a multi threaded environment we still need to make sure everything which might be called async is thread safe
It works perfectly with setPacket(), thanks !
Ever heard of taskchain: https://github.com/aikar/TaskChain
That often requires the use of volatile variables and locking stuff in order to avoid certain issues which may be encountered in a non thread safe multithreaded environment
Taskchain sound like the native features build into .net but for java
In kotlin we got courotines or whatever it’s called which is also quite neat
anyways what's wrong with creating a nested bukkitrunnable in an async thread and runTask it lol
cause the task is running free while the async is still running
you are not waiting for the action to return and can cause a desync in the async task and data and cause issues
when you do that in a multi thread env you want to call back to the main thread from a async thread and wait for the respone so the async thread can keep moving based on what was changed
doing the bukkit way is not very safe when you start to code thinking multi threading its very limited
but that's prob one of the only ways you can callback to the main server thread
other than taskchain
there are lots of ways if you code it
Is there an easy way to check if a class is available @ runtime
Class::forName
And when you want to do heavy math but also what to check entitys you can aysnc that thread and just call back to get the entity list and then go back to aysnc with a wait clause on the call back
Oh yeah that might include a lot of thread hopping
how heavy must the math be to resort to that
vector math gets there lol
It is rare that it is done to this extent
tbh anything that can cause a delay should be there, but like before i got crap for trying to save millseconds on a for loop tryign to explain it all adds up and optimiztion is key when it cames to this kind of stuff.
But what do I know right lol
more threads = more power 🤮
not if you build them right
The issue I have with async is that often async means "run it later but not now"
rather i dun know when it will run lmao
async means outside of the main thread
there is a delay option built into bukkit but you can do 0L and have it run right away
that would be called concurrent
yes it is, supried someone knows that tbh
The definition of async is that you have no fucking idea when it runs
its pooled or queued yea
concurrency also means you have no idea how it runs
Well, depending on your architecture that is
in accordance to each other
well you can override the poll and prioptoze it in the thread pool.
And have it run run right away
Some of my threads do that with sync locks so its controlled outside of the thread pool
got me
So i control when it runs not java
how can you get the person who lit some tnt and which event would you use?
You could check in the PlayerInteractEvent
ah, ty
I almost want to say EntitySpawnEvent
yea, that is better
wat other blocks are ignitable
That’s like the only block isn’t it
ohh wait, doesn't the use of flint and steel on any block call it then
Yeah true
does the use of fireball call it?
wat if lightning strikes the tnt, it will just detonate
Hi guys! I have problem with 1.17 and skript.
Can't understand this condition/effect: set action bar of player to "&bPozostalo &4%{nethertime.%player%}% &bsekund/y przepustki" (przepustka-new.sk, line 286: set action bar of player to "&bPozostalo &4%{nethertime.%player%}% &bsekund/y przepustki"')
Can't use actionbar for anything. Someone know why and how to fix it?
but will it be considered ignited
Yes
You're better off asking in the Skript discord
first of all, this is spigot, not skript. also you can't set actionbars
So for whatever reason, my enchantments stopped existing or something? Any ideas on what's wrong? This is my class that registers the enchants.
https://paste.md-5.net/enohobulup.java
Items with them were working before, but now they just do nothing.
meh. I would say that it is valid to ask here, but there are better places for sure
This is what get printed when I print the data from the pickaxe used to break a block. As you can see, it doesn't show an enchant. But that same item, has an enchant according to NBTExplorer.
ItemStack{NETHERITE_PICKAXE x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, lore=[{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Telekinesis"}],"text":""}], Damage=21}}
NBTExplorer ss
as far as I can tell, this isn't being called when lighting tnt, only when lighting other blocks, any ideas?

ExplosionPrimeEvent might be what you want
how would I get the player igniting it?
That would be called when it's about to explode
PlayerInteractEvent should be good i guess, as you can check which item has the player in hand
Check if it's a flint and steel or a Fire charge and you're good
you can do the same with ExplosionPrimeEvent and that is only when something is primied not on every time the player does something
True
always avoid PlayerInteractEvent unless you really really needed 🙂
You can't get the player with ExplosionPrimeEvent though
hmm
for primed tnt getSource does it return a player?
Yeah debug is the best thing to do i guess
event.getEntity() ?
Will probably return the TNT itself
no harm in trying it
Indeed
{
Bukkit.broadcastMessage(event.getEntity().toString());
}
easy test
See what returns
^
this works
Nice
Hey guys does spigot support tnt duplicators?
Which event ?
Oh i see
there you go 🙂
Might want to check if it's a player or not
TNTPrimed actually has methods
indeed
yea i would do a instance check before the player set
That's probably why intellij highlighted it
if (primedTNT.getSource() instanceof Player) {} ?
I guess that would be this
correct
can i create a recipe with custom items? i create a custom itemstack from a config every time the server starts, but it doesnt stack with the last server restarts items. this item is gathered by crafting
is there still no way to increase max durability on items?
i have this to register the recipe:
recipe.shape("*", "*", "#").setIngredient('*', new RecipeChoice.ExactChoice(Items.COMPACTED_DIAMOND_BLOCK.getItem())).
setIngredient('#', new RecipeChoice.ExactChoice(new ItemStack(Material.EMERALD)));
and the itemStack is created every time:
ItemStack is = ItemLoadUtils.getItemFromConfig(Items.COMPACTED_DIAMOND_SWORD.getname());
Not unless you code something you self to control the damage values of what the item has
So it might be due to the nbt data being diffrent
this has to be one of the weirder restrictions of the game
you could hook into the recipe event and override the results with the wanted item
you can look into PrepareItemCraftEvent
The closest thing to it would be adding an hidden Unbreaking enchant, but it's random so it might not be a good idea
the fuck
i see, the problem is, the items are literally identical, same NBT (some tags added though) , same everything. but i cannot stack them, and after a restart they just function like normal diamonds
why did I get 3 back to back reviews
The moment you add any more tags to a item it becomes diffrent and will not stack
so i'm gonna have to do without NBT tags?
try looking into PrepareItemCraftEvent
i will then
You can check the recipe matchs your custom one and then overrdie the results with your custom item
well all 3 reviews couldn't be more different from each other so I am guessing not friends nor bots, just weird
holy shit it finally happened and I didn't even realize it
yea, thank you!
spigot changed the way stars are calculated
on reviews
they now actually average out so it's possible to have 5 stars again lol
aw sick 5 stars
Nice
feels good
what plug-ins have you made ?
elitemobs
ok so how do I add durability to an item without increasing max dura
obviously unbreaking, how well does that scale?
PDC and cancel durability event maybe ;/
oh hey i have decomplied that (elitemobs) to see how you did something years ago lol
For most items, there is a {\displaystyle {\frac {100}{level+1}}%} chance that using the item reduces durability. On average, tools last {\displaystyle level+1} times as long.
you should've decompiled your eyes to see it's open source and gplv3, and has been since the start
I see that now, i think at the time i never thought to look for that stuff.
Hello! I am updating my plugin to Spigot 1.17. I checked this website: https://www.spigotmc.org/threads/spigot-bungeecord-1-17.510208/ but I can't find a way to remap things with Gradle. Do you have a suggestion?
Hello, I would like that the player sees an amount of one item for an item, is it possible ?
You will have to port the maven plugin
man I gotta go dig up my original implementation of this
I didn't understand the question (i'm not fluent in english), would you mind reformulate it please ?
was it the item rotation?
the feature
hmm
i think you can change max durability
but the current problem it is a final field and a short
@tame coral Ah okay 😉 Me too I'm french. When you have 2 apples, you have the number 2 on the item, so i would like that the player sees the number one of the item but I don't know if it is possible.
you can't change max dura
i think you can
i have changed maxStack before and durability is in the same place and looking the same idea
Oh i'm french as well, would you mind telling me your question in french in dms ? (still didn't understand it lol)
I don't think I know gradle enough to do so
I think I will apply the mappings manually
yep
i need to figure out how to edit a final object in java 16, that is the problem for this atm
Damn
I'm french too
camarades c'est le moment d'envahir spigot
Nobody expects the Spanish French Inquisition
@torn shuttle 😄
how i can to create custom light? 1.17
Custom light sources ?
^ Yup
ah
i can't place it in other blocks
i think to use it
but carpets and other passable blocks...
i can't replace it
I see
you can put it anywhere and it set the light soruce at 15 and works out like a torch and adjust the level
And invisible
i can not
because
y?
because it can replace block
check if there's a block at the position right before i guess
and move it up yea
Oh
torch has the 14 level of light
;P
How do i add the placeholder api as a library?? o.o
if you punch it it goes down in the level
use maven/gradle
right click i think
and see javadocs
I use maven
won't it be bad for the server from checking blocks around when a block is placed/destroyed/changed?
import it to pom.xml.
How do i do that? xd
@gaunt hatch, @tame coral?
||sry for ping||
let's go to create request on google.com
And how powerful the machine is
should be fine if you are not doing crazy math check in the method
I mean it depends on how many blocks you're checking too
i think the 20 players maximum and 4GB ram
You'll probably need a bit more of ram
4gb is fine
20*70mb + plugins & spigot
that's all
Because if all 20 players go mining at the same time it'll probably get laggy
just dont do crazy amounts of distacnce check
yeah 4gb is fine
I see
spigot 1.17 in same time: https://imgur.com/xTJZ90P
how can I access a public void while not in a main class?
Class.forName
Hmm there is nothing really when i google "jar import pom.xl"
or dependency inject
PlaceholderAPI has a maven repo you can use
o.o
Where do i findt that? xd
wdym? Also this public void is not static
this area I need to check when breaking a block
Try reading their wiki ;/
https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI#first-steps
what exactly are you trying to do
I'm trying to make a function that saves a player's inventory in the config
y?
lol. save it.
create your own saver
why not use minecraft player saving
and do not use one file for all player's
hm?
how should I do it then?
minecraft savs players data when they logout
and in an interval of x minutes
I think that they want to save it to memory to add it back in the future
y?
like remove previous inventory, add some items and then add their previous items back
like i can see if you are saving to a db
basically
it is not
no im saving to a config
what do you mean? 😂
they just said that's what they want to do
ah, i think you are talking about minecraft saving
I mean you could just save the inventory temporarily inside of a hashmap if you don't care about it being destroyed each time the server restarts
why do you question his idea?
do you have a code example of how you want to access your public void var? @sour rampart
What I'm trying to do: Creating a hub command that when a player does /hub from another multiverse dimension, their inventory is saved and then cleared in the hub. When they come back into that dimension, they get their inv back
or more like where you want to access it
whn i put that in, everything is red
This is my command class: https://paste.md-5.net/jatufovaro.java
question, why is this removing OP? 🤔
Show your POM
and what var do you want to access where?
bc then the player can't use commands in the hub
Also make sure you reloaded the POM after putting in the information
wdym?
there are other ways to do that
you said you want to access a public void anywhere. which one and where? what are you trying to do? or did your problem changed?
This is the public void I'm accessing from the Hub Command class: https://paste.md-5.net/isefezejaq.cs
ah. why dont you just do plugin#saveinvtoconfig
wait thats a thing?
you have there an instance to your main class
private Main plugin;
public HubCommand(Main plugin) {
this.plugin = plugin; // <-- referring to the in the parameter given Main class
plugin.getCommand("hub").setExecutor(this);
}
so you can access your method with your variable called plugin
oh
anyone know if you can make bee stings on a player in spigot? i'm bored
https://minecraft.fandom.com/wiki/File:Steve_got_stung.png
?paste
lol, it does exist?
wdym
isnt it just poison which is given to the player?
apparently it puts a black dot on the player's skin
look at the image in the link i sent
?jd
🤷 spawn a bee at the player's location, set the anger to max and then set the target as the player 😂
not very helpful
You haven't added it ;/
not sure if there is a method to add a bee sting
i checked javadocs nothing exists
same
I have o.o
Wait
just https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/LivingEntity.html#setArrowsInBody(int), but i don't think that its this
declaration: package: org.bukkit.entity, interface: LivingEntity
i have too
i wanted to make a spikey boi
otherwise just do what @dusty herald said, spawn an invisible bee which is angry af and has the player as his target. as soon as the bee stungs, remove it
or you can try to use packets/nms
You have multiple dependencies sections and repositories
what's nms and idk how to use packets
o.o
How do i change that? xd
o.o merge them
...
dependencies {
// dep 1
// dep 2
}
//delete this shit and move 3 and 4 to the above section
dependencies {
//dep 3
//dep 4
}
Remove one of them and put the contents of it in the other one
i searched here, nothin on bee stings :/
https://wiki.vg/Protocol
what about skittles?
In 1.17, to set the id with NBTTagCompound (used for heads), it necessary to give a 4 int in a int[], but I don't know how to convert a UUID generated by UUID#randomUUID in an array of 4 integers
String#split
no
ok towny man how would you do it
skittle api lmfao
Use getLeastSignificantBits() and getMostSignificantBits()
ah getLeastSignificantBits() return a long of 20 characters, so I can split in 2 ?
new ByteBuffer(new ByteBuffer(16).putLong(a).putLong(b).getArray()) and then you can invoke .getInt on it
Efficency 200
(or just use bit shifting, but that is boring)
bit shitting
You can just place it in the nbt as “most”, mostsSig
Thanks,
Do you have an Idea on how I could make this:
I want to make a path from one player to another. What I mean is replacing all the Blocks to make a path.
I tried making a vector and replacing them like this but it didn't really work...
Can somebody help me?
I want to cut my code and i need to call method using its name. That method returns ItemStack. How i can use it correctly?
My current code:
Method method;
try {
method = getClass().getMethod("ru.zacustoms.materials.Items." + getCBT(b).toUpperCase() + ".getItem()");
} catch (SecurityException | NoSuchMethodException ex) {
ex.printStackTrace();
}
Is that your class or another plugin?
my class
Then there isn't a good reason for reflection here
i have an enum
Then valueOF?
Yeah
Enum.valueOf(name of your entry).getItem()
Now make sure it exists before you call getItem on it
Enum.valueOf(Items.class, getCBT(b)).getItem();
you are my safer
tysm
i'll try
I mean not exactly what I intended but uh maybe probably that works
I'll check and tell you.
Do you have an Idea on how I could make this:
I want to make a path from one player to another. What I mean is replacing all the Blocks to make a path.
I tried making a vector and replacing them like this but it didn't really work...
Can somebody help me?
Could you show what you tried
wat dis particle do
https://i.imgur.com/a86ei1e.png
how would i check how a player died, for example if they burned to death or were killed by an arrow something unique would happen
Glow Squid
PlayerDeathEvent
yes i know but
how would i check if they died because they drowned
or maybe died to an explosion
I tried to make the vector longer and longer and checking if it is a block and not Air and replacing it then but I think there is a much better method then this (cause it doesnt really work as well): https://gist.github.com/ItzJustNico/39235c8d33d7556c9af83d02842983ca
You use the same player for source and destination blocks
Also damn that's risky to call
Is there a velocity plugin (like SkinRestorer) that does not have any commands or other functions and just gives all players skins even in offline mode?
Add a cap or something
Offline mode and piracy is not supported here
Oh true
cap?
oh
is this piracy?
@chrome beacon, that works. TYSM!
Well yeah you're allow pirated versions of Minecraft 👀
You would be better taking the start location direction (Vector) to the destination then loop over adding it each time to get each block until you reach the end
nvm you already had one
oh okay 🙂
offline mode is personally only useful for using two minecraft instances to test functionality to interact between multiple players
Yeah this is fine
And honestly people who don't own minecraft after all this time I really don't understand
You’re one of those people 😂😂
Who doesent even have staff trying to enforce discord rules. That’s hilarious
Don't have time to argue with another one of you
chill wtf
Js he’s one of those kids be warned cause that shits sad that he cares that much
how i can to contain BlockData if i haven't current block?
Hello I have a problems i am posting my plugin on spigot.org but i don't understand "Link to the source code for this resource."
Do you have the source hosted anywhere
sry for annoying you again but do you have an Idea on how I could do that one Step (replacing the Block in the Direction to the other Player) so often till the Block is already under the other Person? I tried to make I another while loop around but somehow it is always true...
https://gist.github.com/ItzJustNico/c41c6bf7e5e9fbee3dabefbd3cc11342
@young knoll no it's important?
add returns a copy not the original instance
So it just does the same thing over and over again
I mean I always encourage open source, but no it's not required
okay thank you
how would I do that can you give me an example pls
So.. I have an embarrassingly basic Java question
If I'm building against remapped 1.17 Spigot, I have to use Java 16 to build
Is there any way to do that but still make my plugin target Java 1.8 so people don't have to update Java to run it (assuming they're not on 1.17 Spigot)?
maven or gradle?
If gradle it is sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '11' if maven it is something like that but a bit different but I am too lazy to look it up rn
how can i get my custom recipes in the recipe book?
Maven- thank you for the response, I think I know the equivalent maven config, but I tried that and it complained that I can only target 16 when building from 16 😦
I did try to target 1.8 though, let me try with 11 real quick instead
that is not true
for maven its xml <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties>
You can do that, not entirely sure why maven would tell that
Or
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
if you already have the maven-compiler-plugin specified
I was trying to make them different, like source=16 and target=1.8 .. I thought I needed source=16 but apparently not?
no
Not entirely sure what source and target do tbh
I think source is the bytecode version and target specifies what methods you can use? could be wrong there
^^
Yeah seems fine 1.8/1.8 🤷♂️
I guess I must've changed it to 16 while trying to get the build to work and thought it was part of the solution 😦
Well that's great news though, thank you!
Yeah all working great, brilliant, thanks so much!
Glad I wasn't afraid to ask a dumb question 😂
how would I do that can you give me an example pls
Store location in a variable and set that variable everything you change the loc
okay I will try that
and delete the second while loop?
sry but I still dont get what you mean
So my enchants suddenly don't work anymore. Spigot doesn't recognize them on items or something, they're there, NBTExplorer shows them, but Spigot can't see them.
Wrapper:
https://paste.md-5.net/ezinasijis.java
Enchantments:
https://paste.md-5.net/oxinijamip.java
Simple question, but I've looked at this several times and see no issues yet I get an error when trying to give myself this item.
public ItemStack babyTear() {
ItemStack babyTear = new ItemStack(Material.GHAST_TEAR);
ItemMeta meta = babyTear.getItemMeta();
meta.setDisplayName(ChatColor.DARK_GREEN + "Baby Tear");
meta.addEnchant(Enchantment.DURABILITY, 1, false);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
List<String> lore = new ArrayList<>();
lore.add(ChatColor.GRAY + "To view recipe" + ChatColor.YELLOW + " right click" + ChatColor.GRAY + "!");
lore.add("");
lore.add(ChatColor.DARK_GREEN + "Common Drop");
meta.setLore(lore);
babyTear.setItemMeta(meta);
return babyTear();
}
Send the error
is the stacktrace cropped?
I am sry but I dont get it still
wym cropped
SOE usually produces a lot larger stacktraces
The full stacktrace is required to know where it performs the recursion
In 1.16.5 how can I check if a mushroom_stem is from a brown or a red mushroom?
Check surrounding blocks
it says that the issue is on line 186
which is just
return babyTear();
WAIT
bruh
im smart
I do that already but was hoping I wouldn't have to do that. Since I'm already checking the blocks before the stem
ty for the help
Thats fucking stupid... no data to say its a brown mushroom? or anything? 1.8 is proved better once again.
it certainly isn't bukkit API in either version
replanting
Need to know if the mushroom should be brown or red. Atleast with the nether blocks it says crimson or warped stem
it isn't something that is needed by the vanilla system so bukkit cannot infer it at all
Unless there is a difference in the data byte, but that one shouldve been removed by now
damn they don't?
????? Mycel biome (Mooshroom island)
That's not growing, it's world gen
🤦
If you plant a small mushroom it will own grow into a big one when bonemealed
and it is growing like a sapling
"<saplings> don't grow on their own, so replanting isn't super necessary"
The same discussion can be made with swamp trees
damn beat me to it lol
Well, swamp trees are extra different because they have no sapling
Saplings grown on their own
You can get the tree type from a log/leaves and get a sapling from it
because the logs are different blocks
But vanilla does not require to know the type of the stem to determine the type of the sapling
so are mushroom blocks... in 1.8 the stem was HUGE_MUSHROOM_1 or HUGE_MUSHROOM_2 with a data value of 10
what are we arguing about
What are you looking for
Why you can't check if a mushroom stem is from a brown or red mushroom
not in 1.16.5
i'm not sure if they are
check the mushroom block blockdata
if there's no way there, there is no difference between a red and a brown stem
The distinction is no longer made at all starting from 1.13, and bukkit cannot recover that information
^
Differentiating data literally does not exist any more. If you really need to know, you'll have to add and track metadata yourself.
even metadata will not help
Exactly... thats my issue lol... Currently I just move up the stem untill I find a mushroom block but having to do that on 60k (just a random number it can be higher or lower) mushroom stem blocks is kinda BS
what is the use case exactly
why are you complaining here? this was a design decision by mojang / microsoft
what is he doing
Replanting it appears so
I'm assuming something that uses mushroom stems as saplings?
i.e. grow the type of mushroom it came from.
it use to when you can check if the stem was a brown mushroom or red mushroom
what
I mean this isn't the kind of thing that would be built into spigot
we already established that
They want to replace small mushrooms when a big one is chopped down
yeah... I'm just complaining about the fact it was changed xD
It is useless data, so why store it?
surely you don't have to check 60k mushroom blocks all at once when someone chops down a mushroom
Up to the user
someone is not going to have a fucking 60k block tall mushroom
Its multiple stems
why do you care about adjacent stems
The build height is only 255 lol
Now I kinda want to make a generator for a 60k mushroom lol.
I check through multiple stems at the same time
then there are only up to 255 blocks to check
I feel like a bit of optimisation can be done
why are you checking multiple stems at the same time
a player can only break one stem at a time
Such as skipping every second block
My lumberjack minion
a mushroom can only be of one type at a time
only the type of the stem that is broken is relevant
There is no stem type... thats the issue
type of the stem as in the block above that stem
adjacent stems are irrelevant
blocks on top of adjacent stems are irrelevant
stem width is irrelevant
sigh it checks every block in the radius...if its a stem block with mycel/dirt underneath it checks every block above untill it finds a brown or red mushroom block.. then replaces it with a red or brown mushroom.
why are you checking every block in a radius
Please read the convo you are answering to lol... I keep having to screen shot messages
you are doing something redundant
that is not an answer
That is an answer
it is not an answer that has any value
does your lumberjack minion kill all trees in a 20 block range
if so, that's entirely your fault for having to check so many blocks to begin with
LOL... thats not an answer that has any value
it's not an answer
it's the truth
if you need to destroy all mushrooms in a 20 block range, then you need to first find all mushroom blocks in a 20 block range
it has nothing to do with stems
🤦
even if you could check the type of a stem directly, you'd end up doing the exact same amount of work
re read the whole convo please
Then i can't help you understand it
you are locating mushrooms and then A*'ing them to cut them down
this process involves traversing up the stem to the blocks above to begin with
What about Inventory#getTitle() for InventoryCloseEvent in 1.17?
even if you could check the type of a stem directly, you would still have to do that
why it isn't exists
how i can get title of closed inventory?
that you have to check 60k blocks is just because you are finding 60k blocks, not because you are finding stem types
If I could check the type of the stem... I would only have to check 1 block... since I can't check the type of stem like I could before 1.13 I have to check the stem block plus every block above it untill it finds a brown or red mushroom block then set the block to a red or brown mushroom.
you are cutting down an entire mushroom, yes?
not just the 1 lowermost block, yes?
Take this picture for example... Which stem is a red mushroom or a brown mushroom?
those aren't huge mushrooms
They were but the lumberjack removed the mushroom blocks
why didn't it remove the stems
with the InventoryView
Well that seems like the lumberjack's problem?
but please don't use the name of the inventory to find your FUCKING custom inventory
because I haven't added that method yet. I wanted to know if you could check if a stem is brown or red in 1.16 without checking each block up until a mushroom block.
instance comparision!
you can, yes
No you can't
you can
You have to check the blocks above the stem
by plugging it into the A* you use for actually cutting down the mushroom blocks themselves
you do, yes
but you're already doing that
That is kindof useless since they are already doing that either way with the lumberjack algo
I know... I don't want to do that though and this was already resolved if you read the convo like I said... I'm just complaining about the fact that 1.13 breaks things once again.
Ok, convo done. ^
well, i use it another method now. I use getMetadata(string) because on my inventory location must be certain block
lol
You would think so lmfao
he's right 1.13 did break alot
but it's still doable
i have a custom item (a "compacted diamond") that i can use to craft other custom stuff. now, when i restart the server, those cant be stacked with newly created ones, nor be used to create another custom item
https://pastebin.com/cYCf56Vt
(you just put in a configuration section and you get the item the section represents)
how can i fix that?
is it the NBT tags?
haha ty for this
I'm done lol its over.
Aren't treemaps inefficent for that?
depends on what you're doing
for purely random access yes, they're slower
but the advantage is that they're sorted
that is, you can get the nearest block B above block A in logarithmic time
there are several other ways as well that can be used but that is the first one that comes to mind
if only one mushroom is processed at a time, just a x/z map will suffice
for(int b = 1; b<=10; b++) {
Location check = new Location(remove.getWorld(), remove.getLocation().getBlockX(), remove.getLocation().getBlockY()+b, remove.getLocation().getBlockZ());
check.add(0,b,0);
Material checkType = check.getBlock().getType();
if(checkType == Material.getMaterial(pl.getItemMethods().materialFromVersion("RED_MUSHROOM_BLOCK", (short)0))
|| checkType.name().contains("HUGE_MUSHROOM_2") || checkType.name().contains("RED_MUSHROOM")) {
remove.setType(Material.getMaterial(pl.getItemMethods().materialFromVersion("RED_MUSHROOM", (short)0))); replaced = true; break;
}else if(checkType == Material.getMaterial(pl.getItemMethods().materialFromVersion("BROWN_MUSHROOM_BLOCK", (short)0))
|| checkType.name().contains("HUGE_MUSHROOM_1") || checkType.name().contains("BROWN_MUSHROOM")) {
remove.setType(Material.getMaterial(pl.getItemMethods().materialFromVersion("BROWN_MUSHROOM", (short)0))); replaced = true; break;
}
}
``` I have to run this on every stem thats on top of mycel or dirt so if there is 60k stems.... times it by a max of 10
This is the code I'm replacing its over 4 years old.
again, no you don't
or, well, you do, but that work is already done anyway by virtue of the mushroom being A*'d to find the blocks to destroy
so there is no increase in the amount of computation required
1.13 removed the ability to check which mushroom a stem is from. I asked if 1.13+ had a new way to check. It doesn't... Convo ended. You brought it back up. I explained everything over again. You are now just repeating exactly what I already do. Convo done.
i'm telling you there is a less fucking retarded way of doing it that tracing each mushroom back up for every individual stem block
the bigger sin is to not cache materials
4 year old code
Thats why its being recoded lol
then maybe take heed of my suggestion to improve it instead of convo-done'ing it without even trying