#help-development
1 messages · Page 204 of 1
a regular inventory would mean 1-5 is the hotbar
menu button..?
yeah I know that
i'd recommend not, just make a chest inventory gui
so I used getInventory method but I can't find way to set 1~5 slots
Ahha using crafting slot is not fancy way...
You could just keep an item in their normal inventory, since crafting items will be reverted to the main inventory when the inventory is closed by the client
I would have one menu item that you could click in top of their inventory, and then interacting with that would open a chest gui
granted, the player loses an inventory slot so not ideal for survival servers
Actually there are examples of servers keeping the items in the crafting slots
So it is possible to do
Umm?
Just experiment with it
But he said using crafting slot isn't good way
set the slots constantly
1 tick schedulers are not a good idea unless absolutely necessary
Play around with setting the item using rawslot while the inventory is closed; with a command or random event you can control
See if it immediately reverts or if it stays
the trick is to never actually close the inventory or get rid of the inventory object 😉
you can make the player not see it, doesn't mean the inventory had to actually close
he's talking about regular survival inventories
anyone have sleek solution to getiting the block the player is looking at
ray tracing
even so, the server doesn't have to register it closing, just only the client
getFacingBlock iirc
might be called something else i cant remember
player#getTargetBlockExact(int maxDistance)
depends. just imagine what the server is doing every tick anyway, e.g. physics for every entity, their AI, etc bla bla
well I already stated the way to work around doing schedulers
just never close or get rid of the inventory object on the server side 😉
how do I change the tip color of a tipped arrow?
is that even possible? I thought the arrow will always have the base potion's color
oh so we give potion
Hi, im taking the lines of a sign and trying check them but the int start from 0 and goes to 4 but if i do i++ it goes from 0 to 1 and it change the line n.1
Code: https://srcb.in/WHXu8Kk5oY
Any way to fix it
wdym? of course it goes from 0 to 1 if you do i++
yes but i want change the text from the 0 one not 1 because if i need to moderate the number 0 not the number 1 and i can't start from a negative number even
if you check the code i loop all the line check them and then get the line number to do that i made externally a int called i and every time i loop one line it goes from 0 to 1 and continue if you check the code you can understand what im trying to do
so you need to check for all lines on a sign?
I did check your code and tbh I have no clue what you're trying to do
for (int i = 0; i < 5; ++i) is what you want
for(String line: event.getLines()) { already this done the job
so whats the issue
yeah I also dont get it
if i have 4 lines and for example the 0 one contains a swear word the i++ is called before the line change and the number change to 1 and it change the line 1
then call i++ at the end of your loop?
or use i-1 instead of i?
or just set it explicitly, as Epic mentioned
for(int i = 0; i <= 3; i++) {
String currentLine = event.getLines().get(i);
..
}
if I got a method that gets a random number between 1 and 10 and if its below 5 i want to return it. What do I do if its above 5? What do I return then? Is there a good way to do this?
what can I return so i know when using the method that it didnt work
does spigot only allow mysql as database or can you also use sql server
you can use whatever you want
ait ty
spigot includes sqlite as dependency too
or you just use another external dependency
why not just getting a number between 1 and 5 then?
its not the real method I have its just one with the same problem but easier to describe
recompute the value?
whats that
just get a new value and check if its below 5
and if its not what do I return
Okay so if I got 5 shops with shop numbers from 1 to 5. And I want to get the smallest number of the shops that are not used by someone. Then I return the number. But sometimes all the shops are used so I cant return a number. What do I return then?
-1?
Yeah, either -1 or 0
Some invalid value
Alternatively, you could use an OptionalInt
What you return depends on your intended use case for the method tbh
ah ok
why is your main class called Utils?
plguin name is utils
thats what im saying
it should be called the main class name not plugin name
refractorered it to main
?main
Well, not necessarily much better 😅
Ideally it should be the name of your plugin, and optionally prefixed or suffixed with Plugin
e.g. for my VeinMiner plugin my class name is VeinMinerPlugin
UtilsPlugin
That'll do
Utils is just an odd name for a plugin is all because generally a class named Utils would be reserved for utility methods or something ;p
I think suffixing Plugin here is definitely needed
ok
is this good
or is calling the plugin.getconfig.getstring not that bad every time
It feels so strange seeing so few people name their plugin as <project name>Plugin
best advice ive ever gotten
You're fine to do that. It's returning the same instance every time anyways
you have eye issue
ok thanks
Whats the best api for guis? Because im lazy to use vanilla guis and lazy to make my own api for it 😅
Theres many apis but idk which one is good
there is no dark mode
is that not i9ntellij
That looks like github to me
Phoenix has a decent API
Thanks, I'll check it out
github does have dark mode
Yeah
Yeah, Stash has no dark mode
imports longer than all my classes
That has dark mode
Stash is awful
sad
You might have a Chrome extension
chrome is cringe
Dark mode 🤨
Chromium* extension. Every single browser except for Safari is chromium based now-a-days
Ohhh
Including Microsoft Edge lol
Makes sense
yesa but base chrome is cringe
I don't disagree. I've been using Vivaldi for a couple years
How would one make a lambda then get code from that lambda in java? For an api
Idk anything on how to make a lambda
() -> {}
:(){ :|:& };: hehehe
Well how would i put that into my api?
A custom lambda like this. How would one make this?
Since i wanna add a lambda to my own api
Supplier<InventoryClickEvent> s = event -> {}
oh ye it returns smth
Depends if you want to pass something as well
Oh.. that's simple 😅
Well technically that's all i needed but i wanted to make some custom lambda for my api to clean it up a bit
Map<Inventory, Map<Integer, Supplier<InventoryClickEvent>>> hm?
Integer is for the slot
could work

Use Function instead
It will allow you to pass the integer and return a InventoryClickEvent
Alr
assuming he needs multiple click actions, that wont work?
Map<Inv, Func<Int, InvClickEvent>>
BiFunction if you need the inventory and int
I mean so you at least understand what you're doing, a lambda is just syntax sugar for an interface implementation with only one method
public interface Something {
public String test(Object first, int second);
}```
can be referred to as `(first, second) -> "Hello world!";`
Java just so happens to provide a shit load of default ones in the java.util.function package
my books from college explain it very well 🥺 but i already knew all the stuff
I wish someone would have explained it to me the way I just did when I was learning lambdas
It would have made them a lot less mysterious
Yo Guys there's a way to open SignEdit GUI?
yes
Oh use packet?
ah bruh thought signEdit was some kind of library
You would have to use packets, yeah. I tried adding API for it, just in the works
💀
Oh which packet I should use?
ps my version is 1.19.2
ChannelPipeline channelPipeline = ((CraftPlayer) e.getPlayer()).getHandle().playerConnection.networkManager.channel.pipeline();
anyone know why this would throw this error?
https://paste.md-5.net/miloxiwube.cs
i am using the exact same version as dependency as the one my server is running...
Hi, i remember someone sent here a spigot resource of how to set multiple blocks without crashing the server.. it was sth like "Thread Block Operations" but i don't remember the real name.. can someone send it?
You need to listen to the PacketPlayInUpdateSign packet with ProtocolLib (or some other means of packet listening)
And to open the sign, send a PacketPlayOutOpenSignEditor
damn too late
fuck you EpicGodMC

ty all!
D:
help. me.! @tender shard smart man!
Modern stuff is Mojang mapped but reobfuscated at compile time
Hm..... I can't found that class
this is 1.8 tho
It's under NMS. Depending on the mappings you use it might be named differently
you use mojang mappings right? Seems like you are using the incorrect version or sth?
Oh Ok where I can see what's different between them?
i use no mappings at all
😦
I personally like to use https://nms.screamingsandals.org/1.19.2/
1.8.8
that site is heaven-sent
thank u
how can sandals scream
here's a tiny blog post I wrote about how to switch from spigot to mojang maps, idk if anyone needs it, just going to send it because NMS and mappings were mentioned: https://blog.jeff-media.com/switching-from-spigot-mappings-to-mojang-mappings/
(and for the record, these don't exist in 1.8 lol)
1.8 should cease to exist anyway
i dont understand how the field would not be named the same
its the exact same version from BuildTools
decompile your outdated spigot version and check how the field is called
-,-
channel
?????? idk
here it does say its obfuscated name is 'k' but how would i then access that
since intellij sais its named channel
It won't be obfuscated at runtime in 1.8. It should still be called channel
well aperantly its not...
Are you accessing this directly or via reflection?
directly
ChannelPipeline channelPipeline = ((CraftPlayer) e.getPlayer()).getHandle().playerConnection.networkManager.channel.pipeline(); like this
It's possible Paper remapped that or something?
currently not running paper
Is this a decompilation of the server jar you're using?
yes
I mean the stacktrace you sent indicates you are
paper.jar:git-Spigot-21fe707-741a1bd
Unless you just called the file paper.jar ;p
wanted to test with plain spigot for that reason
Why am I getting this error?
It's about time you learn about DRY
?
Issue with a simple plugin (new to making plugins)
Because of regex related symbols.
Actually you don't even need that. You could just use %s both times because they're in the correct order
I thought %2 was the player and $s was the msg
First %s is the display name, second is the message
<%s> %s is the default format, yes
ok
@worldly ingot
try {
for (Field field : Class.forName("net.minecraft.server.v1_8_R3.NetworkManager").getFields()) {
System.out.println(field.getName() + " : " + field.getType().getSimpleName());
}
} catch (Exception ex) {
ex.printStackTrace();
}
even when i do this...
makes no sense
How can I get the side a sign is attached to?
cast the blockdata to https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/type/Sign.html
declaration: package: org.bukkit.block.data.type, interface: Sign
and use #getRotation
what value does it return?
yeah but whats the "rotation" value
a class that cannot be extended from
oooooooh
one that cannot be extended
like the String class
it's pretty useless tbh
making a class final doesn't add ANY advantage, it only has downsides
i would like to see what would happen if String wasnt a final class
so, like, a class1 extends another class2 when class1 is a subclass of class2, right?
like, class1 has everything class2 has and more
by inheritance
yes
so a final class is a class which cannot have more subclasses
yes
I understand It now, thank you
like class Something extends String wouldnt work cuz String is a final class
Tbh most of the time your classes can be final
or you can not make them final, and allow other people to extend them, without doing any harm
using "final" on a class does not give yourself ANY advantage, all it does is to restrict others
I said that it won't make any difference
but it does
Depends if making api, some things just don't make sense to be extendable
if i have a scheduler with a runtasklater can i skip one iteration ? (Minigame where if all players die the code will skip to the next challenge instead of waiting the full duration)
if it doesn't make sense, noone will extend it
That's true
there's no reason for prohibiting it explicitly
omitted the code for readability
It's a security feature to stop people from extending classes they shouldn't
runTaskLater executes only once
it repeats bc i call the method inside itself
initChallenges() is the ss
i call it again instead of a screenshot because putting everything in a runnable makes it more difficult
I'm trying to make mob heads for display in a GUI from an EntityType.
any easy way to do that or do I have to set the owning player of the skull meta to a player who has that mobs head for a skin? (aka does anyone know any done factory methods for this?)
hey guys does anyone know how to set the spigot scoreboard to everyone in the server
can you somehow execute code before world loading?
I'm pretty sure your onEnable happens before the world loading. if you wanna be sure you can do onLoad()
also you are able to choose when your plugin loads. theres a setting when making a new plugin project, at least in IntelliJ with the MC Development plugin
interesting lemme try
What's the best way of making player based boosters? I have an idea but that involves 1 runnable every booster which i don't think is the best option
wym boosters? like speed boost?
Like custom boosters for money, tokens, ect
You just right click the item in your inventory
you could just tag the player with the time they activated the booster or the time it runs out, just tag their PDC so you can always check whether the booster should still be active
and then check whenever anything happens that a booster should be applied to
nvm
Okay, so i would need to use a runnable for it? I have an idea to check if the time is lower than 1 but i was wondering if i could get away with it without using a runnable
by tagging the player with the time the booster runs out, the type of booster activated, etc. you can definitely make it event based instead of runnable based. I'm also not sure what you would be doing in the runnable
By checking if the booster time is lower than 1, but i was thinking of making it event based too
BlockBreakEvent to be exact
hey, is there an way to stop some commands from being logged in console? i'm right now coding an login/account plugin for better player handling and bot prevention and i dont want the /register and /login command to be shown in log. this would completly break the password hashing i implemented.
you can always precalculate when the booster should run out. just using System.currentTimeMillis and add your seconds the booster should run, multiply those seconds by 1000 and you have your end time. then its as simple as checking whether the current system time > the time you tagged the booster with
You can add log filter to root logger
And return result deny if log contains x
Yeah thats what im doing, but i was just wondering if i could get away without a runnable. Which i might use since it shouldn't cost any performance, its literally 1 line to check
It'll run every 1 second, shouldn't cost any performance
the runnable shouldnt do anything to performance, no. if youre worried tho you can always just check on every BlockBreakEvent or whatever for whether the booster is still active
?paste
True, okay thanks. I just wanted someone else's opinion on this since im trying to get the best performance
a runnable to check every online player once every second is basically nothing
Yeah
is PlayerTeleportEvent::getTo nullable? i see its inherited from PlayerMoveEvent and its nullable there
in spigot 1.19.2,how to use NMS?
?buildtools
I use idea to wirte my plugin, but doesn't have NMS class to completion。
must reflex?
Buildtools...
homes:
home:
X: 188.1792827808719
Y: 123.0
Z: 255.72531835857524
YAW: -37.127888
PITCH: 16.359882
WORLD: 0d33a718-67c5-47bc-bdba-be02bb43bcae
spawn:
X: 187.79888664684006
Y: 124.0
Z: 251.36866753177642
YAW: -84.37789
PITCH: 33.759888
WORLD: 0d33a718-67c5-47bc-bdba-be02bb43bcae```
I've got this in a player data file, and I want to get the names of the homes into a string `Homes List: home, spawn` but I tried getKeys(boolean) and it doesn't map and Ideas?
getLogger().setFilter(new Filter() {
@Override
public boolean isLoggable(LogRecord record) {
if (record.getMessage().contains("/register") || record.getMessage().contains("/login")){
return false;
}
return false;
}
});
is this right?
(edit: sorry for the ugly formatting, dont know how to copy it right)
Does anyone know how i can get a message like this to display when an invalid argument is passed, this is not my command i'm just using it as an example
some command frameworks support it, i believe its done thro packets3
How to change AttributeModifiers in legacy using NBTAPI? https://github.com/tr7zw/Item-NBT-API/wiki
So, how to remove certain player drops based on lore?
For example on death I want to remove all items with lore that contains "Bound" in it.
This is my current code but it doesn't seem to work.
Version 1.8.8
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
event.setDeathMessage(null);
List <ItemStack> list = event.getDrops();
Iterator<ItemStack> i = list.iterator();
while(i.hasNext()){
ItemStack item = i.next();
if(item.getItemMeta().getLore().contains("Bound"))
i.remove();
}
}```
Create an array and set it to the player loot, iterate over the array, iterate over the lore lines and check if the line contains "Bound", if it does then just remove the item from the array and finally you can set the loot to the array
Isn't that the same like this?
Except it uses array instead of list
probably, try and see
but you would have to return true in any other case
and you would probably have to add it to root logger
try it
https://github.com/frandma/Utils/tree/master/src/main/java/me/frandma/utils/user how can i make a better user manager? (the user and userdata classes)
Does anyone know how I could get hex codes to work with kick and ban messages?
My code currently:
@EventHandler
public void PlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (plugin.getConfig().get("currentState") == "on") {
if (!player.hasPermission("maintenancemode.exempt")) {
player.kickPlayer(ChatColor.translateAlternateColorCodes('&',plugin.getConfig().getString("kickMessage")));
}
}
}
nesting if statements
shame
if (plugin.getConfig().get("currentState") != "on") return;
if (player.hasPermission("maintenancemode.exempt")) return;
i dont think you can use hex codes in kick messages
I am currently using Bungeecord's ChatColor class
that is just normal color codes
someone on here used hex codes
or combined color codes
idk
That's normal colours
Not hex codes
I already saw that thread
what is the font minecraft uses
seems like a pretty easy google search
dont compare strings by ==, use equals()
Hello ppl!
Is there any way to force a single chunk to save to disk ?
last question: how do i access the root logger to add the filter to it?
sorry i still need to learn a lot, especially in the topic logging and like this
isnt it only 1.13 tho?
declaration: package: org.bukkit, interface: Chunk
actualy nvm
What will happen if I call the unload function when a player is inside of the chunk ?
but it will save it right
I mean /save-all saves all chunks including the chunk a player is in
Is there a way to serialize and deserialize items from/to Mongo documents?
Is there a known plugin for returning crouching to the old mechanics (pre 1.16). I want to prevent players from being able to crawl under a 1.5block space
For none coding related questions please use #help-server channel
ik theres a way to make custom serializers, i tried before but it didnt work for some reason lol
Yes i tried that
I will try doing it via Gson
it will give you an error
saying something like mongo cant serialize it
Why?
So i can just do:
Document doc = new Document();
doc.set("item", gson.toJson(new ItemStack()));
ohhh i think it was the deserializer i was having issues with
ItemStacks are going to have a reference to an NMS ItemStack that may or may not play nicely with straight up json serialization
What a shity lib design so
You may want to look into how spigot serializes/deserializes for the YAML configs
I mean not really, it’s interfacing on top of the existing game
You can’t avoid it interacting with NMS
I have realize smth that i didnt know
i think i just got around it by creating a class i could serialize with json and storing info there, then rebuilding the object manually lol
why do api's not delete deprecated methods? maybe a dumb question i just dont know
They eventually do.
Agree
It's for compatiblilty reasons.
in case an older user wants to see where the new implementation is?
I dont see that
I mean admit it spigot api is not ell maintened
Its has a lot of weird things
It's mainly to give time for developers to update their projects.
yeah that makes sense
Then once they deem enough time has passed, they will remove it.
And that make a bad experience for us developers
The spigot api is not the best example of proper deprecation usage. Just look at Bukkit#getPlayer(String name), it's been deprecated for years, but has valid usecases and just hasn't been undeprecated.
Also shadow what is that stash thing i never seen that before
Deprecated does not necessarily mean it will be deleted in the future.
Also mongo driver has some shity things too
Maybe so, but isn't it mostly common?
In the way of using updateOne() without first checking if the document exists or/not, create it and then yes update it
🤡
Sometimes it just means you should read the docs to make sure you're using it properly.
Answering to?
that puts me on another topic
I mean, wouldn't a better annotation tag be the better approach in that case?
why do people not like mongo?
I think deprecated is the only way the API can tell the IDE/developer to be careful.
i feel like i just like it cause im creating classes that can be represented well as JSON
I guess that's fair, but I don't see why other tags couldn't be given the same functionality. It's not as if the IDE couldn't extend that functionality to other tags.
For example, getOfflinePlayer(String) isn't going anywhere.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getOfflinePlayer(java.lang.String)
I mean i think the best mongo usage representation that everybody would like to use, would be Mongoose from JavaScript is the best driver representation you can find. Because is not a pain to save things
if you are working with an obj and its has a name and uuid, its doesnt make sense only to get it via name or uuid
That is not a well design
And if you have a player name you typed into chat??
Why shity mongo doesnt create document in case it not exists when using MongoCollection#updateOne() ?
basically dropping item right now, setting gravity to false
and velocity to new Vector(0, 0, 0);
What means uncollideable?
and well it flies in random directions
That you dont get damage?
no
i think like falling sand
Mainly getting frozen?
yeah
frozen even if block is placed right on it's location
cuz when you place a block where dropped item lies
it moves to free space
yes
item = World.dropItem
item.freeze().setNotFreakingMovingAnyWhere().setNotInteractingWithBlocks().setNoPhysicsApplied()
Ik that when you have items on a block and you break it, they move to the block under the one you break it
when you place a block on the location of the dropped item
block just forces all drops to "move out"
so drops go all around the placed block
to any block which is AIR
So they can continue endlessly rotating 🙂
i cant think rn how should i make a method to generate locations based on the amount of players online that will give me evenly spaced coords with yaw and pitch all facing the center of a block
That's just math no?
i tried to remove gravity and velocity, but items started to fly upwards out from the block in which they have been spawned
I would like to see a library for loading/unloading structure simpliers that WorldEdit but atleast decent in terms of resources
Any idea? If you know anything like that let me know please
Because worledit library is really big library in terms of coding and uses lot of resources
well no answer
draw a picture
Yes you can. I was going to suggest that, but it's such a workaround.
cuz drops are unmaintainable
can i somehow make only armorstand's head glowing
without entire armorstand
Unsure, but in theory you could make the item it's holding glow.
hmmm
gonna try it
there is also fishing hook
and EGG
hmm
can i make frozen falling_block
inside the real block
with no gravity and velocity
I'm getting this error when trying to add a large integer to a hashmap... anyone know why?
That number exceeds the integer limit.
No. lol
You can use different datatype though. (long or BigInteger)
ok
can i make falling block invisible haha
the only solution which really worked
or can i make falling air
hey
about interface Damageable
when i do getDamage() on fresh item
would it return the durability
or 0
How many ms is 1 tick?
50
Are u sure?
20 ticks = 1 ms?
1tick = 50ms
1 second = 20 ticks; 1/20 = 0.05s per tick yeah
Because im make a TimeUtil class which converts a long duration and TimeUnit into ms
TimeUnit#toMillis(long duration)?
Hmn im mixed haha
I have broken my self
how to get durability of the armor piece
getDurability() is deprecated
in Damageable there is only damage
Found on the forums.
Material#getMaxDurability() - Damagable#getDamage()?
What's the recommended way to use the mojang mappings with gradle?
tf
paperweight
Just found it as I sent the message, thanks!
i see i can read the player permissions, but is it possible to set them?
No, the number has a character in it, that’s why it cannot be parsed
Oh, I missed that. xD
I think he would still have the large number issue though.
Any android developers here?
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
I don't think that applies to that question. lol
only in PMs.
It's the resultant which means it's the result of an action
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
I mean here you ask your dought public or you will not get helped
Making ref that many ppl dont like helping dms
i seem to fuck up my database every time i add smth new to my plugin lol
https://paste.md-5.net/icuguzefod.cs
Why is this PacketPlayInSteerVehicle class not working for 1.19.2?
hello my friends are all offline can anyone be a dummy player
u can be afk doesnt matter
does anyone know how to make durability on some items way better?
(not breaking in 5 hits against sharp 20+ items)
how tho, i tried different things like just stopping itemdamage event and damaging myself on entitydamagebyentityevent but it owquldnt rly work out
aint there any prebuilds to make durability enchant work way better
:/
you got any idea how i could achieve it? i been trying for so long, but i just cant get it to work lol
sharp 20 item
breaks armor within 5 hits#
i have special armor like the special sharp items which have like dura 8 but they still break easily
i want to make it like ultra durable
i tried but then it aint getting damaged from any sources but i just want on hit yk
ahhh ig ill try to find smth similar to my case online again, myself trying to find ways to cheat the system wont work lol
why is this not working?
public void spawnParticleAlongLine(Location start, Location end, Particle particle, Particle.DustTransition dustOptions, int pointsPerLine, int particleCount) {
double d = start.distance(end) / pointsPerLine;
for (int i = 0; i < pointsPerLine; i++) {
Location l = start.clone();
Vector direction = end.toVector().subtract(start.toVector()).normalize();
Vector v = direction.multiply(i * d);
l.add(v.getX(), v.getY(), v.getZ());
start.getWorld().spawnParticle(particle, l, 0, 0, 0, particleCount, dustOptions);
}
}```
it spawns particle but only at the 1 point
I hate those 1 line variables
double distanceBetweenPoints = start.distance(end) / pointsPerLine;
Vector offset = end.clone().subtract(start).normalize().multiply(distanceBetweenPoints);
for(int index = 0; index < pointsPerLine; index++) {
Location position = start.add(offset);
...
}
you can easily rewrite most of it
to be much simpler
i c
1 more thing
random.getBlock().setType(Material.WHEAT);
Ageable ageable = (Ageable) random.getBlock().getBlockData();
ageable.setAge(6);``` why is this not working?
are you updating the data
at me.outspending.spending.Testing.farmTesting$1.run(farmTesting.java:40) ~[sandPlugin.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.19.2.jar:git-Paper-220]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[paper-1.19.2.jar:git-Paper-220]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1473) ~[paper-1.19.2.jar:git-Paper-220]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:446) ~[paper-1.19.2.jar:git-Paper-220]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.2.jar:git-Paper-220]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.2.jar:git-Paper-220]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-220]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
that's the error
You're casting it to Ageable from the entity package
You need to cast it to org.bukkit.block.data.Ageable
oh..
ig i found a ok working solution: if damage > 3 then i give it a 50% chance to lose 1 durability
How can I get the device id of a player in bungeecord?
This came out way better than i thought tbh
Just gotta make the armor stand move up and down which is super easy
hello does anyone how to point an compass towards a player
nvm, i still need help w making armor durability better: https://minecraft.fandom.com/wiki/Armor i found how the damage is actually calculated here; any way to change these claculations?
Why
Reloading on a development server is fine
Yeah
I guess, usually I dont have many plugins on my dev server so doing /reload usually doesn't take that long anyways
True, i only have 4 plugins but its faster and easier with plugman imo
some ij plugin
True
Lol?
Damn 
Lol
Im still working on it doe, im adding some things to the armorstand and adding distances, since the lines will appear 500 blocks away 😅
And tf you mean url, i never copied any of this i just ask dumb questions sometimes
anyone know whats wrong with this code?
public final NpcTexture getNpcTexture(@NotNull String id) {
Intrinsics.checkParameterIsNotNull(id, "id");
Intrinsics.checkExpressionValueIsNotNull(config.getString("npc-textures." + id + ".texture-value"), "config.getString(\"npc-textures.$id.texture-value\")");
Intrinsics.checkExpressionValueIsNotNull(config.getString("npc-textures." + id + ".texture-signature"), "config.getString(\"npc-te\")");
return new NpcTexture(config.getString("npc-textures." + id + ".texture-value"), config.getString("npc-textures." + id + ".texture-signature"));
}
i keep getting this error https://paste.gg/p/anonymous/bc7d51ec700645869e0ce5d99067695b/files/cffdcd2940984bdeab3cdc311a006e60/raw because of it
Intrinsics.checkExpressionValueIsNotNull does not stop a value being null
Caused by: java.lang.IllegalStateException: config.getString("npc-textures.$id.texture-value") must not be null
This line in my code (and ones very similar) are giving me tons of errors because its null. How can I make a null check for this?
int i = Integer.parseInt(player.getInventory().getItem(39).getItemMeta().getLore().get(1).substring(13, player.getInventory().getItem(39).getItemMeta().getLore().get(1).toCharArray().length));
💀 what the actual fuck
what
I hate it so much
xD
yea probably so
LMAO im obcess with one-liners but that guy its on another lvl
whats that even meant to do
but how do I make a null checker for like .getitemmeta and .getlore.get(1)
uhh
bro...
that's not okay
it gets the 2nd lore line of the item in the 39th slot of their inventory and turns it into a sub string from 13 to the length of a char array of the 2nd line of lore of the 39th item in the player's inventory
!= null?
you don't need the 2nd argument of the substring
it auto substrings until the end if you don't supply it with the 2nd arg
yeah i was looking at the docs because i swore you didn't need it
what im confused abt in null check is if I do player.getInventory.getItem(39).getItemMeta.getLore().get(1) == null {return;}, it will give me error cus it cant get the lore or the meta or the first line of lore if those dont exist
ye i
k
and if I check and it is null its useless cus I cant check for the null checker
Ctrl alt L will be your mortal enemy then
does it make it all tabbed out
Yup
xD
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Bukkit.broadcastMessage("Welcome, " + event.getPlayer().getName() + " to the server!! :)");
}
Hii!
I was hoping this would make so that when someone joins the server, every player online gets the message: "Welcome, <playerName> to the server!! :)"
But it looks like It doesn't do anything 🤔
When I joined at least
do you know what i could do to fix it? its not mine but i have the src (prisonAIO and Cubed stuff)
u could use a for loop and loop online players and send them that msg
yeah, I could, I guess, but isn't that what Bukkit.broadcastMessage is supposed to do??
yea but apparently its not working
how do i make the order of the scoreboard not change when i set the score of something
yeah 🤔 I wanna know why tho. But thanks, It will probably work out
maybe it's being sent before you join
tbh its prob cus the server sent the msg before u joined
try delaying it by like a tick or 2
^
how do i make the order of the scoreboard not change when i set the score of something
can someone answer me
it could be anything
I just want it to not spam console
literally I just want it to stop pasting any errors in console for this specific thing
its so annoying
and it crashes server
ik that
I am checking for the 2nd line
it just says this every tick
ik but I want it to not give error if I dont
and if I do i want it to run code
Check if there is an item first?
I did
thats what I wanna learn how to do
And if it has a meta to get
yes thats the thing
when I check if player.getInventory().getItem(38).getItemMeta != null it gives me error cus it cant get the item meta in that if statement
I wanna know how to fix it
Well you can use a hasitemmeta
does anyone know what would be good for stopping something from being null
yea but .get(1) can give error
basically to replace Intrinsics.checkExpressionValueIsNotNull
How can I get FirstLogin player (BungeeCord)?
https://docs.oracle.com/javase/8/docs/api/java/util/Objects.html#requireNonNull-T- assuming you're validating parameters.
bru why can hasItemMeta give error
so if the item is not null this will not give error?
k
public final NpcTexture getNpcTexture(@NotNull String id) {
Intrinsics.checkParameterIsNotNull(id, "id");
Intrinsics.checkExpressionValueIsNotNull(config.getString("npc-textures." + id + ".texture-value"), "config.getString(\"npc-textures.$id.texture-value\")");
Intrinsics.checkExpressionValueIsNotNull(config.getString("npc-textures." + id + ".texture-signature"), "config.getString(\"npc-te\")");
return new NpcTexture(config.getString("npc-textures." + id + ".texture-value"), config.getString("npc-textures." + id + ".texture-signature"));
}
is what i got
i have the src but my brains kinda fried
actually I'm not sure what checkExpressionValueIsNotNull does so I can't say if it's a good replacement.
why not use Validate.notNull
now is Precondition (?
or just use plain java
hello world
i wanna to check if world is null and create one
i try this code but not working
public static WorldCreator Create() {
WorldCreator wc = new WorldCreator("oneblock");
wc.type(WorldType.FLAT);
wc.generatorSettings("0;"); // 2;0;1;
return wc;
}
public static void CheckonWorld() {
if (!(Bukkit.getServer().getWorld("oneblock").getWorldFolder().exists())) {
Bukkit.createWorld(Create());
Methods.CheckonBlockandSetSpawn();
}
}
any idea
it doesn't work bro
come on so obvious it just doesn't work
its up to you to figure it out
Any errors, any more information?
wait pls
okkay i'll try
how do i change the main class name?
i just refractored it but the plugin didnt load
make sure it changes on the rest of the stuff
where is the rest of the stuff
i changed it in all classses but dont i have to change something in the pom.xml
plugin.yml
ah
isnt that just directory not file
no, main
change it to the new main class name
ok
Java Naming Convention
try (PreparedStatement ps = c.prepareStatement("CREATE TABLE IF NOT EXISTS players (" +
"uuid varchar(255) PRIMARY KEY, " +
"modMode varchar(255) NOT NULL, " +
"muted varchar(255) NOT NULL, " +
"muteReason varchar(255) NOT NULL, " +
"banned varchar(255) NOT NULL, " +
"banReason varchar(255) NOT NULL);")) {
ps.execute();
}``` how to insert something into this table
i meant
insert plauyer
INSERT player INTO players?
or
insert uuid
or somethng
thank
Uuids are always 36 chars length, you can use just CHAR(36) or BINARY(16)
36 if you count the dashes
less if you remove them
32 if you remove the dashes (truncate it)
Is there a better way that I could pass in multiple of the same argument in my method?
Currently I have 3 booleans for 3 different states and it's hard to read in the IDE due to how long it gets.
But they all do the same thing for each one.
This is the issue I have: methodCall(5L, 10L, 15L, "string", false, false, true, false, false, false)
make a builder and pass settings
goddamn, seems like you got more problems than a long constructor
It's just an example.
appearently an example thats designed to give eye cancer 🙂
There's probably a better way to engineer it
builder pattern seems like a good way to do it
The first 3 booleans do the same thing but for different switch cases so I'm trying to figure out if there's a better way to pass those in.
enum maybe?
The idea is that for case 1, It checks the first boolean argument and does the same for all 3 cases going along those 3. (the first 3 booleans in there, the others are for a similar use case)
It has to be a different value for each one due to the way that it works.
You are being very vague
That's not intentional, I'm just not sure how to say it.
code speaks more than thousand words
a screenshot of your code or a paste of it

