#help-development
1 messages · Page 2286 of 1
i think the whole player/uuid debate is pretty pretentious lol
if youre lazy use uuid
you can get away with player
It’s a case of best practices to minimize the fallout if you slip up
doesn't change the display name of the player
isnt player for if ur lazy
just chat name
cuz with uuid u need to do extra work to get the player object
That’s what displayname is, the name in chat
If you want to change their name tag that’s a whole other ordeal
If you want to be extra then use a
Map<WeakReference<Player>, V>
Ok thanks
is it possible to add a pathfinder goal to a existing entity? (without creating your own)
eventually
it is possible?
it will get collected by the gc
the whole idea of soft references is that theyre collected
ah, so can take some time
whereas if it was a hard reference your map instance would keep it in memory
why doesnt this work https://pastebin.com/QXTv226T its supose to move a dropped item along the glazed teracotta but nothing happens no errors
isnt each player always in memory anyway?
well i mean
o.O
if you keep the player object loaded once theyre no longer online
the player is still in memory
well, i said remove on disconnect
you need to nullify it for it to get collected
if u remove on disconnect i dont see a problem
also smile i apologize for the spam but you never really got back to me on this
Idk just instantiate the objects in your method
Player#setPlayerListName May be what you want
ya ok thats what i figured
still confused why it behaves differently than my example
whatever
Sometimes the compiler moves variable initialisation into the constructor.
mmmm yes that would make sense
it also doesnt help that my example was compiled in a different environment
Isnt setDisplayNane for items?
compared to the plugin
Anything broadcasting? And where is this block of code
Different method, same name
Players have a display name as well and will be used in chat
^
The tab list as well iirc
¯_(ツ)_/¯
Ah ok
yeah its broadcasting its just not moving and https://pastebin.com/iQcWawLS its in a runnable
Ok so it’s your velocity application that doesn’t work
Oh
You never set the item’s velocity lol
oh my god im dumb ty
coming back to this. you can actually do it but you have to be really certain you remove the reference
But as soon as you have to serialize your data you will be glad that you dont have a Player variable somewhere.
the non-usage of player objects comes from the fact that if you fail to remove a reference the garbage collector will not gc the player object. and anything it relies on this can include whole worlds
It’s a matter of good practice more so than anything else
i see
you could approach the problem by using a WeakReference
so you're basically expecting human error
You avoid the risk if you don’t store player objects
yea i absolutely agree with making sure your player references are removed and that you dont serialize them
well storing UUIDs is the same issue though isnt it lol
just takes up less memory
right but memory leak either way
You avoid the risk of dragging around the huge amount of data a player object drags around
id prefer no memory leak at all
uuids arent strings
nope
exactly this ^
theyre two longs
always thought they're just strings
uuids are just 2 longs. So 128 bit
well no
It’s still a memory leak
how is it
It’s just of a much more negligible size
just less memory being leaked
well yea
You’re leaking 128 bits
but that doesnt matter
im of the opinion you shouldnt have memory leaks to begin with
The goal is to avoid memory leaks but you should also write code such that if a leak occurs it’s not massive
ok yeah
You guys are missing the serialisation aspect
using a bigger object will let you fix it faster though 😛
i never needed to serialize anything
when i need to have an object serialized, i do use uuid, yes
Same
that is how its intended
when do you need an object serialized?
ah
serialized just means bringing it out of the code
Whenever you’re saving it or serving it
well yea but typically serializing in this case refers to using osmething like gson
you want to avoid using a player reference in an object you serialize with gson
unless you denote it as transient
unsure if ConfigurationSerializable respects transient
yet again i dont really use it
I mean you choose what to serialize with it
(Like you manually have to put stuff into a map)
garbage

