#help-development
1 messages · Page 128 of 1
the other reason other then this, storing the players uuid is cheaper in cost then it is to store the player object unless you have custom player objects such as a wrapper etc
or at least linked list
ye no need to store a whole player obj
@fluid river
true
?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.
bruh
There is no reason for you to start developing spigot plugins without having an intermediate Java understanding
We are not here to help you with basic stuff
the goal of this part of the community, is to help you in areas where you get stuck on something and have already attempted to solve it yourself to include researching your problem
trying not to break my repo as im the biggest git noob
someone should explain me what the dif between git rebase and merge is lol cuz i aint understanding anything about it
i just didnt understand what she said -_-
lets backup my code lmfao
Just delete it and you won’t have to worry about breaking it
last time i did a merge a piece my code was gone

lmfao
doesnt allow duplicates
git rebase, rebases a branch on a commit without messing up the history between the two branches and can see where they converged making it more linear
lets try rebasing then lmfao
rebase over merge on a daily 🙏
dont even know the command 🥺
👀
How do I put NBT on an item in code?
i'm male lol
Imagine not using git desktop which saves your old code when pulling
just want to merge my other branch to main with overriding shit in main
imagine not using brain
dont check anything, use a HashSet
Imagine not using your own git client
imagine not writing your own version control sysstem
well the appropriate way to do things, is you rebase your testing branches on main, and then at the end of doing everything you should merge testing branch back into main
lets backup code, ill fuck up lol
lol me too
like this?
public class DragonEggFunction {
Player player;
List<Player> hadDragonEgg = new ArrayList<>();
public void fun() {
for (Player i : Bukkit.getOnlinePlayers()) {
player=i;
if (i.getInventory().contains(Material.DRAGON_EGG)) {
hadDragonEgg.add(i);
} else {
hadDragonEgg.remove(i);
}
}
if (hadDragonEgg.contains(player)) {
player.setLevel(100);
} else {
player.setLevel(-100);
}
}
}
Why are you ignoring us :c
Lol
Compare git rebase with the related git merge command and identify all of the potential opportunities to incorporate rebasing into the typical Git workflow
Just use a set
tell me how i merge at all
Never worry about duplicate elements
it does tell you
hmm ij has some fancy stuff for that
use a HashSet<UUID> and remove the contains checks
alr
its faster to check and put in because you dont need to check anything
so hashset instead of list?
Name your variables something understandable like “player”.
2. Why are you making two player objects
yep
and maybe use UUIDs
then you can directly save the hashset
to a file
you can save players to a file
so sth like this?
public class DragonEggFunction {
Player player;
HashSet<Player> hadDragonEgg = new HashSet<>();
public void fun() {
for (player : Bukkit.getOnlinePlayers()) {
player=player;
if (player.getInventory().contains(Material.DRAGON_EGG)) {
hadDragonEgg.add(player);
} else {
hadDragonEgg.remove(player);
}
}
if (hadDragonEgg.contains(player)) {
player.setLevel(100);
} else {
player.setLevel(-100);
}
}
}```
Nope
so if i wanna rebase the experimental branch with main i'd do git checkout main; git rebase experimental??
whats wrong?
very good answer
you dont need to check if a set contains something for you to add it
Honestly you would be better off learning Java
We told you multiple times how to do this and you ignore it
?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.
^^ Time to do some of these
We are not trying to be rude telling you to learn Java
It’s just for your own best
yea
ok rebase thing did absolutly nothing lol
but before i start leaning i really wanted to finish this...
oh theres a way to see the views
anyone has an idea
why do i get a connectexception: connection timed out
when using this
this is how im using it:
?paste
How do I add NBT data (specifically displayname ) to an item?
no i need it to use json
because I want to give it a translatedcomponent or whatever
so it can give back the name but translated
so there is no way?
you can edit an entire items meta
to an SNBT tag
but that would loose any nbt you do not define
idc about existing nbt
declaration: package: org.bukkit, interface: UnsafeValues
I just want to change the name of an item in my invetory gui
so I use a json string as the arguments?
does anyone have cool module tutorial/course for gradle?
okay thats perfect
cool kids i see use modules
ill try it out, thanks
Hi all! Please tell me how to make one player hit an item that was made in the ItemStack, and when another player hits, the text appears on the display as in the command /tittle
?rip?
How much RAM is needed for the GTA Roleplay server in Minecraft?
public class DragonEggFunction {
private final Set<UUID> hadDragonEgg = new HashSet<>();
public void checkEgg() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (Player#Inventory#Contains(DRAGON_EGG) {
hadDragonEgg.add(Player#getUniqueId);
Player#setLevel(int);
} else {
hadDragonEgg.remove(Player#getUniqueId);
Player#setLevel(int);
}
}
}
}
Around 10-12gb I would say however go to #help-server
ok thanks
Not spoonfeeding
I was just watching a tutorial about tab list, but something that keeps coming back in a lot of things i try to do is things like these imports dont exist.
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_7_R4.Packet;
Any ideas on why these imports dont exist. (if its an dependency can someone tell me which dependency is it?)
1.7 💀
Whats wrong with 1.7?
It's like 8 years old
Not supported and dead version
Develop how much you want but don’t expect support
okay \
btw the fix is just to import 1.7 spigot
is there a way to have the "translate" property in an nbt name and also have additional text?
so the nbt name is the translated name + whatever you wanna add
Components can be nested yea
what nested?
okay I couldnt figure that out but I did find that you can put multiple attributes in "Name" using an array (like []) so thats what I am going to use, thanks again 😄
Really, really pushing for md to merge it lol
It's been sitting idle and ready to go for a month
thank god that all that stuff lives in the weird spigot type
if that clashed with our adventure impl I'd cry
Only reason it's staying in the Spigot subclass is to avoid name clashes with legacy Bukkit methods
yea
We don't want to have a differently named method just because we have a getter for legacy text
Should that ever happen, we'll already have a full implementation across the entirety of Spigot, completely _LEGACY_ prefix all legacy text methods and fix with Commodore, and shift the BungeeChat API from Spigot into Bukkit
But I doubt that would happen
Kind of like how __INVALID__getOnlinePlayers(): Player[] existed for the longest time when its return type was changed from an array to a Collection
my beloved commodore
I think realistically that would be how we would go about doing it
but again, we would need a full implementation of BungeeChat in the API before I would even consider attempting it
It's something we would want to do once and never again
I do wonder why bukkit is being necromanced like this
Being contributed to instead of Spigot you mean?
Well
yea I guess ?
why spigot was not merged into bukkit
which kinda prevents proper component support
However proper one belives bungee components to be
The build system is easier to maintain. As for why Spigot exists, we like to keep performance-related changes in Spigot. As far as API goes, it's practically 1:1 now-a-days outside of bungee chat. That's it
but like, still nicer than legacy text
how is the build system easier to maintain ?
Because you're just working directly with one set of patches instead of two
CraftBukkit patches NMS, Spigot patches Bukkit and CraftBukkit. 2 layers
yea so wouldn't merging spigot into bukkit reduce that to 1 layer ?
e.g. apply all spigot patches and then simply git commit
we like to keep performance-related changes in Spigot
I keep saying we. I have no say in this. lol

I guess it does not matter too much, beyond the fact that bungee chat was not promoted to bukkit
Right. I think ultimately my personal goal is to get bungee chat into Bukkit. But again, first, I would like to have an all-encompassing component API in Spigot
I'm working slowly but surely. I expect to make 2 more PRs pertaining to components
Next one for more intermediate components, the final one that needs a bit more complex implementation like with inventory titles
Only reason md didn't care to expand component support was because things like RGB, fonts, and all of what's capable now with components just... didn't exist before
Now that it does, his stance on it has changed
Everything could be done with legacy chat before
And, admittedly, legacy chat is easier to write
well yea its format is (or at least it is more ingrained into our brains)
I do appreciate phoenix's minedown for that
the markdown + legacy colour code thing works nicely
concerning it also has explicit colour names instead of just the legacy shortcuts that also works out well for newcomers
only thing I always disliked about legacy text is how "inline" the colour codes fell in larger text
@tardy delta Did you ever get your calculator working?
they are still doing it iirc
did someone say legacy
nah just mini message all day long
imagine XDD
real men use iridium color api
15KB shaded bro
15
1 line to do everything

its superior

bungee api has those right?
havent rly ever bothered with hover and shit
tellraw all the way bro
How can I get the memory a player object is using?
Aloha, just wondering
Does every plugin have their own classloader?
kk that's cool, thanks
how do I get mstp?
lmao weeb pfp
my girl forced me to switch, dont bully me lol
does ur gf watch one piece?
yeah
o, what ep u on?
4 months?
took me like 6-7 to catchup
oh I code and watch concurrently 
Ah, u got a bunch of goated arcs to look forward to then, Arlong park is where things get super good 😛
thats ep 30 ish I belive
🙏
oh yeah, lets move, mb also
Former
on a scale that you should not care about tho
forEach is almost as fast
Since lambda compiles down to invokedynamic
And that is fast
But it is more instructions at the end anyway 🙂
?
how can i get a player version
Using the ViaVersion API
Or whatever plugin you are using
the regex for "hello" is simply "hello"
do NOT add any ^ or $
otherwise it will only match EXACTLY messages that say "hello"
this would only match "exactly" hello
how big? one block, or something else?
well you have to basically choose some edge, and then do something like this:
Where does gradle throw its output jars?
libs folder
if you didnt change it
oh ok show the build.gradle pls
?
build/libs
gimme a sec pls
id("essentials.parent-build-logic")
}
group = "net.essentialsx"
version = "2.19.8-SNAPSHOT"
project.ext {
GIT_COMMIT = !indraGit.isPresent() ? "unknown" : indraGit.commit().abbreviate(7).name()
GIT_DEPTH = GitUtil.commitsSinceLastTag(project)
GIT_BRANCH = GitUtil.headBranchName(project)
FULL_VERSION = "${version}".replace("-SNAPSHOT", "-dev+${GIT_DEPTH}-${GIT_COMMIT}")```
yeah it should be in build/libs
ah okay, sorry, i've been trying to solve this all day and i'm rlly frustrated cuz of it
ok, not in there
then reload gradle, delete the current build folder if available and/or invalidate caches
public static void drawParticles(Location loc, double size) {
for(double x = loc.getX(); x <= loc.getX() + size; x++) {
// do the same for y and z
loc.getWorld().spawnParticle(...);
}
}
I guess something like this should do it?
basically just get a starting point, then loop over X, Y, and Z
or wait
hmmm nah that's bullshit
gimme a nother minute, I have a method to "visualize" a worldedit region, this would probably do what you're looking for
hm it's finee, i'm just trying to figure out how to visualize an earthquake. any tips?
you could use a boundingbox
this should do what you're looking for
in what way? like if it happens? seismograph?
idk, i was trying to do it with block particles coming out of the ground in a square around the player
yeah but there's no method to turn a bb into particles 😄
it could be a circle, but i want it to be filled in if it's a circle
actually i want it to be filled in either way
hopefully with an intensity
so that the particles closer to the player reach higher
what
what output are you looking for? the boolean returned? yeah, it basically gets returned
Yeah I've never used gradle. Everything says it built but I'm only finding a build folder in build-logic/build
like if the player is surrounded by a particle circle which is filled in as well, the particles closer to the player (if the player is the mid point) reach higher (++y)
no since its not a response
so how would i do this?
you could probably hack into the command map and get yourself whatever gets executed when executing the command
well, some maths or googling to get the circle and the intensity thing is either random or you use some physics formula
for (int d = 0; d <= 90; d += 1) {
Location particleLoc = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ());
// Cosine for X
particleLoc.setX(location.getX() + Math.cos(d) * size);
// Sine for Z
particleLoc.setZ(location.getZ() + Math.sin(d) * size);
location.getWorld().spawnParticle(particle, particleLoc, 1);
}
}```
i hsbr s vitvlr
oop
i have a circle
but idk what to do with the intensity
if you dont have an intended use for it, then just dont do it
looks like he basically intercepts the command output with a custom command sender which he sends the command as to receive the output which he just logs somewhere
no, there is no output for this
better said he just sends the command to a custom implementation of ConsoleCommandSender where he then can fetch and evaluate the received data
dispatchCommand doesn't output anything by itself
except for true false
did you figure it out meanwhile? otherwise send the link to the github repo and I'll build it too and check where it ends up 😄
yeah, it only returns the boolean the command itself returns
nope I get a checkstylemain error on building
send link to repo pls
anyone know why this method is working in a inventory, but in another inventory it isn't?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
thx, lets see. might take a while since gradle always takes forever to setup 😄
I do just run the build task correct?
usually, yes, or shadowJar
ok, I did clean and build but it still failed
🥲
ok thats wierd it got a tab in it somehow
people claim "gradle is so fast". it's still not done yet lol
why does it always redownload itself
I mean gradlew is already there
you are trying to build the main plugin, yes?
try gradlew build -x checkstyleMain
@eternal oxide
I think I foudn the issue
somehow my ide added a tab to the edit I made
even though I only edited text no line breaks
still fails to build though 😛
not my fault this time ```
EconomyTest. testEconomy
MessagingTest. testNonNullLastMessageReplyRecipient
both their own tests
how do I make thsi crap build and ignore the tests?
ok seems I can ignore their failed tests
I also cant build it, it complains about missing files and stuff
because of the tests
very weird repository lol
very
okay I got it to work
by using this:
gradle EssentialsX:build -x checkstyleMain -x test
I've got it building just can;t get it to throw me a shaded jar yet
using the above command, it builds a 2mb jar file for me
just do this, should work fine
yeah lmao
It looks like this "bug" has been in Essentials since 1.8. Added by Snowleo as a parting gift 🙂
its risen its head now because they abstracted a lot of their permission stuff and its now failing
what bug dym?
I wonder if he added it as a bomb
he's too good of a programmer to make teh mistake of not knowing a Player is also instanceof OfflinePlayer
oh that bug
it doesn;t fix their issue though
what is that crashing sound used in a lot of plugins?
so they can find and fix it themselves. I'll just recommend people to not use essentials as it fails permission checks.
crashing sound?
well but
CMI isnt exactly better 😄
you got a link to a video that has this sound?
well then it's hard to help you 😄
sorry
guys, do you know why HexCode is not working ? i've created multiples methods to translate hexcode but some don't work and others got the wrong color x.x
public static String translateColorCodes(String message){
Pattern pattern = Pattern.compile("#[a-fA-F0-9]{6}");
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
String hexCode = message.substring(matcher.start(), matcher.end());
String replaceSharp = hexCode.replace('#', 'x');
char[] ch = replaceSharp.toCharArray();
StringBuilder builder = new StringBuilder("");
for (char c : ch) {
builder.append("&" + c);
}
message = message.replace(hexCode, builder.toString());
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message);
}
one of the methods that i hvae
x.x
also i tried with this resource :
public String translateHexColorCodes(String message)
{
String startTag = "&#"; String endTag = "";
final Pattern hexPattern = Pattern.compile(startTag + ""([A-Fa-f0-9]{6})" + endTag);
Matcher matcher = hexPattern.matcher(message);
StringBuffer buffer = new StringBuffer(message.length() + 4 * 8);
while (matcher.find())
{
String group = matcher.group(1);
matcher.appendReplacement(buffer, COLOR_CHAR + "x"
+ COLOR_CHAR + group.charAt(0) + COLOR_CHAR + group.charAt(1)
+ COLOR_CHAR + group.charAt(2) + COLOR_CHAR + group.charAt(3)
+ COLOR_CHAR + group.charAt(4) + COLOR_CHAR + group.charAt(5)
);
}
return matcher.appendTail(buffer).toString();
}
you may or may not be color blind
nono xddd
Have you tried this approach?
#general message
how does your finished translated code look like?
hex colors are supposed to look like this, e.g. for ff0000:
§x§f§f§0§0§0§0SOME RED TEXT
I use pretty weird regex stuff to translate it
Is there a way in 1.19 to remove the "Message modified by server" tag in chat? Not trying to do sneaky things... just annoyed at how it looks
yes
1 sec
works good
Interesting, I'll look into that, thanks
np
Can you explain or know of any event method so that the player cannot throw a certain item from the inventory to the ground?
declaration: package: org.bukkit.event.player, class: PlayerDropItemEvent
Hey, Is there in any way to get list ItemStack of entity's droptable?
Like I want to double the mobs drop but I don't want to double the horse inventory for example.
Thank you!
I dont think so. If I was you, I'd simply get the drops in the EntityDeathEvent, then double it, then loop over the inventory contents and "reduce those items" again
np ❤️
The "those items" could be anything xd.
Listening to EntityDeathEvent is what I currently do.
yeah sure, I know
but couldnt you just do something like this?
List<ItemStack> toDrop = new ArrayList<>();
for(ItemStack item : event.getDrops()) {
toDrop.add(item);
toDrop.add(item);
}
for(ItemStack item : event.getEntity().getInventory()) {
toDrop.remove(item);
}
event.setDrops(toDrop);
just written by hand but soooomething like this should work, I guess?
This is what I have right now https://paste.md-5.net/ebikigocoy.cs
np! let me know if it doesn't work
that looks good I guess
quick q any issue with using full-sized world name + random uuid for instantiating temp worlds or do I run the risk of getting a directory size that is too long?
I guess it depends where the server base dir is located
hm
actually you know what
I'm overthinking this
I'll just number them and increment
I’ve never had good success loading a world at runtime, always causes a noticeable lag spike
isn't there some async trickery that can be done?
Not sure
It almost works, the only problem is the chest got doubled.
Like It supposed to drop only 1 chest, not 2.
Just remove the chest then
you mean the chest that donkeys can "mount" or what's it called?
I don’t think any mobs drop a chest normally
Yeah that's what I mean.
for (ItemStack stack : event.getDrops()) {
toDrop.add(stack);
if (entity instanceof InventoryHolder &&
stack.getType() == Material.CHEST) {
continue;
}
toDrop.add(stack);
}
```I add a check between doubling the items.
should probs move that instanceof check out of the for loop
so you are adding teh stack, then if the item is a chest, add it again?
only issues I've had were with uppercase names
SkyblockWorld25 bugged lots but skyblockworld25 worked fine
fun
If the item is a chest, then don't double it.
but it's still doubling it?
@tender shard well bugger me, it turns out is WAS a GroupManager issue
is it possible to load worlds in async? I'm getting WorldBorderCenterChangeEvent may only be triggered synchronously. just using the Bukkit.createWorld mehtod
I know they have some async stuff, just don't remember what
I usually just like
preload the worlds
let's see how heavy the operation is anyway
and then unload em
I'm creating them dynamically is the issue
I just had 25 premade worlds that I'd unload, paste the .mca files and reload
yeah nonstarter for my use case
Is there a way to increase the maximum health of an entity?
.setMaxHealth is deprecated
pretty sure entities can have attributes too
What do you mean?
Ah
damn
half the european squad is up at like 4am what is this 👀
just google it
One question, this is an example, if my plugin weighs more than 10MB, will that affect the performance of my server?
will be a bit heavy on the classloader but shouldn't matter much
bet most of it is just database libraries
try it and see, but overall yes
good practice: stop naming events as e, 1 letter variables are horrible for readability
naming it as event is 10 times better
Good practice: stop copypasting code just because it's simple - instead just look at it and write it yourself, helps you understand it at a deeper level
It's fine to copy repetitive tasks (or task someone else with it), no one wants to write 80 color rgb values manually
It is true that a well-optimized and orderly code is better than having a code with short or messy words.
variable names don't matter much purely based on performance, but enforce high standards
If the developer takes the time to name every variable properly, they're more likely to take the time with other niche things like optimization and actual logic
Just like seeing someone take notes
Organized people are overall better when it comes to knowing what they wrote, because they accounted for it when organizing themselves
How can I get the name of the clicked inventory?
Why do you need the title?
If you're comparing inventories, use views
If you absolutely need the title, InventoryView#getTitle
Trying to see if the inventory clicked on is a GUI
And I am using the inventory click event
you gotta validate locations
Rand X,Z then use world#getHighestBlock check if its material is water, if it is, repeat, else, continue.
PlayerDisconnectEvent
Lol I didn't see before. Thanks
Wanted plugin?
If its yellow
do you want a plugin that has wanted levels
Ok. Tell me about yourself.
Yes
Iranian
16 years old
Boy
Just bother your favourite search engine
This was the first link in mine
https://www.spigotmc.org/resources/wanted.93932/
I search it
Thanks
When kills add wanted to the killer
?
I want to make more than 100 ItemStack is it better to do it in the code or add them in config.yml ?
Why would the amount of ItemStacks matter for that decision?
config.yml -> Data driven
In code -> Hard coded
If you plugin need customize it config files better
Do you want to dynamically add new items?
hi guys, i have a problem. When two inventories have the same title, there are two active listener on the same. How can I do to identify without the titles the inventory?
Yes
Check for equality. You should never ever rely on names or lore for anything.
Then you cant just code them... Weird question.
So I take the inventory back and compare it? Isn't that too heavy as process?
Its even faster than checking the name.
thank you very much!
Ok
If you use a hashed structure then this is really simple.
If you have multiple guis for one listener then create a Set<Inventory>
If its the same then just use a field
hm
wait a minute, but if something within the inventory changes like a lore of an item, that can't be done anymore can it?
I mean, the equality check
Why? Its still the same inventory
Like. If an ItemStack changes then it will change in the object. Not in the variable.
Inventory invA = Bukkit.createInventory(...);
Inventory invB = invA;
Inventory invC = invA;
invA.setItem(X..);
invC.setItem(Y..);
invA.equals(invA); // -> true
invA.equals(invB); // -> true
invA.equals(invC); // -> true
invB.equals(invC); // -> true
All 3 variables contain literally the same object in memory.
this doesnt seemed to work:
player.sendBlockChange(block.getLocation(),Material.AIR.createBlockData());
what is in this line: at LoginSystem$MinecraftEvent.PlayerJoin(LoginSystem.java:38) ~[?:?]
so embed is probably null
then DiscordUser
just verify
then you can send images
well, i cant do much with it without looking at your BuildedBot/LoginSystemDB class. also why are you getting the user 2 times with 2 different methods
Guys, on the other hand regarding textures, the inventory at onJoin closes if it loads a texture. How can I evaluate IF THERE IS a texture and IF it has loaded? And at that point open the inventory? Maybe you have to do a while until this condition is positive? I don't know
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerResourcePackStatusEvent.html
declaration: package: org.bukkit.event.player, class: PlayerResourcePackStatusEvent
I can calculate expressions with multiple operators now so uhh kinda
Yet to implement op priority
Use a PreparedStatement
Use try w resources
What's the problem then
Do you check if they have joined before
PreparedStatement ps = sql.getConnection().prepareStatement("SELECT DiscordID FROM playerinfo WHERE MinecraftUuid=?");
ps.setString(1, uuid);
ResultSet result = ps.executeQuery();
if (result.next()) {
return result.getString("DiscordId");
}
?db
:c
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I wouldn't blame JDA
what is line 34 in LoginSystem.java
either #getUserById or #getDiscordByUUID is null
or wait
at which point (in game) is this embed builder called
in what event
the player is likely not null
so i think the best way is to check what of those is null
i suppose it's getUserByID
because you should always start off from the guild when retrieving/getting most stuff
Thats one way of lagging out your server...
yea, that's your discord user-id
so that isn't null at least
do some debug log's to find out what is null
IO on the main thread
you're requesting something from your Database i guess?
which takes time.
how much time, depends on your server's internet connection
Use AsyncPlayerPreLoginEvent
so your own internet connection
so everytime a player joins, the server hangs up until the request is taken
which can in worst case be few seconds, or even a complete freeze in some cases
you don;t
you use a CompletableFuture with a Consumer or something similar to run code once the SQL is finished.
its not that simple. You also have to have some kind of queue or a Lock to maintain a sequence of queries
The heck is this supposed to be?
@EventHandler
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
// Load your player data here
}
Its just an event
Hi all! Please tell me how to make one player hit an item that was made in the ItemStack, and when another player hits, the text appears on the display as in the command /tittle
p will be null there
Because the player isnt on the server yet. Thats why its called AsyncPlayerPreLoginEvent
You dont need the player
Why do you need the player?
all you need is the uuid which is provided
otherwise get the offlineplayer
BlockState -> cast to Chest -> rename
Why? You dont need the player for loading his data
That will not work in the pre login event
Becasue you dont need the player
how would you send a message to a player who's not there
Decompilers sometimes show something different than the actual code.
- It is a bit of guesswork to know what exactly the developer typed
- Some code might have been optimized when compiling.
The first is because there is more than 1 way to type code to convert to the same Java bytecode
shows nothing
hi guys can someone help with
Bukkit.dispatchCommand(console, "tab player" + target.getName() + " tabprefix " + args[2]);
it's only type in console tab player
Is possible to activate near redstone and other mechanisms?
You mean active redstone when near it?
Yes
Of course it's possible
And how?
?jd-s
Idk start with something like https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/type/RedstoneWire.html
declaration: package: org.bukkit.block.data.type, interface: RedstoneWire
Ok thanks
can u help with my problem please
?paste your entire code you're having issues with
Put a blank
how?
Bukkit.dispatchCommand(console, "tab player " + target.getName() + " tabprefix " + args[2]);```
ok i try
omg ty
im an idiot XD
hello guys i got a question
i had a paper server and everyone joining had same ip is that fixible?
How can everyone join with the same IP? You mean a bunch of people are?
you mean you had a paper server behind a bungee proxy?
What kind of situation is this? And #help-server
nope
its not
just a normal server
everyone has the same
ip
not even the servers ip or the nodes ip
Where are you hosting it? Is it possible the host is redirecting things? How are you checking the addresses?
show how you are getting a players IP
like normaly
cortex
What do you mean normally
like any other server does
going to have to speak to me like I'm not any other server
i decided to added it through a proxy and enable ip forward will that work?
We can't help if you don;t answer questions
Does the panel have something to log IPs? Is it a plugin? Which plugin?
no i dont have any plugin for that
Alright back to square one. How are you getting the IP of players
ummm
what do you mean
xD
this?
You said everyone has the same IP what do you mean by that
How do you know everyone has the same IP? How are you verifying this?
if i ip banned someone the server banned everyone
can you delay the connection time of a player?
by hanging the thread handling the connection or similar
Ah now we're getting somewhere lol. Probably a #help-server issue but to me sounds like your host puts it behind a proxy or something
so if i add it thourgh a proxy my self it wont solve it?
The issue here is that if players connect to what essentially is a proxy then you can't fix it only the host can and I doubt they will.
oh maybe that is the ddos protection
When you IP ban someone you're really banning the proxy preventing any connections
yep
Probably. That approach might work, but you don't want to delay connections too long otherwise they might timeout. Why are you wanting to delay their login?
if you're using ddos prevention that might be it because it will filter players through it and thus it will look like they're all the same IP
its the hosts ddos protection
Then go contact them I suppose
How do i put all the added itemstacks from a arraylist in a gui?
by looping through one with a for loop and using the index to insert/copy it into the other?
Thanks i will try that!
so the player doesn't join until their data is loaded from a database
how can I get the connection thread?
Just listen for the AsyncPlayerPreLoginEvent and do your database stuff in there. That event should do what you want.
How slow is your DB that a request would take so long as to be noticed before they finish joining?
If it's truly that slow cache it in memory
Lazy load what can be used later
it's more about if a player leaves and then joins back immediately (by using 2 clients or so) i noticed that there's not enough time for the data to be saved and loaded back
right now i'm kicking the player if the data has not unloaded yet, but i'd rather be sure the player has no way of interacting with the world until the data is loaded
a query takes around 100ms but if for any reason it becomes slower i don't want issues to arise
Is it enough data to warrant loading and unloading?
what do you mean by that
Why not cache it in memory?
you mean not unloading it when the player leaves
well, sort of. I mean loading it all into memory
i'll probably do that and then unload and save the data if it is not needed for 5 minutes or so (ex the player doesn't join or their stats are not checked by commands or so)
i mean
how well would it scale
Depends what exactly you're storing and loading
player data
money, xp, level and so on
right now it's not a lot of data but i'm pretty sure it will increase
how can I properly get BlockData from an ItemStack?
with its meta
I think I got a version working, what’s an expression that yours fails?
pretty sure ItemStacks can't be applied to BlockData
wait no i lied
Material.createBlockData()
declaration: package: org.bukkit, enum: Material
yea, but is the meta included? or do I need to use the BlockData's meta or smth?
what are you trying to do?
send a barrier block to a specific player and give it some kind of uniqueness with info
why not use pdc
I use pdc
but isnt the pdc stored in the ItemMeta for ItemStacks
BlockData got pdc?
no blockData has nothing to do with item meta
and if you have a barrier block, for what do you need the itemstack
wdym by "uniqueness"?
I dont need it, but I want to know how to information/provide uniqueness to a block
you cant exactly store any custom information inside a block
a placed block or itemstack?
but inside the chunk the block is in
you are mentioning itemstack but and talking about a placed block
alex had a good resource for it
big bruh
ty
how to loop every 2 seconds
?scheduling
how can I do this shadow stuff in gradle?
just dont use gradle 
why? gradle is awesome
it's also built in nbtAPI
Show me your build.gradle file
plugins {
id 'java'
}
group = 'com.squidxtv'
version = "${version}"
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'jeff-media-public'
url = 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/'
}
maven { url "https://repo.dmulloy2.net/repository/public/" }
maven { url "https://libraries.minecraft.net/" }
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
implementation 'org.jetbrains:annotations:23.0.0'
compileOnly 'org.spigotmc:spigot:' + String.valueOf(spigot_version)
compileOnly group: "com.comphenix.protocol", name: "ProtocolLib", version: "${protocollib_version}"
compileOnly group: "com.jeff_media", name: "CustomBlockData", version: "2.1.0"
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
I'm not sure if I even added it correctly
yes, but with compileOnly it will fail
the server wont find the classes you are using since it dont know them
yep, change it to implementation
If you want to shade then you need the shadow plugin
so like this?:
shadowJar {
relocate("com.jeff_media.customblockdata", "your.package.name.customblockdata")
}
but obv change "your.package.name.customblockdata" to the correct one
Wdym
I think I got an expression calculator working that takes +,-,*,/,^ and parentheses and evaluates with order of operations
And technically I think it even wouldn’t mind accepting variables
if I'd write a math thing, I'd just throw everything into bc and return the result 😄
oh you people are talking about my stuff
is there anything I can help with?
maybe
I only just woke up
so the gradle stuff should work now
now I want to send a Barrier block to the player
with custom block data using your stuff
I'm not exactly sure what you mean. the CustomBlockData stuff is to get a PDC for every block, it has nothing to do with "showing block changes to players" or anything
but I'm not sure which block I should pass as an argument cause I only have either Material.BARRIER or the blockdata
BlockData block = Material.BARRIER.createBlockData();
PersistentDataContainer pdc = new CustomBlockData(block, FrameUI.getInstance());
ik, I use it for the pdc stuff, the sending stuff is alr. done
that looks good, yeah
but block is a BlockData instance and not Block
oh yeah
this won't work. BlockData has no reference to the location
you need to throw in a block to store your data, otherwise it cannot be stored in the world
how tho? Block is an interface
you are going to place this barrier in the world, right?
oh I see, this is not going to work at all then
a barrier you don't actually place, is not saved in the world, hence you cannot use CustomBlockData for this :/
so I cant store pdc in that cause?
unfortunately, no
maybe I just send it to all player :/
CustomBlockData works like this:
It uses the actual chunk's PDC to store data with a key that's equal to the block's chunk coordinates
so e.g. if you place a block in the chunk's 0,0,0 location, it just adds a key called "0,0,0" to the chunk and uses that for the blockdata
so yeah, without an actually placed block, it will not work
np
I mean you could in theory incorporate the uuid of the player into the key of your data.
You can store multiple nested pdcs inside a pdc.
But that sounds a bit hacky.
Speaking about the key combination
oh ok
yeah but where are they going to store this data?
I'd probably just use a HashMap or similar
like a Map<Block,MyDataClass> and that's it
or, if they need to also remember the player, a Hashtable<Block,UUID,MyDataClass> or similar
like this right?
world.setBlockData(x, y, z, data);
Block block = world.getBlockAt(x, y, z);
PersistentDataContainer pdc = new CustomBlockData(block, FrameUI.getInstance());
this would work fine, sure
ok ty
btw what way could you see barriers in minecraft 🤔
was it spectator/creative mode?
only creative IIRC
but there's a particle you could use instead
everyone can see those
the particle is called BLOCK_MARKER and it also requires to toss in a BlockData object
you shouldnt actually be able to see it, but I want to see it so I can test where it spawns
hey, I have a question regarding the entity player (class)
oh ok
just ask it
is there a way to allow fake players keeping chunks loaded?
you can just use chunk tickets
declaration: package: org.bukkit, interface: Chunk
Can you show me?
this will make the chunk keep loaded
ahh lol, thanks
np 😄
what is that map-color-cache?
I saw an old way of doing it with EntityPlayer#affectsSpawning, but after minecraft's code obfuscation, I don't really know if there is still a field for it
it's basically this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/map/MapPalette.MapColorCache.html
declaration: package: org.bukkit.map, class: MapPalette, interface: MapColorCache
Wifi in station goes brr lol
(pff wir sind einfach alle deutsch) :D
Sure gimme a few mins
Ty
Do you have an expression to add you haven’t been able to get to work?
Don't hurry im on a train
oh so minecraft alr. cache my custom maps?
not everyone, and optic's is very quick at kicking people, so we should stick to english 😛
Ngl idk how I typed to add there but you know what I mean
Just use mojang mappings. No obfuscation anymore.
ever
Uhh all my expressions of form "x operator y operator z etc" work, but withiut op priority
I cannot, didn't figure out how :(
hm never heard of that method. it's definitely called differently in mojang mappings
Okay I’ll ping in a few mins then
Goddamn train standing here for 20 minutes now lol
uh, let's speak english haha
Ill never understand
in which version was this method called like this? then we can just check the mappings and you'll see how it's called now
I only found a screenshot on spigotmc of it, I didn't try myself in versions before
hm I just checked 1.16.5 and 1.19.2 and both versions don't have this method
oooh
it's part of the Entity class
not Player
aight gimme a minute
lmao
that's the only thing I found but definitely what you're looking for 😄
getBlockPosBelowThatAffectsMyMovement
damn mojang
of course xD
I meant to say "definitely NOT what you're looking for" lol
sorry it's a bit early
only 3pm, I just woke up 😛
I took it ironically
basically same result xD
but why don't you just use chunk tickets to keep the chunks loaded?
I made a plugin that is able to spawn fake players, and I want to use those players to load chunks realistically like a normal player
I see
hm
I would probably use a Map<Chunk,Integer> to store the amount of fake players who have this chunk loaded
null.
then load all chunks "nearby" your players
you didnt shade it
looks like you compiled it with your IDE instead of using the shadowJar gradle task
shadowJar {
relocate("com.jeff_media.customblockdata", "your.package.name.customblockdata")
}
maybe that's the solution, I thought I could use something directly from the api / nms :(
oh
I think doing the chunk loading yourself is easier
you basically do just with some extra loops
so like this?
usually only "shadowJar" is enough
shadowJar already includes "build"
alr, going to start :D
yes, I'll try
I'll send you my ChunkManager class, just in case lol
also good :)
public class ChunkManager {
private static final WorldHealPlugin plugin = WorldHealPlugin.getInstance();
private final HashMap<Chunk, Integer> loadedChunks = new HashMap<>();
public void keepChunk(Chunk chunk) {
loadedChunks.put(chunk, loadedChunks.getOrDefault(chunk, 0) + 1);
plugin.debug("Keeping chunk loaded: " + chunk);
chunk.addPluginChunkTicket(plugin);
}
public void freeChunk(Chunk chunk) {
plugin.debug("Trying to free chunk " + chunk + "...");
loadedChunks.computeIfPresent(chunk, (__, amount) -> (amount - 1 <= 0) ? null : amount - 1);
if(!loadedChunks.containsKey(chunk)) {
plugin.debug("...freeing chunk " + chunk);
chunk.removePluginChunkTicket(plugin);
} else {
plugin.debug("...cannot free chunk " + chunk + " yet");
}
}
}
it works like this:
you can call "keepChunk(...)" for example three times
it will only get unlaoded again when you called "freeChunk" 3 times too
and obv you can ignore all those debug outputs 😄
ahh alright, I guess I will stop the chunk unload event when it tries to free a chunk that is needed for the npc, thanks
its not
good question
and that doesnt even makes sense
what event if it keeps being loaded
until you manually unload the chunk
chunk tickets + manually checking "how many fake players are causing this chunk to stay loaded" are the way to go ^
I planned to load it one time and then cancel everytime the server tries to unload it
if the chunk has a chunk ticket the server wont try to unload it until the ticket has been removed
exactly
yes, alright
@tardy delta
Would ve 45 for me lol
Lol
XD