Alright, I've removed variable names since they're not necessary to this. (I'm paranoid lol)
And also removed the try catch stuff since that's not part of this example.
dw nobody here will steal your code 🙂
im pretty sure noone actually would want to steal your code
Is there a better way of passing in those 3 booleans and also the other 3? (such as using an array?)
i still have no idea what your intention there is
The switch statement checks an integer that should only be from 1 - 3 and for each case, there's 2 booleans.
you wanted help with how to pass in those values. we gave you multiple ways
now youve gotta decide on one
bool1 and bool4 are for Case 1
and so on
I'm guessing an array would be the best option for this.
not the best, but one of them
Sorry by the way, I know I could've labeled this more clearly.
What do you mean by boilerplate, exactly?
all im seeing right now is that you are probably doing 3 times the same
Long1 - Long3 are for each one and are used in the actual methods that are called depending on the number.
you could use composition and combine the longs and bools in an object each
The actual method calls a custom method in one of my utility classes so it's not really too helpful.
then give the method both objects and check on those or give them an execute() method. as cipher is saying we literally dont know your use case
It is just basically calling the same thing over but with each number
just show everything necessary
knowing your intention would help figuring out how to get there
so boilerplate, exactly what i said
Well, I have no clue how to simplify it, I'm still quite new.
it says redundant close() statement, do i not have to close the preparedstatement?
I'm just trying to figure out if there's a cleaner way of passing in the variables other than just spamming them over and over.
not in an auto close
you are inside a try resource
that ensures by the end of the scope that the resource is closed
á auto close
ok thanks
public void addPlayer(UUID uuid) {
try (PreparedStatement ps = c.prepareStatement("INSERT INTO players VALUES (uuid, modMode, muted, muteReason, banned, banReason) VALUES (?, ?, ?, ?, ?, ?)")) {
ps.setString(1, uuid.toString());
ps.setBoolean(2, false);
ps.setBoolean(3, false);
ps.setString(4, "");
ps.setBoolean(5, false);
ps.setString(6, "");
ps.executeQuery();
} catch (SQLException e){
Bukkit.getLogger().info(e.getClass().getName() + ": " + e.getMessage());
}
}``` the query causes an sqlexception
the sql code
How do I do that?
send the exception
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "VALUES": syntax error)
database there
remove the first values
just like I said in the message you quoted
I don't know what you mean exactly, I'm confused.
you know what an object is and that it can have attributes?
It's the way it's worded, I'm just confused.
and I'm confused by why you wont tell us what youre trying to reach. youre asking us about your attempted solution and how to fix it instead of giving us what we need to help you find an actual solution
I'm trying to figure out a better way of passing in the longs such as in their own array and then 3 booleans possibly in the same way and then another 3 in that way too. (or just in 1 array for them)
for example: what do those 3 booleans do exactly
The array one is just an example.
I'll blame it as XY problem
if the values cant be automatically generated you will need those 3 booleans somewhere
thats what I was aiming for, didnt know the name anymore
the booleans could belong to the object in the switch, for example
It's because I have so many different booleans that basically do the same thing but have to be separated.
Asking about your attempted solution rather than your actual problem
couldnt remember two letters
thats what I said cant you read
nah mfs tryna shame you
not letting him
shots fired
nah no hate just funny
wouldnt let that sit on me
no one can shame mfs that help people
not gonna take shame from someone who says orbyfied instead of orbified
bad name either way

flexing his bobux profile on his bio smh my head
tf is orbified
the correct english way to arrange letters
orbies
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:" + dataFolder);
try (PreparedStatement ps = c.prepareStatement("CREATE TABLE IF NOT EXISTS players (" +
"uuid varchar(255) PRIMARY KEY, " +
"modMode varchar(255) NOT NULL, " +
"muted varchar(255) NOT NULL, " +
"muteReason varchar(255) NOT NULL, " +
"banned varchar(255) NOT NULL, " +
"banReason varchar(255) NOT NULL);")) {
ps.execute();
} catch (Exception e) {
Bukkit.getLogger().info(e.getClass().getName() + ": " + e.getMessage());
}
} catch (SQLException | ClassNotFoundException e) {
Bukkit.getLogger().info(e.getClass().getName() + ": " + e.getMessage());
}```
```java
public void addPlayer(UUID uuid) {
try (PreparedStatement ps = c.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?);")) {
ps.setString(1, uuid.toString());
ps.setBoolean(2, false);
ps.setBoolean(3, false);
ps.setString(4, "");
ps.setBoolean(5, false);
ps.setString(6, "");
ps.executeQuery();
} catch (SQLException e){
Bukkit.getLogger().info(e.getClass().getName() + ": " + e.getMessage());
}
}``` `java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (table players has 7 columns but 6 values were supplied)`
singular orby
md5 paste doesnt work
bruh that code
you have 7 columns I asssume
yes
probably accidentally created a table with 7 columns
sure it's good as a first attempt at sql
uh oh
or... just delete the sqlite file
oh bruh sqlite
i changed some stuff
🤦
SQLite is really weird.
it's... pretty easy to debug stuff like this
no need to ask questions every time you have an error
spigot discord is best problem solver
save our brain power for client crashes due to nms
what about solving your own problems
funny joke
error says what the problem is and how to solve it 90% of the time
?bing it otherwise
Bing your question before asking it:
https://www.bing.com/
wish I could but those arent as interesting
(related to earlier) I'm just going to try using an array, idk at this point.
at least you should be able to derive how to solve it from the error after a while
only a therapist can solve mine
I can't fuckin type today
bing 🤣
learn psychology
the error said the table players has 7 columns but 6 values were supplied
nah that therapist would need a therapist as well then
supreme court of therapists
can't wait to get home tonight and have to run away again
infinite recursion
therapist overflow
we neither since you dont share your stuff
what are you trying to do
fancy small size boolean array
simple n effective
put everything into one long and evaluate it
we dont know
you could use a nibble
what do i change so its super good second attempt
The number can be higher than 2147483647 so..
boolean isPositionEnabled(byte mask, int position) {
return ((mask) & (1 << (position - 1))) != 0;
}
I had to use a long in-order to do so.
abstract away everything into an auto query builder
funny how its like bit byte kilobyte etc but then between bit and byte theres actually mf nibble
or make your own Hybernate
nibble is just 4 bits
so 0-15
yeah
minecraft uses nibbles for lighting
4 bools
explain in fornite terms
a bool is just a bit
alt+f4
yeah but as you may know stored as a byte for alignment like everywhere unless you explicitly dont
The battle bus (query) gets populated by gamers (data) that drop into the world (mysql database), through the matchmaking system (data -> query auto builder)
best analogy
that's just the magic of working with simple 8-bit based architecture
I never played fornite so fuck off
boomer
even after it doesnt work anymore? wow
half the serious game companies have their own launcher
I did waste like 5 hours yesterday playing flash games
rest of the day was spent helping a friend move
do you know battlemechs