Hi, when my server load I got 6 times the same error in my console but I don't know why it says "unkonwn world" since I don't load location
?whereami
lol
Speak of the devil lol
check Main.java:41
IllegalArgumentException: unknown world
You are trying to deserialize a Location that is in a world which is not loaded at this point.
What’s on Main line 41?
if (this.getConfig().contains("data")) {
Send main class
^
Why are you dming me it
bruh
the classic
?paste
copy and paste it there
?verify
#verify
They sent pastebin links so they clearly can send links
That must not be the issue if there is one
were they trying to attach the fucking java file or something
yes
looks java to me
My guess is that the issue is the spawn
storing players as string?
Lets just use Map<Object, Object> from now on
uuid's hashcode & equals check are so much faster
my brother in christ please use proper logging and not the ConsoleSender
@thorn crypt you should completely restart your project and let us walk you through it
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.
wait can you do contains() to check if a section of a config exists?
I never tried that
No. This is cleaner:
throw new LoggingException("AAA");
even better
https://gyazo.com/068756c191ab390e12400b9a5083147b also doing IO like this isnt a very good idea either
considering HashMaps and StringBuffer (and other stuff with an initial capacity), how much time does it cost to increase the object's capacity compared to initializing it with a smaller capacity?
in other words
is it advisable to overshoot the initial capacity
R u doing multithreaded stuff? Else use StringBuilder
logger
and if you are, you might wanna go with ConcurrentHashMap
Hashmap increases by a power of 2 each time it resizes
code example used StringBuffer
Yes but it is synchronized wth the traditional way by the means of thread safety
ah
also whats that
^
But since you seem to be doing stuff non async, you probably dont need StringBuffer neither ConcurrentHashMap
Anyway both use System::copyarray iirc
Which is a native call under the hood I believe
Thus is quite fast with little overhead
sounds like a complicated way of not having to lock a code snippet
Is this you?
im more a red kinda guy
on intrinsics it doesnt really matter, as long as you arent constantly calling arraycopy on large collections
PS: Thats a möbius strip
Morbius
But well moterius if you can predict the rezise and average size specify the load factor as well as the initial capacity
oh for fucks sake
Concurrent hashmap isn’t a synchronized hashmap
It’s designed for multiple threads to be reading and writing concurrently
I'll say it again my name is older than that movie
For high throughput in a highly concurrent application
Morbius
Why do you love it so much?
What is the difference between
Map<WeakReference<Player>, V>
and
WeakHashMap<Player, V>
?
Does that even work
which
You should use WeakHashMap.
so while overwriting a format(LogRecord rec) method the storage object is not that important?
ok xD
The one ive sent makes no sense
What
I'm trying to do something to the effect of this and am a bit curious why they used StringBuffer instead of String
public class LogFormatter extends Formatter {
@Override
public String format(LogRecord record) {
StringBuffer buffer = new StringBuffer(256);
return null;
}```
i have to format my log output for the log file
Because many Java devs were and still are oblivious to the fact that StringBuffer is synchronized
So they use it cause well, it does appear to function the same as StringBuilder
(Which is true, just a bit slower)
Because every append method on it is synchronized
Thus you need to flush local registries
should i just throw back an append chain then?
And contraint jit and compiler from reordering and optimization
uh what?
Well, using synchronized ensures a memory order
How can I use colors in player.sendTitle() ?
Do i have to do it with §3 etc. or is there a cleaner way?
Which decreases the amount of optimizations java can apply
Thus you shouldnt be using StringBuffer unless necessary
iirc you can also use Player.Spigot
Thats what I use for messages, and then use the Components to build them
But dont see any sendTitle there
ah
(:
wait, would that even matter here? I mean, could there even be issues with just throwing back a String consisting of log level, message and time?
Considering how you talked, im guessing that compiler optimizations might readjust the order in which those are extracted from the record, but would that even affect the return value in any way
Looks like theres only those 3 :(
It doesnt matter here, but synchronized will still end up locking the damn buffer, and it will force local registries to flush
so it is gonna affect you performance wise
when should i use synchronized objects then, aside from objects accessible to multiple threads
Ahh nvm then
I thought spigot added Title support there in the new versions, but looks like a no :/
sad
when you only want one thread to safely mutate some variables
its that racing thing right
if two things try to read or write to the same variable issues might occur
like add one
Yeah a race condition
I mean you can use synchronized to avoid indeterminacy when threads race
Is there any Feature Suggestions kind of thing for spigot?
they grab both the number and both return that number to the variable
But usually you wanna go with a ReentrantLock or do the operation atomically
however since they got the number before the other thread returned it the number was added to once not twice
hence synchronized blocks
'only one thread may enter'
Which is not always what you want
There are more complex locking patterns
Like the ReentrantReadWriteLock
How could I get a players balance from their username, using the getBalance method in the Vault API?
Yea, but assume you do change some variables’ value based on its old value, we can often perform a release/acquire compare and swap operation instead of synchronized (You’d end up using AtomicReference or AtomicFieldUpdater)
Since synchronized is more performance demanding
how can i get the block in front of an entity? (not a player so i cant use eyelocation or anything) i cant just add to x or z since it could be eather going x or z
call the raytrace method
Most entities have eye locations
^
its an item
Entity#getLocation().add(entity.getLocation().getDirection()).getBlock()
that should still have a direction
Then what does “in front” mean?
And yeah it should still have a direction of some kind
the block in front of the dropped item like if a player dropped it or smthn for example
Hi I have an issue with clearning queue inside runTaskTimerAsynchronously the error
i'm getting is ConcurrentModificationException. Any idea how can I deal with it? Bascially task are comming from Websocket thread and need to be handle in Spigot thread
{
private final Queue<Consumer<WebSocket>> tasks;
public ExampleHandler()
{
tasks = new LinkedList<>();
Bukkit.getScheduler().runTaskTimerAsynchronously(FluentPlugin.getPlugin(), () ->
{
try
{
for (final var task : tasks) {
task.accept(null);
}
tasks.clear();
}
catch (Exception e)
{
FluentLogger.error("FluentTask error",e);
}
}, 0, 1);
}
public void addSpigotTaskAsync(Consumer<WebSocket> task)
{
tasks.add(task);
}
}```
But relative to what?
the direction its facing
If the item just spawns in, what does “in front” mean?
You’re externally modifying the list while iterating over it
getLocation().getDirection() will get you the direction the item is “facing” but that won’t necessarily mean anything
ill try it to see if it works
ur modifying an object ur not allowed to modify that way
You probably wanna go with a data structure that supports concurrent operations
Or synchronize it
Yeah that too is an option
well this works thanks
As far as i know that could slow the server, right?
That’s not going to slow your server no
What do you mean by data structure?
Unless you have a deadlock
Yes but concurrency is expensive sometimes at the cost of providing higher throughput
That LinkedList of yours is not thread safe and not resistant to modifications happening while iterating over it
You have to remember runAsync on the bukkit scheduler pushes a task to a cached thread pool
So ConcurecyQueue would be good in case there will be about 50-60 tasks every second?
You do have some options, like LinkedBlockingQueue, SynchronousQueue and some other implementations
Its worth looking at the javadocs
To see which one will fit your needs more pertinently
ye I've never been much into this topic
how can i get the block in front of an entity? (not a player so i cant use eyelocation or anything) i cant just add to x or z since it could be eather going x or z (this doesnt really work it works randomly about 1/5 times
you can raytrace on any entity iirc
How are you deciding what is "front"?
im trying to make a conveyer plugin and i need it to go up stairs https://pastebin.com/rxwGKMyk i dont really know how to describe what front it just the direction the item is going on the conveyer
Stairs has a direction
yes?
get teh BlockData, cast to Directional
uh
it then has a getFacing() method
but then how could i detect if the item is at the stairs/collides with it so it goes up
if its on teh stairs (the block below it is a stair)
push it in teh direction of the stairs
or the opposite, depending on up or down
yeah but items cant go up stairs on their own so i need to check if the item is in front of the stairs
why in front? If you are doing a conveyor it should be ON the stairs to be moved, not in front of
items cant go up stairs on their own it acts like a normal block it will stop right before the stairs
unless you want stairs to pick up items that are dropped in front of them
If an item is dropped ON a stair you can push it in any direction you want. I've no idea what you keep refering to in front of
are you sliding items along the floor?
https://cdn.discordapp.com/attachments/823947962580729910/997957294170046464/unknown.png orange is conveyer blue is stairs purple is the block it will stop right before the stairs items cant go up on their own
they go along a conveyer so yeah sort of im applying a velocity
and items wouldnt be dropped on stairs
ok, so you already have a direction from teh applied velocity on the conveyor
yes
Velocity being a vector...
if (Tag.STAIRS.isTagged(entity#getLocation().add(velocity.normalize()).getBlock().getType))
then you are in front of a stair
you can store teh block in a variable if you want to use it for its direction later
Bukkit.broadcastMessage("wr");
}``` says its a boolean but i need a material to see if its a stairs
- purpur stairs
Tag is all stair blocks
if you only want a specific type, then remove the Tag
if (entity#getLocation().add(velocity.normalize()).getBlock().getType() == Material...))```
Bukkit.broadcastMessage("wr");
}``` doesnt work 😢 same issue as before it only works like 1/5 of the time
no errors
That code will detect a stair block in front of the items you are applying velocity to.
You then need to adjust your velocity to take it up the stairs
uh alright ill try it thanks
ok tysm
Hey, what's the NMS method that does mob movement collision?
Is there Fly To Pathfinder goal?
Hello, I don't understand the deep search of ConfigurationSection#getKeys
getKeys(false) gets JUST the top level keys.
If deep is set to true, then this will contain all the keys within any child ConfigurationSections (and their children, etc). These will be in a valid path notation for you to use.
oh okay ty
is it possible to get directly a Map<Material, Integer> from this or I need to loop every Materials and get their Integer?
blocks:
- OBSIDIAN: 20
- DIAMOND_BLOCK: 20
Some one help
I was working on that for whole 4 hours
$this->socket = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
That line
and
yeah idk
re move the - Those are Lists
how do i get the contents inside a configurationsection as a string
ConfigurationSection#getString(String path)
ConfigurationSection#getKeys(false) gets a full list of keys
not the keys 💀
is there a way
to print the entire section as it is
deaths:
1:
- effect: speed
multiplier: 12
- effect: haste
multiplier: 10```
i have `deaths.1` as the configurationsection
is there a way to print everything inside it
🤷♂️ loop through the keys
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
the docs are here couldn't find anything else useful other than keys
mate ive looked through the docs
then why bother asking you should have your answer
getKeys is your best bet looping through it will end up working pretty decently
if you have a specific format to be followed you can filter for that to ensure errorless execution
Currently I am cancelling the ProjectileLaunchEvent when a snowball is thrown, but the snowball is still consumed. How can I cancel the item from being consumed?
No item should be consumed if you cancel the event. It runs before teh snowball is removed
Well, it does consume the snowball for me. In EntityShootBowEvent I can cancel it, update inventory and no item is removed. For ProjectileLaunchEvent this is not the case. Should I perhaps check in PlayerInteractEvent if the player is right clicking a snowball, then cancel it?
One sec. opening IDE to terst
you will just have to put the item back in their inventory
ok I just tested it and cancelling works. It stops a snowball being consumed
I thought of that too, but I don't how how I'd get the inventory slot of where the item was before it was consumed inside projectilelaunch
you don't need to know the slot
there is api methods to find the stacks of snowballs 🙂
Literally this stops the snowball being consumed```java
@EventHandler
public void event(ProjectileLaunchEvent event){
Bukkit.broadcastMessage("Cancelled");
event.setCancelled(true);
}```
anyways it seems though it should stop it from being consumed, I also assume that only applies to newer versions and not older versions either
It flashes to 15 for a second and is instantly back to 16
Yea, I am using 1.8. Might be why :/
But what if it was the last snowball, meaning the player has no more snowballs?
Interesting. Changing a players skin also causes their permissions to be wiped
yeah older versions like 1.8 you have to put the item back into the inventory
put it in the first available hotbar slot
Tested with 1 snowball. Not consumed
in newer versions it works as it should, I do recall in the older versions needing to put the item back yourself since the API didn't do that lol
Glad I use current builds 😉
well, at least they got an answer to their problem 🙂
That was nice. That caused me to find a bug with my skin changer code
nice
Seems when you apply a new texture on teh player you have to send a respawn packet so their client updates. Turns out it also breaks their permissions and the clien no longer knows they are op
[Debug] Unable to open game mode switcher; no permission
updating perms doesn;t clear it either
have to deop and re op the player
I used player.getInventory().addItem() and it does add the item, but if I have a snowball in an earlier slot than the one I threw the snowball with, it adds it to the earlier slot. Would there be any way for me to add it to the correct slot, or do I have to deal with this? https://prnt.sc/XinuUx3jYEfk
unfortunately I don't know what API methods you have available in regards to getting items
if there isn't an api method available to add the item to the appropriate stack, then you might just have to deal with it placing it in another slot
not too big of a deal, just probably a bit inconvenient for your players lol
how are UIs like this possible
using just a resource pack
the apps are clickable
might be in a chest or smth
Thats a shame. You can;t send a ClientboundGameProfilePacket after teh player has joined 😦
Is it possible to give a player access to a recipe whenever the plugin is loaded? I tried to loop through all online players and give them the recipe, however, that doesn't seem to work
I've already registered it with bukkit :/
Then all you do is teach it to the player https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/HumanEntity.html#discoverRecipe(org.bukkit.NamespacedKey)
ah okay, then its probably an issue where I need to remove the recipe from then when the plugin starts to shut down and add it back when the plugin is done restarting. Because /reload breaks it.
I know /reload isn't good but I know that users will complain that it breaks crafting lmao
you can test if they know it first
yeah I have a check for that, but since its a server reload and not a restart the recipe gets removed from the book but the plugin still thinks they know it
Hi,I want to prevent item change in specific slots in inventory.
It means a player can change item stack in some slots, but not in all slots.
Is it possible?
So far, I'm checking InventoryClickEvent::getRawSlot(), but it won't be work well when user drag items or trigger shift click (selected item will be stacked that in blocked slots)
You would just getSlot() == mySlotIDontWantUserToEdit
And InventoryClickEvent::setCancelled(true)
If you don't want them to my able to move it whatsoever you just cancel any interactions with it in that event
forgot what getRawSlot does, ive always used the ladder method uhmmm
get getSlot is the name i normally use
Doubt it matters tho
ah
it actually does slightly
Even if I use getSlot(), the result is same. Because the slot id will be origin slot and not destination slot.
i dont think thats what drag event does
looks like it is
InventoryDragEvent does not cover shift stacking case 😿
You would cancel both InventoryClickEvent and the drag event
not just one
shift clicking can be cancelled in click event
I mean a player can change item stack in some slots, but not in all slots.
I can not get a destination slot in InventoryClickEvent(shift stacking case)
Soo
for that
its a little complicated
You might need packets
Or setup some oddly complex PDT system to retrieve the item
https://www.spigotmc.org/threads/shift-click-item-slot-destination.428224/
Packet way is less dirty and probably a better way to handle it
(Ignore the arguments in that thread)
how do i start developing a plugin with paper
Hmm.. I got it, so there is no easy way to handle it..
What ide
sadly not which is honestly really weird
vscode dont attack me pls
would of assumed this would be a standard api feature
No clue
If you use idea there is a plugin that does all of the config for you
^^
but how
like whats the repo name and the source
For most things the spigot api will be good enough
good point
if you use paper methods
yeah ik
found it nvm
Oops that was meant for someone else
I personally don't use the slot ID but use the material of the clicked item
e.g. event.getClickedItem().getType() == Material.CHEST
Spigot devs when they realize that paper is a fork of spigot
Ok. I'm relatively new to plugin development and I am working on(for now) a simple GUI that will open from a command. I have defined the command and it appears to work but then it doesn't open my GUI I have created. I think its that I haven't properly called the segment to open the GUI but I'm not sure.
I have 2 class files one defines the GUI and the other defines the command. inside the class file that defines the GUI I created a method that would open the GUI(I think it works anyway) it is this:
public void openInventory(final HumanEntity ent) { ent.openInventory(inv); }
I then tried to call that from the class file with the command but upon execution it doesn't do anything.
Alright so I learned that when attempting to give the player access to a craft recipe after a server reload it is not very possible.
Trying to re added it after the server loaded wont give the player anything. (Only relogging will give the recipe back to the book)
Trying to remove the recipe from all players when the plugin is disabled and re adding it to that player when the plugin is loaded also does nothing.
Just putting that out there for anyone else who has this issue.
how do I access net.minecraft.server classes? They don't appear to be on the class path.
hmmm, tried Player#discoverRecipes ?
alternatively Server#reloadData might do the trick though its a bit blunt
Yeah, I have a method that is called to give everyone that is on the server the recipe when the plugin is enabled (onEnable())
It didn't work re add the recipe to the book
I'd open a bug report with a minimal example plugin... may be the case that addRecipe can be changed to resend all recipes
I'll check it but I had zero issues with recipes and reload
everything about the recipe still works, just doesn't show in the book
yep not in book anymore after a reload
I just finished testing the Server#reloadData as well and that didn't seem to do anything
hi, is the is the java crash course in the spigot docs still being finished? I got up to part 5 (https://www.spigotmc.org/wiki/crash-course-to-java-part-5/) but there doesnt seem to be a part 6 or anything more than that?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I guess part 5 is all it goes to
if youre just trying to learn java theres probably better articles
?learnjava
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.
huh ok. I went through the W3schools guide but its not very detailed on the tools like Maven, Intellij, etc.
IMO Learning about intelliJ is just a trial and error type thing
You just keep using it and eventually things become easier, google is your best friend eg "How to invalidate caches in intellij", i dont think anyone in here ever sat through a 6 hours long how to use an IDE tutorial
Reguarding maven idk any good tutorials for that
Yep, nothing displays the recipes after a restart.
I tried discoverRecipe on all logged in players
Yeah I just finished making my basic plugin to send as a test, lets hope it gets fixed 😄
I could have given you a single class
thats basically what I made. I just wanted to also provide them with a simple plugin that they can use for a quick test
That's alot, I just wrote a basic program that will teach the player when they join and create a recipe when the plugin is enabled.
That was just something I was messing about with when someone in here wanted to learn about recipes.
I don't mean to spam but I would rather this not be lost.
we'd need to see some code
More than I gave/
yes as nothing you posted sounds wrong
you get no console errors?
?paste for any code you want to show
um, how does this compile PwarpsGui openInventory(player);
It doesnt give any errors
and console literally shows nothing
other than the fact that I ran the command
yeah, that line isn't valid java
How would I reference the openInventory method or would I not be able to?
You can, but you have to pass an instance of it to your command class.
add a constructor to your command class, which accepts PwarpsGui as an arg
When I do that(I've been looking but i'm a bit confused and want to understand how this works) I would define ```public void openGui(PwarpsGui args) {
}``` And then exactly what. From what I see online I would do something along the lines of PwarpsGui open = new PwarpsGui(openInventory) but I dont think thats right.
PwarpsGui gui;
public CommandPwarps(PwarpsGui gui) {
this.gui = gui;
}```
then in your onEnable of your plugin...
you register the command and you also create an instance of PwarpsGui to register it as it is a listener?
although it has no events yet
something like this in your onEnable...java PwarpsGui gui = new PwarpsGui(); getServer().getPluginManager().registerEvents(gui, this); getCommand("blahblah").setExecutor(new CommandPwarps(gui));
that first code was supposed to be a constructor in yrou command class. I just fixed it
I know I may sound stupid asking this but would I then use gui(); to open/call the gui inside my command?
just gui.openInventory(player)
Can scoreboard teams have the same name?
What do you mean scoreboard teams?
So the builtin minecraft teams system?
but most likely for anything the answer would be no
im pretty sure those teams are stored in some type of map so yeah ^
since maps cant have duplicate keys
you would just overwrite the previous team when doing that
you need two separate scoreboard instances
but no they cannot have same team name on same scoreboard
I'm not too well versed in scoreboards and stuff but couldn't you use color codes to have it display the same name but in a different color making it a different name?
loop holes 😄
Should i be calling join() on futures when running them like this?
im getting a weird result, after running this about the same size as my executor (96) the entire program freezes (Using Executors.newFixedThreadPool(threads);)
Not sure if maybe this future isnt getting closed or something?
also get this, always runs to thread 48, and restarts to 1 
How can I get a players balance from their username using the getBalance method from the Vault API?
You need to get the OfflinePlayer by name
iirc Bukkit#getOfflinePlayer
Cache these results this method contacts mojang API iirc
Something like economy.getBalance(Bukkit.getOfflinePlayer(uuid));
Yes but cache the OfflinePlayer you get inside a HashMap
that way your not contantly getting the player
Ok cool
Stupid question but how would I go about getting a player UUID from their username
OfflinePlayer has getUuid()
ah so it was needing to call join() pog
So I am trying to follow this tutorial so that I can learn to use databases with my plugin. When I add the dependency for the mysql driver though it gives me an error in my IDE that the dependency is not found... I did go to the link but I am utterly confused because no matter how deep I go through the links looking for how to install it just gives me more files to download and despite attempts at installing nothing happens
Whats your pom.xml looking like?
Did you refresh maven in the top right?
Did you import its repository? (If not from maven central)
i know theres a driver thats on a different repo, so do send pom.xml
?paste
Btw I meant to say I am following this tutorial: https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
and I literally just copy pasted the extra dependency line in but I'll send the whole file in a sec
thats the whole file or did you cut off the to
just curious
cause your missing opening tagline there
yeah
yeh
it was giving me the error but after refreshing and waiting a few minutes it now stopped giving the error
well youll need to add that too when you do compile so add that
without it its just provided scope by default
So im confused
yes theres error no theres no error?
Their is no longer any error displayed within the file by my IDE
Alrighty, also the reason it took a few minutes is likely cause intellij was downloading it
You can see the running maven tasks on the bottom bar
so that way you know if mavens running something or not
ah ok
ik that mysql lib is rather beefy
yeah inside the depenency
<scope>compile</scope>
that way it gets shaded into your jar
and you need a shading plugin
unless you have one and it was just cut off from that past
I dont know what that is(im quite new to a lot of this)
https://paste.md-5.net/ocezodetev.xml
Inside your properties tag add a new variable called java.version
Those plugins can be pasted anywhere
They just allowed dependencies to get shaded into your jar when compiling, which is what youll need for mysql
You can actually replace the java.version variable in my paste to maven.compiler.source if you dont wanna make a new property
yeh it goes anywhere i typically put it under my properties tags
Example pom.xml: https://paste.md-5.net/jozocevaya.xml
just note groupid artifact id name and version
and java version in that files 1.8 make it 16 if you do copy/paste it
if you use intellij
theres a plugin that handles making this pom for you
with all those plugins automatically added
what it called/
note you use it when you make new projects
when you create new project there will be a Minecraft option
I always wonder if there's a way to edit the default templates
intellij has built in feature for it
ahhh you found it on source code
i cant find the plugin folder in intellijs directory
weird
Feel like it's hardcoded
there is a way
%appdata%/Roaming/Jetbrains/IdealC<version>/plugins/Minecraft Development/lib
then open MinecraftDev-<version> with winrar and edit the files
issa pain
i was looking in C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3\plugins
IDK if its proper development question but it is dangerous if I send real server address to Html client app? My plugin generates Hashed JSON that contains server IP and websocket Port and that Hash will be past by user in client app
found the files to edit but idk if they are encoded or not and noepad++ decodes
seems all for velocity tho
i think it would be easier to just fork it then manually install
Handing IP's over is no issue
but not everything is there
But you need to authenticate who is who and if x user has permission to get the ip from that server
basically everyone will have the permission to do this action
In worst case some guy could use IP adress to ddos, right?
Yeah your find just having an endpoint that returns the IP then just add a rate limiter
I mean the IP is gonna be public anyways
cause the users gonna have to use it someway no?
all IP's are public
ewwww
yeah gotta fork from github then
unless you only want pom changed
then i think it will work
but when it updates it will break it and revert to defaults
ok i thought it could be hiden under redirections and DNS
Yes it can but someone who knows what theyre doing will find the IP no matter what
Still do your DSN and redirects though, we did that on our old proxy to hide the MC game server ips
ip-restricted firewalls 👀
If your rly concerned about protecting the main IP of the server build a proxy for it that way no user ever directly connects to the server
then just pull an ethernet cable from the datacenter to your house
ultimate security
and tell everyone to not step or cut it
#pranked
toooo ezz
ezz
you ever see the pic of a shark biting those cables?
what if
you buy a datacenter
and make like 200 dummy servers
and only 1 is the real one
Google is reinforcing its underwater fibre-optic cables to protect against future shark attacks
Google is reinforcing its private underwater fibre-optic cables with an extra layer of protective material in order to protect its 100,000 miles of cables from sharks.
Sharks and other fish are attracted to the cables, thought by some to be due to t...
chonker!
And you setup an A record with the same host name but different IPs
and rely on dns to hopefully connect you to the right one
funny thing is thats a makeshift load balancer
if (cooldown.get(entity.getUniqueId()) >= 10 + (System.currentTimeMillis() / 1000)) {
EntitySet.clear();
e.setCancelled(false);
}``` does anyone know why this is not working
its not a perfectly even load balancer, but its a load balancer none the less
How is it not working?
ok guys, thanks for answer
Also Whats EntitySet? Why is it static?
If you have anymore questions feel free to pop in
it might just be c# naming scheme
its a hashset
im doing a lot of stuff with websockets myself rn

How does the code not work?
I've been doing lots of stuff with nms and pathfinders lately
ooo
websockets are interesting but ehh
always wanted to get into that
i made a rly badass socket implementation
it parses data to java objets
I might make a proprietary messaging system using sockets
and you can make handlers for the actions like:
because people don't like setting up redis 90% of the time
Use rust
rabbitmq bruh
never
my websocket infrastructure is superior
i just need to change my actual networking from strings to bytes
heres the full code
that's something only 10% of people actually care about
cause data is sent in string format which rly isnt safe
redis is like 60%
it does
the other 30% are people who don't have either because they use a frEe hOsT
What exact line of code isnt running?
but the only thing is that it always stays cancelled
Did you debug?
but redis pubsub is shit
so the if statement is not running
man's putting and checking the cooldown on the same event
I made a packet system that runs on pubsub
and I can add more types of "processors" like rabbitmq
Any errors?
nope
it's basically TCP running on top of TCP
I've made implementation like this, incoming data is casted from byte array to object property
ayy nice
converting mine to byte arrays will be simple
i just need to toBytes() my strings im sending
then stringify them on receive
actuallly gson might handle parsing bytes directly
mine's an nms ripoff :(
well in my case JSON is pretty bad format to exchande date because there will be about 100 msg per secound
mine handles 100+ reconnects easily
with sending a message
my packets parse in about .03 seconds iirc
unless its the first request bc json schema caching
first request using a new schema instance is like 300ms
this sounds like a weird IT dick measuring contest
I studied networking in school and the teacher was always like that
oh so json is not that heavy for java, i have about .024-.027
my packet system doesn't run on json or anything fancy like that
I just happen to use byte arrays
i run the actual socket on a new Thread, and handle the quests in a CompletableFuture
Yeah bytes are best
Nah it you rly wanna get fast
use what MC uses for protocols
i forgot its name
does anyone remember it?
netty
well they use netty
but does it connects with javascript easly?
no its something else i wish i knew the name of it
fuuuck
I wrote a proprietary server jar
they do that shit
They also use fancy stuff like VarInts to lower integer byte-sizes
does websocket by default not run on new Thread?
what lib you using?
i use org.java_websocket.server
that one
you call
new Thread(yourSocketClassExtendingWebSocketServer).start()
i use a logger with my thread displayed so i know what thread my stuff runs on
man made a fancy proxy
why make your own when you can fork a shitty one or make a plugin that changes half the logic
This isnt minecraft haha
oh
its for my own game
flashbacks to rewriting half of nms to make entities recognize fake blocks
But anyways yeah
100 rpm json should be fine
Gross your making a game in java
esp if your parsing the stuff async
by overriding like 19 classes and changing methods
oh god
well tbf
via a plugin
i would 100% write back end in java
but not front end but...
im forced to use java for front end too
Why
android :/
Ooof
Is kotlin and better for that
what about unity?
yeah kotlin definatly better for it
Idk how to use unity for jack plus its horrible with 2d rendering
You could try using kotlin fir front end
I just dont know kotlin is all
ide have to learn it
I can see myself getting bored in like 3 years
and writing an OS that runs a custom minecraft server
I guess, it's pretty similar to java though 🤷 not a huge kotlin guy just know it's good for android developers
Yeah typically you would wanna use kotlin on android but its not 100% needed
IMO the best feature of kotlin is ASYNC AWAIT
first you need assembly to load a couple bytes from the bootloader and load C
anyone wanna try and crash my socket server by spam reconnecting to it 
I saw a dude writing a tetris OS and it was very specific
Dos yourself lol
Its on a remote server
im not
that page took like
10 seconds to load
shits huge i bet
lmao it is
77 pdfs
anyone have experience in making an mc server bc i need help
ye
You would need a TCP Socket and use of MC protocol
Bedrock uses UDP if your going bedrock
I got some, what are you suffering with-?
well m just trying to figure out what i should for the map because i either pay someone to do it or do it myself which would take forever
and i just need people besides me and my friend to help setup
its hard to find help now a days
You can go into great lengths to save tons of ram
Yeah but just for a map that seems excessive haha
I think he's talking about making a spigot server
Not sure
and I think we're all too used to network development to even think of it
@deft shell ? ^ is it?
Ah, this is a channel for java development
mans don't even know what spigot is
o
#help-server would be your cause
And you can just google this tbh
its first page google results
So yeah we're all hardcore developers here and you're basically asking the pope if god is real
"How to make a spigot server"

lol sorry im new here
all good
but thanks
there is only one god 
mm interesting apparently cpus run in 16-bit mode initially for backwards compatibility
thank you intel
yesterday I was coding and a cockroach dropped into my fancy logitech keyboard
oh hell naw
I've also had a spider dangle in my third monitor
I was about to punch the living shit out of it
it seems that you are from Australia
couldn't be further
Hello i learned java basic can anyone guide my building my first project (i want to create a custom item and a cosmetic plugin)
by custom item you mean item with custom 3D model?
Na item with custom events
Not that model and all stuff
by java basics what exactly does that mean
Learned java but not much of its library...
Haven't practiced much...
I know classes arrays methods and all that stuffs
Constructors method overloading overwriting...
Its was not that hard for me to learn cus i am pretty expert in python...
oh fair enough
in that case if you rly just wanna get started
Youll need to know maven at bare minimum
However there is an intellij plugin that will generate a maven pom.xml for you with a base main class file with onEnable and onDisable methods
to be honest this guy has a grate course https://www.udemy.com/course/develop-minecraft-plugins-java-programming/
lmao volkswagon backs it wtf
lmfao what
Its a paid course and i don't wana to invest in intial
Volkswagon minecraft server
I installed maven
dont need to if you installed intellij
intellij bundles it all
sec
O.o
Do you know how to add plugins to intellij?
Ya it was in Minecraft package that i installed in intellij
anyway you are investing your time wich is priceless
I watched that tutorial
Wait actually i still don't know how to import plugin from other's source code...
This plugin will generate barebones plugin for you to look through
Yaa i installed this already
https://www.spigotmc.org/wiki/tips-on-creating-your-very-first-plugin/
And then theres this code to further help understand what that plugin will generate
That is a little complex sometimes
what plugin?
inb4 random 1.8.8 jar abandoned 6 years ago
?1.8
Too old! (Click the link to get the exact time)
Hey guys, so I wanted to get some playerdata values from the player, but it just returns a 0, I'm doing it like this:
someone help?
?pdc
async?
No curly braces on the if statement?
Also you print your debug before your if statements
try sync and better print Bukkit.broadcastMessage("PARTICE"); under If statement
So it turns out in Eclipse ive been pushing my username/password typed in one of my classes (was suppose to test and delete it) to GitHub, can I just delete the file and its history from GitHub
Just change your password easiest solution 😉 though I'm sure you vould delete history too not sure on that one though
Im going to do that but also want it off the repo
If you've changed it and pushed an update it's not a huge deal unless you use the same password fir multiple things under that case shame on you
We call em guard clauses
if (stuff) return;
also
You cant spawn particles asyn
When you delete the file locally and push it should delete it
Just use the braces makes it more readable
does it for me, but i use github desktop
About the history
Though that's preference I suppose
Hmm how can i make a projectile have a particle trail?
ohhhh history mb
you need to follow the arrow traveling (Gets its flight path) and while its moving spawn a particle at its location every x ticks
projectile* not arrow
new BukkitRunnable(){
@Override
public void run(){
if(event.getPlayer().isFlying()){
Mana.removeMana(p, 1);
if(Mana.getPlayerMana(p) <= 1){
p.setFlying(false);
p.setAllowFlight(false);
p.sendMessage(ChatColor.RED + "You are out of mana!");
}
}
}
}.runTaskLater(Wired.getPlugin(), 20);
can someone explain why this mana loses like 4 every seconed instead of the 1 its suppose to?
did you run the task 4 times
is there any way to set the nbt of a block in the generate methods of ChunkGenerator?
like block data?