Meth
ahaha
Oh 
I already googled the result ahaha
LMAO
But yeah @tardy delta I just used the RPN notation that I've been recommending you use 
And I'm converting the infix into RPN and then calculating RPN is trivial
if the chunk is not loaded before adding the chunk ticket, will it then get loaded?
or should I Chunk#load() before adding it?
or after?
Oh I thought it wasn't 
How do I change the direction of a block? Can't really find anything apart from blockdata but that didn't seem to work
Fixed multiple operators yesterday
With some kind of token linkedlist
how should I then "destroy"/remove the block if I want to?
can I just use block.breakNaturally? or is there a different "better" method?
Sounds complicated 
Maybe yours will be faster than mine, guess you can benchmark both of them when you're done
What spigot api should I use for my plugin to be compatible with all versions of minecraft for a 1.8.8 server?
If you want it to drop items and play effects use breakNaturally, otherwise just set it to air
ok :D
1.8.8
Thank you
yes
great
@grave plover you might also wanna take a look at PaperLib. it has methods to load chunks async, but falls back to "normal chunk loading" on spigot etc
so it will work great on paper and work "normally" when not using paper
yeah as said, I thought it was x + y + z instead of x + y * z 😛
is, for example view distance 8, meaning that there are 64 chunks around the player loaded?
no, it's more
4*64
it means something like this.... weird I need to get a pen and paper 😄
so then it means that there are 8 chunks in every direction loaded?
view-distance 8 should be "8 chunks to the left/right/up/down + the center chunk"
kinda, yeah
although tbh noone would care if your math for this is off by one chunk
i thought it would be total left/ right and up/down
xD
just wanted to know
nope, otherwise it wouldn't be called "view-distance" but "view-radius"
I guess
but why dont you just load the chunk the NPC is in
hmmmm maybe
because we need BIG farms
xD
or do you want to fake an entire network
very efficient
damn your players must be very hungry lol
lets make a network with only AI players
and then see what happens
no, I ain't interested in bringing a dead server to life with fake players xD
I only want the vibe that there are players that load chunks, which aren't really true players
you don't have to understand me
tbh
:3
yeah maybe they beat the enderdragon
maybe they will invade humanity
they build their own infrastructure and make their own minecraft server within the minecraft server
and if you look back into it after 3 days of nothing you see a plugin folder full of ai-created plugins
loll my server just crashed
Well of course it did, infinite AI creating minecraft servers you'll get a stackover flow eventually
im new to making plugins, and I am wondering where I should start learning. Any suggestions?
I think it crashed cause I was caching many, many chunks
but they wont notice
time would just stop for them
maybe we are AI
Should we try crashing our parent systems..? See what happens?
echo "* * * * * shutdown now" > /etc/cron.d/something
for(int x = -4; x <= 4; x++) {
for(int z = -4; z <= 4; z++) {
location.getWorld().getChunkAt(location.getBlockX() + x * 16, location.getBlockZ() + z * 16);
//ticketedChunks.add(chunk);
//ChunkUtil.loadChunk(chunk);
}
}
someone explain why MY SERVERS KEEPS CRASHING FROM THIS?
but.. would we notice?
wonder if the universe is single threaded
it got dem quantum powaz
Won't know until we do it I suppose..
nah it has 8 cores
not that we accidentally cause a rollback
it has one core per planet in our solar system
everything else is just a wallpaper
((Directional)coalChestBlock.getBlockData()).setFacing(BlockFace.EAST);
This doesn't work, anything I should change? class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftSkullPlayer cannot be cast to class org.bukkit.block.data.Directional
it looks like you tried to cast a "wall head" to Directional
it's just a skull yea