#help-development
1 messages · Page 1957 of 1
hey, so I have managed to get a working persistent data storage system using .json's but whenever it tries to save to the file i get this error
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:72) ~[server.jar:git-Spigot-21fe707-741a1bd]
there's a reason why stacktraces normally have more than one line 😛
so
send the full error pls
?paste it
still not the full error
or maybe not it's so long the console won't even show the whole thing
then use the log file
the actual error message would start with something like "Uncaught exception ..."
ok
Optional.orElse(null)
yeah I know, it just feels strange that get() doesn't work
( i know, the reason is that there COULD be something present which is null, I just think it's weird nonetheless 😄 )
yes
you do the same stuff over and over again
you caused an infinite loop
he is probs doing the thing he is listening for tbh
🙈
if you spawn an entity with api, is an entityspawn event called?
believe so
oh
i mean, why wouldnt it be
probably because server handles the spawn
i kinda hope it does
so you basically call a InventoryClickEvent in every InventoryClickEvent
so, at the top of your line 77
do
if(event instanceof OptionClickEvent) return;
alright
kekw
new Runnable() {
public void run() {
p.closeInventory();
}
}```
You are actually meant to do this
it might be for an api
yeah might be but even then, I wouldt make it extend InventoryClickEvent
delaying it y one tick smh thats stupid
it would confuse other plugins

The following should never be invoked by an EventHandler for InventoryClickEvent using the HumanEntity or InventoryView associated with this event:
HumanEntity.closeInventory()
HumanEntity.openInventory(Inventory)
HumanEntity.openWorkbench(Location, boolean)
HumanEntity.openEnchanting(Location, boolean)
InventoryView.close()
To invoke one of these methods, schedule a task using BukkitScheduler.runTask(Plugin, Runnable)
it doesnt extends inv click event :kekw:
No one ever reads that though
yeah closing an inv in an inventoryevent should ALWAYS be delayed
why too?
otherwise it'll fuck other plugins listening to that event if they do stuff like if(event.getInventory() == player.getOpenInventory()) or stuff like that
Because InventoryClickEvent occurs within a modification of the Inventory, not all Inventory related methods are safe to use.
According to the docs
yeah that's what I meant
closing the inventory while other plugins will still get an event related to that inventory is not a good idea
How do you call another async function?
many ways
object : BukkitRunnable() {
}.runTask(plugin)
object : BukkitRunnable() {
}.runTask(plugin)
use a CF
one to anotehr
or like a ForkJoinPool
dunno what those are
so do i put it on the line on top of 77, because that gives an error
CompletableFuture.supplyAsync(Supplier<T>)
Im trying to launch fireworks in a downwards motion starting from players y coords * 2 then for loop 6 to 1 and then slowly going down and down and it does work, but when i do it in an async function with a thread.sleep it looks funny (in which i mean it launches all the fireworks, waits for each number in the loop asyncly and w/ the thread.sleep timer) and instantly fires them one by one (i have an instantfirework function that makes one then explodes it immediately) but it does not seem to work the way in which i want it to, because rather than all launching at same time then slowly exploding one by one i want it to just explode one by one from top to bottom until it reaches the location 0
erm
ok so i dont think stuff like that is threadsafe but i might be wrong
of course you put it inside your event handler
otherwise its gonna be like runTaskTimer or something
here is my example -- this is what i dont want it to do
https://gyazo.com/a0cb7ffd8063edf3bb9e35813f5cb8e8 -- i want it to make it feel like its going from top to bottom downwards, doesnt look like it though
what you want them to explode at different times?
maybe my explanation is bad but i want it to look a way in which it starts going from the top (location.y+20) and start going downwards, with each firework exploding at them times (i have the instantfirework function for that), but for some reason the async and thread.sleep with the loop doesnt make it look like the way i want it to where it would start going down
rather, it just waits... then explodes them (see gyazo) its weird, because im thinking about the logic behind it and it should work but doesnt?!"
maths ew
they literally explode at the same time wtf
so ugly
i just want it to go from top to bottom and each firework explosion wait like 10 ticks then go to the next one
shouldnt be that hard but looking at the gyazo video clearly it is
maybe im just not waiting for the instant firework function to finish
how can i wait for that to finish?
schedule them
maybe if you just send the code
try a for loop and multiply i by the amount of ticks you want to have between explosions, then schedule inside the for loop using the multiplied i
?sl
?tags
solved. had to mark the event variable as transient
So i am trying to evaluate whether you could walk to a current location safely based on the:
- Current location to check
- two previous locations
Im not really sure to go about checking it tho. I did it before by checking the max height change over the three and then doing some logic with that, but it didnt work all the time
Hey I need help with changing textures for specific items, this is the stick.json file { "parent": "minecraft:item/handheld", "textures": { "layer0": "minecraft:item/stick" }, "overrides": [ {"predicate": {"custom_model_data": 1000001}, "model": "item/chips/chip1"}, {"predicate": {"custom_model_data": 1000002}, "model": "item/chips/chip2"}, {"predicate": {"custom_model_data": 1000003}, "model": "item/chips/chip1"} ] }
And this is what I get
you would need to add a handler to the console logger. First work out what that logger is, then you need to add a custom ConsoleHandler iirc
Do you set it's model data to that which you specified there?
The default one looks the same
Wdym
But yeah this is what I get when I give the items with any of the custom data
Okay in that case I recommend you enable your client output console and check what it outputs while loading the pack.
There might be issues with the models
How do I do that
ComponentBuilder is the easiest way
@worn tundra it also works if I override the stick png
so what do i need to put in because i want to make a simple 4 or five question quiz
If you use the official mc launcher, then you can enable it here:
Are you sure the paths are correct?
Inside of assets/minecraft/models
yeah there's definitely something wrong with the filenames
do you have a custom stick json file?
with the path for the actual texture file in it?
here's an example resource pack that works. it has one custom texture for music_disc_11. maybe it helps, idk
does that duplicate every message?
like the publish call sysouts it
so if you run the plugin does everything happen twice?
cause you are adding a handler
implying that there are more than one
@stiff zinc Did you fix it or?
ok so you can replace the sysout with your discord message send
yep, put your addHandler onLoad and load your plugin PreWorld, other than that nothing else you can do
Plugin.yml:
load: STARTUP
Main class:
@Override
public void onLoad() {
// Code Here
}
cool 😄
@EventHandler
public void onChat(AsyncPlayerChatEvent e) {
Player p = e.getPlayer();
TextComponent message = new TextComponent(p.getName());
message.setColor(ChatColor.GREEN);
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder(ChatColor.GRAY + "Name: " + ChatColor.GREEN + "" + p.getName()).create()));
}
How can i bind this hover event to the user's name?
wdym
IS THIS BAD
like it wont bind it to the user's name when they talk in chat,
oh
So i was wondering how i can get it to bind to the user's name when they hover over it
use a separate component
ok but what component...
oh I know what you mean dishy
ye, just wanna make it so when u hover over the user's name it shows some info, ( obviously i wont use the user's name considering how thats just a testing placeholder )
cancel window events
example pls
that was for 2Hex
window events?
cancel inventoryclickevent and inventorydragevent
^
i know how to do that
but isnt there a way of sending a view only crafting grid, that isnt actually a gui open
no
no way of even doing it with packets?
there are no "read only inventories"
you have to make them "readonly" by cancelling the respective events
Soooooo do you know how to do on what im looking to do?
why do you even need a crafting inventory if it's not going to be used?
Alright and is there a way to show a player a crafting inventory
Showing recipes
it's a recipe book, I want it to look fancy
just do Bukkit.createInventory(...., InventoryType.CRAFTING_TABLE) or however it's called?
well you have to cancel the chat event and send the formatted message to everyone
alright id assume formatted messages is setting a custom chat format?
what are you trying to do?
Trying to make it when you hover over the user's name it shows some info
ah okay
kinda
not sure whether setFormat or setMessage supports actual textcomponents etc
you'll have to try it
ye ig
"well you have to cancel the chat event and send the formatted message to everyone"
anyone able to help me
?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!
yeah but you can convert components to legacy text
but not sure if that still works for hover events etc then
probably not
as I said, to add hover event to the player's username you'll have to cancel the message event and then broadcast the message by yourself
you did what
ask when i click true i want it to send another message with true or false
i dont want a command because i am creating a quizzing plugin for ranking up
if the players don't have permission to do the command can they still click it
sure, it will show them "you don't have permission" when they click it
"clickable commands" are no different from normal ones
the server just sees "oh they ran command XYZ"
o then i cant do what i need it to do because i dont want them to do tyhe command and just start giving them there own ranks
🤦
can u give me an example, i just tried doing the broadcast thing and it will only let me broadcast the chat component thing,
u wanted the command
to be ran by console?
lemme show mine
click true it sends another message with true or false and then if you click false it saends massge saying incorect
is the message
related to the person clicking True
yea still not exactley what i needed
hello im working on a project and I'm not sure how to do something.
The current code has an EntityDamageByEntityEvent (To calculate and set fireball damage) and a PlayerInteractEvent (To launch fireball)
How would i add messages "You were hit by fireball from %distance away% for %damage amount% by %player%" and "Your fireball hit %count% entities for %total dmg%"
I know how to do message placeholders im just not sure how to link both of those listeners together and send a message when a player uses the fireball/takes damage from one.
how do big servers create seperate minigames?
do they just have a shit ton of plugins, and then an internal api to communicate?
o
Whats the plugin for pvp ranks ? 
you cant do that in 1.8 i dont think
yeah im using 1.8 before someone comments on it
i know its old asf
i have my reasons
We don;t support 1.8 anymore
"we" ?
go to the shame corner if you use 1.8
This channel/Spigot/Everyone
:C
Hey
Hi
they have oil
Does someone know if it’s possible to change the behavior of a block? Like making that we can place a cactus block on a netherite block and cactus can grow on it?
Quick question guys
can: you #do this kind of inline comment in yaml?```
or: do
#you have to give a whole line to it```
Both work
And is it possible to stop updating or force updating a block if this block have a specific blockstate or blockdata?
Cancel the physics event
Oh and how can I do it ???
And potentially other events
Because I’m making new blocks with unused blockstates
And I use unused variants of tripwire to make new plants but I want to know if it’s possible to prevent their interaction with normal tripwire.
if (event.getAction() == Action.RIGHT_CLICK_AIR){
if (event.getPlayer().getInventory().getItemInHand().getType().equals(Material.COOKIE)){
if (event.getPlayer().getInventory().getItemInHand().getItemMeta().getLore().equals("hi")){
event.getPlayer().sendMessage("Yay");
}
}else{
event.getPlayer().sendMessage("This isnt a cookie");
}
}
Why this dont work?
That will never work
oh no forge v2
getLore returns a list of strings, it can never be equal to a string
For one thing
i mean it makes sense
list.equals hi ah
but many people still use 1.8
Lol we haven't supported 1.8 for years
tell that to owners not to devs
We do
its not our choice is it
Sure it is
u cant force an owner to change his whole server version becuz u told him to
i got my /msg command but how can i implement /r so the user doesnt have to type their name and they can automatically reply
No but you can just not develop for 1.8 servers
get latest sender / reciever
Remember who the last message target was
how
You could just do a map<UUID, UUID>
by learning java
Bruh stfu kid
(aka what coll said)
u 12 or something
Thanks
telling you to do something useful = being a 12 years old
You are not adding anything to the conversation
i mean if u learn 15 minutes of java from some yt vid
u will get that basic knowledge
wont you
Well yeah
but then you dont get paid
from them
a ton of servers are 1.8
Blocked
ok
Anyone that calls other people 'kid' is sub 14
so what is right
can anyone help me how to acces my main files properties like getConfig()?
There are plenty of not 1.8 servers to work with
He’s definitely not wrong lol, 1.8 is still very popular
from outside my main
Im not sub 14 😄
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I dunno about that one chief
Missing out on a whole chunk of the market is bad for business
im 18 mate, what about you ?
I'll respect that you blocked me instead of continuing but honestly that would not make me lose anything
this guy is still talking
So are you
Specifically chosen number to not be a kid, but closest to your own age
Anyway
instead of saying learn java, maybe add something to the conversatin
Lmao
not sure but most of the people asking me for commissions are 1.8.8 servers
yeah... i totally agree... and i stopped helping him... its kinda useless since that guy dont know anything of programming and also he asks 100 questions and 99 of them are just easy API-Reading problems
That’s not necessarily proportionate to the size of those servers though
If you want to work for 1.8 servers, you should know how to handle things yourself
What are you even talking about
It doesn’t matter if there’s 1000 1.18 servers and only 100 1.8 servers if the 1.8 servers pay more than half of the commissions
Right now? Nothing
Get blocked
Lmao
Wasn't there a story like that back in 2021
This is also a fair point
That's def a kid move
Just leave him tbh
Same if you want to run a 1.8 server
same thing happened to me last year
the guy just moved on after blocking most of the people here, and its not worth to make an argument
Not necessarily
we are evil and do not support 1.8
You don’t have to know how to do anything technical to run a server
You just have to have enough capital to make up for that
No but you should have the resources to handle anything that goes wrong
You won't see hypixel coming here for help :p
Most of the ones still running 1.8 do lol
thx i fixed it now
would be fun seeing hypixel devs here
That honestly still doesn't make asking for help bad
since you can never memorize everything
Live Chat provides better understanding
I mean
We provide more legacy support than paper
They'll just tell ya to get hecked
If you need that much help then they’re right, you probably aren’t ready to support 1.8 by yourself
Same thing for forge
if you are talking about me, i came here for a general question, not a 1.8 specific question or help
🙂
I'm happy that there are still people here answering legacy software questions
Not everything revolves around you
Nope not about you
All you should realistically need are the Javadocs, wiki.vg and maybe a decent decompiler
this has been an argument since years
Mhm
It’s not about the pvp mechanics themselves, the client just feels different
you will have to change a lot of the community creations for that
Also pre 1.14 textures yucky
for example Mods
there are way too many 1.8.8 PVP Mods
to just switch over to latest version
It's kind of an endless cycle
1.8.8 move on challenge (impossible)
although not many still use forge to pvp It's still a problem
The servers won't update past 1.8, so plugin and mod devs keep adding support for 1.8
you have to convince both clients and servers to move on, which is really hard
Which makes the servers not update
(Just stay on 1.9 pvp)
Realistically the problem is that minecraft Java supports switching your version that easily
and with moving on to newer version, some devices will stop running minecraft
If they just forced everyone to update it wouldn’t have happened
since it will require better specs
I know many people that cannot run 1.18.1
but can run 1.8.9 and they play it everyday
whys everyone talking about 1.8 again
Hi! I got two questions. How would I go by creating a gui like this? http://prntscr.com/26x519v this is the image that they have in the resource pack for it http://prntscr.com/26x51od , and secondly how would I create that number right that with the member count?
texturepack
that's a good amount of work tbh
the creators of that resource pack made it look awesome
Mhm
and yeah its probably an item remodeled
the numbers or the entire resource pack? Cause they are no items underneath where the number is
Not sure how that works
Maybe it generates a dynamic resource pack for you when you log in
Or it just updates the count in the global resource pack every hour or whatever
maybe it detects the gui by nae
name
then changes the texture, if there is a way to do that
Extract their pack and see if it's one texture :p
I sent it here http://prntscr.com/26x51od where the texture is
found this
thanks
Guys i registered events from another class into my main class, then i moved my gui work and all that to another class,
And the guis open and everything is set but for some reason i can still drag items around and stuff even though in the code it cancels it,
I don't know if that is a genuine spigot bug... or not..
No
Wait
The solution you got offered is very sucky
One of the worst ones really
Here's how Mineclub actually does it:
https://www.spigotmc.org/threads/custom-inventory-ui.525744/
ItemStacks have not been used for custom GUIS for a long time
this is in my on enable area,
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new ranks(this), this);
( I used another from another plugin for an example
Is there a way of differentiating between top/bottom slabs?
how would i add subcommands in the onCommand() method?
when i try to use args[] it doesn't work
What doesn't work?
args[0- whatever number]
Also make sure to check with args.length
Woow! Thanks!
If you need any help or sample packs (for example Mineclub's pack), feel free to dm me
anyone know how to get the config's one of my section all values?
?
with like a for loop
i mean
to get a getConfig().getConfigurationSection("warps").getAll()
something like this
You can use getKeys to get all the keys
Alright! Thanks! I actually have mineclubs pack 😄 Are you like a dev there or something?
Yeah, been studying those servers packs for more than a year now
Woow! Okay! Thanks!
Can't you also make custom fonts and only retexture characters in that font
And then use that font in a component
Yes
That's one way you can actually display text anywhere on the screen in pure vanilla
(With only a < 1mb resourcepack)
can i make text on a sign that is inviseble but code can see it
Not sure if that's right
Ikr
anyone know how can i fix this?
package me.andris.warppl.commandTabs;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
public class warpTabCompleter implements TabCompleter {
public JavaPlugin plugin;
public JavaPlugin hello(JavaPlugin plugin) {
return this.plugin;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String s, String[] args) {
if(command.getName().equalsIgnoreCase("warp")) {
Player player = (Player) sender;
if(args.length == 1) {
List<String> warps = new ArrayList<String>();
if(plugin.getConfig().getConfigurationSection("warps") != null) {
for(String names : plugin.getConfig().getConfigurationSection("warps").getKeys()) {
}
}
}
}
return null;
}
}
fix what
Fix what
it says an err at getKeys
would something like this work for a subscommand?
if (args.length == 2) {
if (args[0] == "create") {
if (args[1] == "54") {
MenuStorageUtil.createMenu(args[2], 54);
}
}
}
can i make text on a sign that is inviseble but code can see it
is that java?
yes
Yes?
then no
Can't use == for strings
i am trying to make a quiz theat telepoets when you click true or false
Better ways of using other plugins that don’t have an API than getPlugin(“plugin”) to get the main class ?
Having an instance
how do I force a player into a server, when it's at max player limit? (Bungeecord)
i am trying to make a quiz theat telepoets when you click true or false
you must use .equals()
or equalsIgnoreCase()
exactly
ok
i am stupid
i forgot
thanks
Ok cool I figured that was the case but something I read led me to think otherwise let me find it quickly
I do that sometimes
anyone does those silly things like that
You could store data inside of the signs.
people that don't use an ide
😄
Nano and javac
can anyone help me to loop a ConfigurationSection's all vales with its name?
You could for example use PersistentDataContainer. The Sign class extends PersistentDataHolder:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/persistence/PersistentDataHolder.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/persistence/PersistentDataContainer.html
Hey, how can I do to throw the player back during the Move Event (it will be good if there is a raw code)
i had an idea with invisable text
Set their velocity to their direction * - 1
how do i do invisible text
And then maybe add some exta Y velocity
hi how do i edit nbt data of a fireball
a thrown one
to contain the shooter's UUID
or name
?pdc
Also projectiles should have a setShooter
for String key : section.getKeys(false)
// get value from key
It should be a List so you can just loop trough it
wat does (false)
do?
The boolean is for recursing
you forgot a )
You should put your configuration section there

that doesn't compile
section.getKeys(false).forEach 
With no brackets? no
But if you don't know how to add the brackets you need to learn java
ok for some reason this is not working
if (sender instanceof Player) {
if (cmd.getName().equalsIgnoreCase("mm")) {
if (args.length == 2) {
if (args[0].equalsIgnoreCase("create")) {
if (args[1].equalsIgnoreCase("54")) {
MenuStorageUtil.createMenu(args[2], 54);
}
}
}
if (args.length == 2) {
if (args[0].equalsIgnoreCase("create")) {
if (args[1].equalsIgnoreCase("45")) {
MenuStorageUtil.createMenu(args[2], 45);
}
}
}
and so on
wait let me use hastebin
nice indents
does PlayerLoginEvent call for players connecting via bungeecord?
Guys how can I make a transition between two EulerAngles?
Given a specific time
The thing you use for ArmorStand poses
dig up euler and ask him
oh idk
wait after every if statement for args do i have to add a return true
💀
Wherever there is a return, the method will stop reading any contents left down, so if you are doing something after it it wouldn’t run
I think… maybe
I don’t really know
I’m struggling to find out how to have an animation between two armorstand poses
help me pls i have no idea whatis wrong my problem is NullPointerException at my file's 30. line
https://srcb.in/sLxpTOT0kz
Anyone knows?
Are you sure that section exists?
no
thats why i created that if statement
Could you send the error please
one moment
wha
public JavaPlugin asd() {
return this.plugin;
}```
nice name
why is the variable public
But wait
if(plugin.getConfig().getConfigurationSection("warps") == null) {
plugin.getConfig().createSection("warps").set(args[0].toLowerCase(), loc);
plugin.saveConfig();
}
if(plugin.getConfig().getConfigurationSection("warps") != null) {
plugin.getConfig().getConfigurationSection("warps").set(args[0].toLowerCase(), loc);
plugin.saveConfig();
}```if else?
Where is the this.plugin variable set?
please not by using the instance.plugin = this;
public variables 💀
anyways would anyone wants to check my lang file for grammar mistakes?
Sure
Eh looks fine
comma after im sorry
I mean I just skimmed over it but it's passable
I actually don't think it's necessary to put a comma there.
Let's see what LanguageTool thinks...
for some reason when i type "/menu create 54 example" it doesn't run the method i have set up
i'm sorry, but you don't have permisson to do that
if (args.length == 2) {
if (args[0].equalsIgnoreCase("create")) {
if (args[1].equalsIgnoreCase("45")) {
MenuStorageUtil.createMenu(args[2], 45);
}
}
}
Oh nevermind
well
LanguageTool says an HTTP connection is wrong and i should say a HTTP connection instead so
it only says that everything is good with me
i need an array of unordered pairs and no pairs can have the same 2 elements anybody know if this has a name?
hashmap? 💀
that was my initial thought but
those are like ordered pairs i would think
k:v and v:k can both exist
ye obviously
you specify the generics and problems are gone
unless its a map with two times the same type (map<string, string> fe)
if its String,String you need some extra checks i guess
BiMap
if you have a list<parent interface> with multiple child types inside and you do for(childtype : list) will it only iterate the child types? or does that not even let that happen at all
BiMap has the notion of K -> V as well as V -> K
oh
so in principle a bijective function
Ill check it out
guava?
myes
i am having such a hard time trying to figure out how to get something from this yaml rn
x:1
z:1
....
list_of_serialized_objects:
- serialized_object
key2:
....
how do i get that list
you can only have one "key" in one mapping
^
because you are having a key value pair first and then it finds a list
ah okay
wait
so im looping through all the keys
I believe you might wanna do sth like getMapList or if it was getListMap
getList("key.list_of_serialized_stuff") i guess
would this make a working subcommand? }
}
}
if (args.length == 2) {
if (args[0].equalsIgnoreCase("create")) {
if (args[1].equalsIgnoreCase("18")) {
MenuStorageUtil.createMenu(args[0], 18);
}
}
}
how can I get the arguments from the PlayerCommandSendEvent?
havent you fixed your formatting yet ._.
and is the list of MemorySection or ConfigurationSection I cant figure that one out
wat
lmao i am about to just make a separate file
when i dont have my ide open 💀
Ill just share my full code
yea
there is a FileConfiguration#getList which returns a List<?>, are you looking for that?
theres getMapList which returns List<Map<?,?>>
hold up im gonna get this looking nice and pretty
i thought he was getting the list of serialized objects?
ok actually
actually ye but no
I am not sure what the files gonna look like or if it will save with how im saving it
well u need to know the format?
Yeah i thought i did
hold up
ok its weird so i am
this file all the keys are just serialized objects
but then they have lists of different serialized objects
what are you trying to do?
https://paste.md-5.net/ureboviguh.java can someone tell me what i did wrong please
fix your formatting please
subcommands don't work
oh god the formatting
should i include claim serialization too
what im getting at on my own thought is that to do this i need to give claims an identifier
can someone just tell me why its not working instead of mindlessly critizing a closed source project
derserialisation sucks
what does a list<map> look like in yaml
this doesnt make sense
Player player = (Player) sender; if (sender instanceof Player) {
list:
- entry1:
abc: 123
- entry2:
blah: thing```
Or
list:
-
abc: 123
-
blah: thing```
I think this is also valid
lul
looks so confusing
that is for opening the menu
Can you just fix your formatting instead of asking us to figure out what's wrong with your unreadable code
Like this is so much harder to read because of the formatting, just run it through a formatter
and abc:123 and blah:thing in the same Map?
are*
ok
No, different maps
can u show an example with 2 entries in each map for my small brain pls
list:
-
abc: 123
def: 456
-
blah: thing
bleh: otherthing```
ty
general question for yall
is looping through a array and 2d array the same speed if its the same amount of elements?
More or less
Hi guys! I'm using a HeadRotation packet to move the head of an EntityPlayer (NPC). as you can see i'm parsing a byte (or a float ?). In the game it works fine for some rotations and completely wrong for others. Am i doing something wrong?
https://paste.md-5.net/heremuqale.java also sorry for being an ass about it im just tired and have been trying this for awhile
maybe negligibly slower for the 2d array because it might go back and forth though ram ?
Why are you casting to byte
Yaw is a float
yeah so how do i do it?
by doing what? sorry but i can't understand
dividing?
Try subtracting pi
Then multiplying by 127/pi
Then casting to byte
Probably won't work but it's the best I can think of
Otherwise I don't know
ew math
instead of casting you should use getYaw().byteValue()
this will do a narrowing primitive conversion for you
but yaw doesn't have any method
Float vs float is a tough one
Cannot invoke byteValue() on the primitive type float
uhm
new Float(float).byteValue() lol
optimal speed
suppose that works, not like it is hard to go from primitive to object
but like
Float.valueOf(float).byteValue()
cant i set the string "#0ffffTest message" tot a fileconfiguration and prevent it becomes a comment? seems like the parser sees it as a comment and doesnt place " "
the method I am suggesting does a narrowing primitive conversion AKA has to do with precision
you can cast to Byte if you want, but then you might end up with problems when you think it should be a certain byte value when really it isn't
wat
narrowing primitive conversion is literally just discarding any bits larger than the size of the target primitive
"A narrowing conversion of a signed integer to an integral type T simply discards all but the n lowest order bits, where n is the number of bits used to represent type T"
as you can see from the eye of the enderman (which should be the right rotation) thats not even close
alright don't listen to me
back to my game I guess
whats the issue here anyway
i'm trying to set the head rotation of an EntityPlayer to be the rotation of an another entity, however the value is not correct, i mean: the head does rotate but not to the right point
yHeadRotp = MathHelper.floor(this.entity.getYHeadRot() * 256.0F / 360.0F);
MathHelper??
server internals
Math.floor is a thing already
server internals
that is the code run internally
that value is then new PacketPlayOutEntityHeadRotation(this.entity, (byte) yHeadRotp)
so might give it a try
https://paste.md-5.net/heremuqale.java i fixed the formatting with eclipse
im booting up test server now about to get the real answers here
see what this yaml looks like
bump idk
bump for like the fiftyith time : (
could someone help me add a cache to my plugin. In dms?
Try using \# or using ""
Actually, no this is pointless. This probably could be a snakeyaml issue
baso i have a placeholder api placeholder that does a http request and i want to store it for 5 mins before getting it again
Unless you write the yaml manually
ye
There is a library called caffeine that should make this easy
Never used it myself however
or guava cachebuilder
mostly the same
i took a look at a class and it was exactly the same as guavas
Isn't guava technically unmaintained?
bro someone save me
i can't figure this shit out
what is the issue?
i am trying to make subcommands
is there a way to join a string array if the array isnt null but not ugly?
Yeah okay
its not a function error, since earlier by just running one command it ran
anyone know a simple way to do this
why 20 try catch blocks?
if (args.length == 2) {
if (args[0].equalsIgnoreCase("create")) {
if (args[1].equalsIgnoreCase("54")) {
MenuStorageUtil.createMenu(args[2], 54);
to access args[2], the array must be of length 3 or more
You'd probably want to do args.length > 3
cache it when you need it the first time, or eventually when the server starts up
i see pyramids geol
not sure what would be unmaintained about it?
they still release updates to it
You probably forgot that java 0-indexes arrays
Then it was probably some other google lib
how can i get when a player shoots an arrow?
i want it to cache the api result for 5 mins
EntityShootBowEvent
where you get it from
?jd
ty
Map<Type, Map.Entry<Long, Object>>, where as the long is the millisecond the key was inserted and Object the cached value
I would strongly recommend caffeine for that
private final Cache<String, Consumer<Player>> actionMap = Caffeine.newBuilder().expireAfterAccess(Duration.ofMinutes(15)).build();
Then compare the current time with it and if it is over 5 * 60 * 1000 (too lazy to do the maths) milliseconds ago, then redo the operation and cache it anew with the new system time
i think i will try to use this
rather than another dependency
guava is build into spigot and has a cache builder too
but this doesn't have a method to get the entity who shooted
isnt it exactly the same class?
yes it does
just other name
Event#getEntity
declaration: package: org.bukkit.event.entity, class: EntityShootBowEvent
isn't that the projectile?
no
?jd
then how do i get the projectile?
didn't work
What code are you using right now?
how can i make my plugin work on any version. Do i just set the api version to lowest
13, but that usually does not work
You are basically guranteed to have touched something that is 1.14+ or at least 1.13+ exclusive
i will use 1.14
In this case it needs to be >= instead of >
ok
> means "larger, but not inclusive"
whats the version name for 1.14
maven
Probably "1.14-R0.1-SNAPSHOT"
thanks it worked
Keg[] kegz = (Keg[]) kegs.toArray();
'will produce 'ClassCastException' for any non-null value '
why would it do that
if kegs is null?
oh i thought it was saying if one of kegs elements was null
also toArray(Keg[]::new) would work
toArray() will return an Object[] iirc
Anyone know how to use the townychat plugin?
ah i see
if (event.getAction() == Action.RIGHT_CLICK_AIR){
if (event.getPlayer().getInventory().getItemInHand().getType().equals(Material.COOKIE)){
if (event.getPlayer().getInventory().getItemInHand().getItemMeta().getLore().contains(ChatColor.GOLD + "CloseCall")){
event.getPlayer().sendMessage(pullmessage.replace("%ability%", closecall).replace("&", "§"));
event.getPlayer().getInventory().removeItem(event.getPlayer().getItemInHand());
}
}
}
This is the code i have rn, i am trying to remove the item that the player is holding from the players inventory but it doesnt do that, it only removes the other item stacks in different slots
removeItem just removes the first one it finds
You want to decrement the item in their hand, or set it to null if they only have 1
Yes
This was my suggestion, not an explanation of what you’re asking lol
Ok finally got it working @waxen plinth the way spigot saves it by default is like you said but the '-' is on the same line as the first k/v pair in each map
I know
how do i make void run every 5 mins
?scheduling
ok i got this error
Caused by: java.lang.NullPointerException
at me.magnumsrt.MagnificentMenus.MagnificentMenus.onCommand(MagnificentMenus.java:117) ~[?:?]
menu.setOption(Integer.valueOf(args[2]), new ItemStack(Material.valueOf(args[3]), 1), args[4], this is the line of code that causes it apparently
okay
If you want people to help you do full errror pastebin followed by class in which error occured pastebin
everything should have pdc smh /s
no, not /s, you are correct.
persistent data management is very optimized for storage. /s
its not like there'd be a useless build up of data over time. /s
undoubtedly the case, so colossally more scalable than what any database could possibly offer /s
plugins need to start storing player login info as a String in the player's persistent data container. /s
lol
after all, the PDC methods dont require asynchronous calls.
so therefor, they are better than databases. /s
🥲
Hello, I am making a plugin, and I would like to know how to open a menu by shift + right clicking, can someone help me?
right clicking empty handed?
when player right clicks check if they're crouching
^ basically a Player::isSneaking (or sth) and then PlayerInteractEvent::getAction and check if its right click
Looking for a plugin so I can send a command (same one) to all servers at the same time for example a lp one through proxy
Oo
Well this channel is probably the wrong one, so keep in mind until next time
Sorry
but regardless, I don't know of any plugins that do this
however whatever plugin that do this would need some sort of external resource
whether its just a socket server or perhaps a database
Idea
myeah
no, with a diamond sword
You install a spigot version and the proxy plugin sends the spigot plugin the command to send
yeah I get your idea
Someone should make this a project
but its a bit problematic
since there's no developer api to solidly send messages between servers back and forth
I already tried that, but it doesn't work
help
Would this work? https://github.com/Phoenix616/ConnectorPlugin
Or is this just for messages
send the code you tried so far
?
yes and no
you have to opt in for a "communication method"
" Plugin Messages" (the first one)
does only work if the receiving server and sending server have players online
Is there a way to rank someone in luckperms with one command in all servers?
Would it connect all my ranks or could I still have different donator ranks for different servers
Okey
you have a global collection of ranks usually (stored in database)
however you apply them to players for a specific server or so using contexts
and then whenever you update permissions or ranks for someone the server the change took place on would send an update signal to all the other servers so they can synchronize with the database
hm
`@EventHandler
public void interact(PlayerInteractEvent e){
Player p = e.getPlayer();
ItemStack i = e.getItem();
if(p.isSneaking() && e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
if(i.getType() == Material.DIAMOND_SWORD){
Enchants inv = new Enchants();
inv.createInventory(p);
}
}
}`
if you use a local database file this can be hard (or just flatfile storage)
what does Enchants::createInventory do?
I mean generally someone doesn't need to have a rank till they join a different server. You can always do a quick role check on a player when they join and fill in the gaps
create an inventory, it is a class of my project
on PlayerDeathEvent, can the latest damage cause technically be null? i dont think so, but wanna be sure
since the api does not do that inherently when just creating an inventory
send to whom?
yes
Player::spigot Player.Spigot::sendMessage
oh
are you using adventure?
bungee chat api?
btw
ignore the red
its just cause getPlayer is nullable
`public void createInventory(Player p){
Inventory inv = Bukkit.createInventory(null, 27, ChatColor.translateAlternateColorCodes('&', "&1Encantamientos en la espada"));
ItemStack sword1 = new ItemStack(Material.DIAMOND_SWORD, 1);
ItemStack sword2 = new ItemStack(Material.DIAMOND_SWORD, 1);
ItemStack sword3 = new ItemStack(Material.DIAMOND_SWORD, 1);
ItemMeta s1 = sword1.getItemMeta();
s1.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&6Filo I"));
List<String> ls1 = new ArrayList<String>();
ls1.add(ChatColor.translateAlternateColorCodes('&', ""));
ls1.add(ChatColor.translateAlternateColorCodes('&', "&7Costo: &a100 Coins"));
s1.addEnchant(Enchantment.DAMAGE_ALL, 1, false);
inv.setItem(11, sword1);
ItemMeta s2 = sword2.getItemMeta();
s2.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&6Filo II"));
List<String> ls2 = new ArrayList<String>();
ls2.add(ChatColor.translateAlternateColorCodes('&', ""));
ls2.add(ChatColor.translateAlternateColorCodes('&', "&7Costo: &a300 Coins"));
s2.addEnchant(Enchantment.DAMAGE_ALL, 2, false);
inv.setItem(13, sword2);
ItemMeta s3 = sword3.getItemMeta();
s3.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&6Filo III"));
List<String> ls3 = new ArrayList<String>();
ls3.add(ChatColor.translateAlternateColorCodes('&', ""));
ls3.add(ChatColor.translateAlternateColorCodes('&', "&7Costo: &a650 Coins"));
s3.addEnchant(Enchantment.DAMAGE_ALL, 3, false);
inv.setItem(15, sword3);
p.openInventory(inv);
}`
no
null
at me.magnumsrt.MagnificentMenus.MagnificentMenus.onCommand(MagnificentMenus.java:117) ~[?:?]
https://paste.md-5.net/iyayahiroj.java this is the code
yes
i literally can't find anything wrong tho
well that means it didn't find the menu
since that method is set to return null if it is not found
ok
no that means, whatever your method do, you are doing nothing with that
public static Menu findMenu(String name) {
for (Menu menu : menus) {
if (menu.getName().equalsIgnoreCase(name)) {
return menu;
}
}
return null;
}
since you never defined menu
you just call that method
but never set menu with it
it would have to be
menu = MenuStorageUtil.findMenu(args[1]);
ok
thanks
Figured out your issue, after careful inspection I have determined that you're using Windows.
Windows is what empowers me
how do i change a string to a string[]
context?
by putting the string into an array ;p
lore should be a string[]
new String[] { lore }, or if it's varargs, just lore should suffice
alright thanks
i misread
its a list<string>
how would i convert a list<string> to a string[]
i need to use it in a method
.toArray(new String[0]) it
finally it works