#help-development
1 messages Β· Page 2098 of 1
how can i access i in the scope i need it in (underlined by orange)
persistentancy?
Oh
right... so like
ill give a data to a block right?
blocks chunk?
not the block?
Can I ask why?
I see
would it be efficient tho? to like have a pdc for every block in a chunk
i mean
i can probably just store the true values
and delete them if they are false
that would be more efficient
okay! thanks!
bump
yes they do
I don't know if regular blocks have them but blocks that have entities do
it does
I guess not for the block then
bump
final int x = i;
new BukkitRunnable()...
true runnable only needed if you want to be able to cancel and keep track of the task
i trie dthat, didn't work
that will compile, maybe not the result you wanted but it'll compile
i need to run later
is their anything wrong with this syntax. the second command won't load ```
commands:
test:
description: TestCommand
usage: /test
permission: 2
mark:
description: Marks Loot
usage: /mark <x> <y> <z>
permission: 2
this.getCommand("mark").setExecutor(new MarkLoot());```
look at the differences
the mark one has usage and permission on an extra tab, while the first one are all inline. Remove the extra tab on the usage and permission of mark and give it a shot
oh thanks
what is the best way to check how long it has been since a player left?
config file or database I'd say
thats the thing. Basically I have a cache and after like 5 minutes after the player leaves I want to save their data from the cache to the database. So do I use a hashmap and store the uuid and the time left and create a timer that checks to see if the player is online?
nvm it had worked...
I just had interfering var names
thanks
Why wait 5 minutes?
So that if the player rejoins within 5 minutes it means that it can just get the concurrent data from cache rather than from the database.
trying to relief stress off the database and keep it on the cache
Fair, your hashmap idea would work well, but instead of 5 minutes for each player, I'd say just flush the entire offline cache every 5 minutes instead of keeping track of that for each player
so have two caches one for online and one offline and every 5 minutes flush the offline?
I've never coded a spigot plugin before, is there any where I can be directed to start?
You shouldn't need to store anything for the online players, if they're on the server you just assume they've been offline for 0
Ok cheers for the help
either from the spigot website or youtubers. i'd suggest Kody Simpson
Anyone know if XSeries is worth going into?
definitely, used that for a year and doesn't have any issue
Does it just help with version compatibility?
yeah, it's mainly for cross version compability
What's the best way to create a leaderboard system with mysql database? I want it to be updated and sync across multiple servers, basically I want to have a highest killstreak leaderboard.
Give an example
You can't add custom textures without a resource pack
transfer packets in bedrock transfer clients between ips. how does this help cross regional players?
uk players would get bad ping with a typical proxy
but if there was a server in the uk region, and someone from us wanted to play on it, wouldnt that get higher ping aswell?
okay nevermindi understand it more after using the discord search function β¨
How can I check for if a player has killed an entity such as a pig or cow. When looking online I can only see other players.
declaration: package: org.bukkit.event.entity, class: EntityDeathEvent
Player player = event.getEntity().getKiller();
if (player == null) // no killer
Does Location.getBlock() return an air when there is no block at the location?
yup
ty
and there would be no reason that Location.getBlock().setType(...) would error in that case I assume
right
alr thanks
int freeSlotsOnPlayerInv = 0;
for (ItemStack itemStack : p.getInventory().getContents()){
if (itemStack == null || itemStack.getType().isAir()) continue;
freeSlotsOnPlayerInv++;
}
how is that returning the amount of slots used instead of the empty slots?
27 in this case
wait no
tf
wait no ignore that
Anyone know if there is a reliable way for me to switch between Java 8 and Java 16?
I'd recommend not using continue like that in such a small loop
are you just trying to see if the player has an empty inventory slot?
theres a WAY simpler way of doing this if you do
kinda, i have a list of items i want to check if player has enough space to add them all
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/Inventory.html#firstEmpty()
Use this method before adding each ItemStack object to the players inventory
declaration: package: org.bukkit.inventory, interface: Inventory
does anyone know why the 1.18.2 spigot.jar file is not recognizing anything such as when i import something its only org.bukkit.craftbukkit and cant do anything else (its hard to explain)
if greater than -1 player has space
but i dont need 1 slot
i need X slots
depending on how big the list is
you mean a while
and adding while firstEmpty != -1?
yea thats it
use a for loop
and use that statement at the start of your for loop
if the returned value is -1 return out of the loop
yea but i kinda want to add them only of the player has enough space for all of them
you can always remove every ItemStack you add to the player's inventory from your list
If the list isnt empty at the end of it, you can drop those items at the players feet
why not just drop them all then? isn't that what /give does anyway
/give adds directly to the inventory
and stops if theyres anything left (Ie if you add 50000 of an item, it will only fill the inventory)
addItem returns a HashMap of all items that did not fit
But under the hood it's basically dropping them on you with 0 pickup time I'm pretty sure, since when you cancel pickup item event /give breaks and gives you 2 items instead of 1
that could work
interesting i thought they changed the code to that years ago
1.8/1.12 are my main versions so you might be right
ahh that might make sense
plus
essentials/cmi overrides that command (should at least)
yeah cuz it breaks easy
kind of like this plugin that im writing will when i finally test it
i kind of underestimated how much code this would require ngl
are you talking about your custom enchants
oh yeah random enchants and nbt I mean
in a sense yes
360 lines and all it does is generate a random name with values from config lmfao
well configs are a pain
enchantments one is gonna be aids
Configs inconsistent since im redoing it from top to bottom
name, material and lore look good though from a user point of view good stuff
yeah was trying to make it usable for any 12 year olds who got a hold of the plugin
too lazy to do docs, so the docs will be yaml comments for now lmao
You should add name alias tho like sharpness instead of damage all
yeah im gonna redo the entire enchantments
and make an option for all levels to have a chance as well
so eg 50% for sharp 1
which will break one class i use for loading ItemChances, might be able to make a work around though
damnit i just realized something, imm need to make a random based quality
why do i not get the option to import the bukkit thing even though i already added spigot 1.18.2 as an external archive
as a library?
are you importing spigot as a jar...
sometimes you can do everything right and intelliJ will just do you dirty like that too
That ain't intellij lmfao
you mean like this ?
that's eclipse
rip
no like are you using a file that maven depends on, or using the maven import for spigot
Or are you trying to use buildtools?
looks like your trying to use buildtools/nms
idk what you're talking about lol cause i just started learning

he's using external jars
i've done that too so long ago lmao
do you have a pom.xml or build.gradle file
i once imported the server jar thinking i could use it for nms π
that was when i first started learning
i dont think so
and i do that because i follow youtube tutorials
can you not?
Have you learned basic java yet
yes
Imma do that right now
server jar has to come with nms
i hope
since it's the server itself
Here ill just link you with my base pom.xml, you might want to learn how to use maven/gradle as well as it makes doing all this a lot easier
?paste
kk
https://paste.md-5.net/mutuqawaye.xml
You'll need to change these fields here, and possibly your java version if it doesnt compile (leave packaging as jar)
Idk how eclipse handling importing pom.xml's
youll have to google that
you can build with mvn clean package or just mvn package
the clean keywords just clears your /target folder when compiling, its not necesarily needed
you may also need to install maven, if eclipse doesnt do that already
ok thnx
https://www.spigotmc.org/wiki/spigot-maven/
This is also worth a read too
When I do /smp i am not redirected to other sever
Good to know
Is it possible to create custom recipes exclusive to certain players, or can it only be server wide?
Does anyone know of a plugin that allows you to split enchantment books that have multiple enchantments on them into multiple separate enchantment books with single enchantments?
you could implement your own recipe system with PrepareCraftEvent
just set the output item to null if they shouldnt be able to craft it
@vocal cloudOk but it's the developpement of my server π€¨
Are you writing a plugin?
yes ask in #help-server
anyone here with experience on creating npcβs with nms?
i really need some help
please ping me if you can help me
what the best minecraft server enginre
I guess paper?
good performance
there's some modified variations which are better
thx
Mine
bs

Made it using Scratch
develop using spigot
dont troll in help channels
It's facts.
just stop
I stopped already lmao, shut up.
if you think you are funny, you arent so stop trolling π
Dude, I stopped trolling. You're stretching this out since you're denser than a neutron star.
Can someone help me creating cooldown feature? I'm trying to understand the basic concept.
This is my code right now and I don't know if it's correct https://paste.md-5.net/ozuqotaxiz.java
so this is just a cooldown for one item accross the whole server?
Player can claim multiple rewards
ohh i read creating a crafting
mb
okay, in that case you should have each Reward class have a List of UUID's (aka players) that are on cooldown for that specific reward
Is that really necessary? I already have that check on User object.
actually no HashMap<UUID, Long> in the Reward class
If you want you could make Rewards have a UUID
but that way will get rather messy
I use rewards name
Ive made a plugin that syncs player economy across servers but im not sure which way to go in to. Currently when player joins a server we add player into database and/or check their old balance to then wipe that balance and query the balance from the database. im not sure if this methode is actually decent to run on a production server.
So each player or User object will have a Map<String, Long>
if your using that approach then, its find the way you have it
i normally dont like using normal strings as keys/values for something like that though, just a personal preferance
Let's talk about how can we measure or decide If player is on cooldown
So everytime player claim a reward, you put the Long with System#currentTimeMillis right?
That could hang the main thread if that method isnt async
Yes, that would return the Date in UNIX format
then subtract the current time from the cooldown time
if time <= 0 remove from map and return true
public boolean isRewardOnCooldown(Reward reward){
if (!this.cooldownMap.containsKey(reward.name())) {
return false;
}
long timeLeftInMillis = System.currentTimeMillis() - this.cooldownMap.get(reward.name());
long timeLeftInSeconds = TimeUnit.MILLISECONDS.toSeconds(timeLeftInMillis);
return timeLeftInSeconds < reward.cooldown();
}
ah yuck totally forgot about that one thanks for that!
If that method is only used on player login though
you could use AsyncPlayerJoinEvent
and thats fine if its blocking on there
It will also block until it completes and not let the player join said server until join
adding/removing balances is a little more complex
you can just directly check timeLeftInMillis
Okay, I put the cooldown configurable in config and the time is in seconds
And the value stored in the map is seconds or millis
So If the current time minus the player claim time and the result is below or equals to 0, that means the cooldown is completed?
Millis
yep, considering the math is correct
you should convert both times to seconds, but that wont really matter to much
tbf that toSeconds method isnt really needed either
cause if its 0, its over
more or less just a redundant call
oh wait
i see
reward.cooldown() is in seconds
mb
disreguard my last second
yeah it's in seconds
also check <= not < or else it will be off by one second
So, If timeLeft <= cooldown, that means the cooldown is completed?
cooldown is completed when timeLeft is 0
that method you linked would return true to my knowledge
Actually it wouldnt really work well tbh
If the player had 13 seconds left in cooldown, but the cooldown is 15
and your checking 13 <= 15 it would be false, but the player would still have 13 seconds of cooldown
its best to check <= 0
that method would essentially be isCooldownLessThenRewardCooldown rather than isInCooldown
How can I decide how long the cooldown is?
hold on, need to think about that one
i think it would be best to store a Long:
when player claims reward
finishedTime = current time + cooldowntime
then check later
finishedTime <= newCurrentTimeHere
I found this tutorial here https://www.spigotmc.org/wiki/feature-command-cooldowns/
basically store the time on when the cooldown would be completed
Bukkit only got the AsyncPlayerPreLoginEvent (would be more pain to use since i need to change pretty much every methodes ive got :p) ill probs run that code on an async task which should be fine i guess
your original mathod basically follows the same method
Im not the best with math, cant test that method either right now but if its a guide i would assume it works
Personally i prefer to save the time on when the player will be out of the cooldown then check against the current time by subtracting them, but essentially they both are the same thing
Just remember, dont directly remove balances from the players balance variable until after your calls done to the database or else you could have some rather undesirable effects
sounds good, i know i likely was more confusing than help :p sorry about that
i try to do things using as less math as possible and sometimes it comes out as more confusing
you mean like to make minecraft recalculate light forcefully
or set the light on blocks manually
because if 2nd use i think it was LightAPI
couldnt you just force a block update without NMS to the client
declaration: package: org.bukkit.entity, interface: Player
not sure if it would work entirely
just use block data from the block your trying to update
theres probably a function in like chunk somewhere
https://github.com/bergerhealer/Light-Cleaner
Take a look into this projects source code
i found something in net.minecraft.world.level.Level
theres a method getLightEngine()
i think you might be able to do something with that
you can get the Level as a ServerLevel from the CraftWorld.world field
(remapped with mojang mappings)
does starlight have an api
CraftWorld world = null; // ...
ServerLevel level = world.getHandle();
level.getLightEngine().runUpdates(
0, /* I (idk what this does) */
true, /* calculate skylight */
false /* propagate light or something */
);
CraftWorld#getHandle returns a WorldServer for me btw
should be the same thing
i think its just mappings
im using mojang mappings with paperweight userdev 1.18.2
let me build it with bt
returns ServerLevel for me
yeah its gonna be the mappings
what is that background 
you havent seen?
naw
sec i gotta find a file thats not cluttered with code
looks weird lol
a lot of people say that, doesnt bother me though probably because im used to it by now
how do i get remapped into my m2?
Should add it by default when add --remapped into your bt command
Also using the plugin for remapped helps

Anybody know how to fix mongodb class or found exception, I looked everywhere, added the Apache shade thing and all sorts of shit
did you shade it
send error
My dependency jar even shows up it just never gets executed
and that ^
wait... jar
π³
mmm
π
god dayum
jumping ahead π©
its just an initial commit tbf
that code is dogshit
pls dont judge i know its dogshit
but the configs needs to be so customizable
i was forced to use lomobk by @hybrid spoke but i was so very tempted to run it through delombok
i only use it cause i wanna rush this project
and i dont wanna type 300 lines of getters/setters
Lombok
havent even tested any of this either
Just use Kotlin troll
im gonna write the whole thing out, then run it and see what happens
where pom
bruh how tf was it gonna shade
it never worked cause plugin systax wasnt there
syntax*
wasn't*
or the syntax wasn't working
idk how to put it into pom
no shade plugin sadge
scope compile
<scope>compile</scope>
by default maven does provided
just source?
well and target
didnt work
define didnt work
hey im making a minigame, is it possible to completely prevent new water sources forming?
can you dm me your plugin jar
sure
...
Oh no
E
how are you compiling it
are you using intellij?
there is no META-INF
nor is the shade plugin configured
it doesn't
anyone know?
you need the maven shade plugin in order to shade your dependencies
@flat olive what happens when you run mvn in the command prompt
'mvn' is not recognized as an internal or external command,
operable program or batch file.
hm
why not use the maven commandline in intellij
you can runwith or without clean
clean just clears the target folder
Have a look at BlockFromToEvent
package to compile
yes.
right side of page in intellij
I never installed or setup maven on my pc
so I cant setup env vaariables
wow smh
intellij just, worked for me lol
it worked
yea
well done
ofc i cant use gradle/maven outside of intellij
but ill never rly need to do that
but the mvn clean worked
it doesnt do anything
mvn package
target directory*
package actually compiles to your target
pro command line gamers be like mvn clean package
fr
using it without clean gives me heebejeebies
gui chumps be like
mvn clean
mvn package
i hope no one does that
i mean its not required
it feels better on my mind to clean package
than just overwrite the files with package
I just did
How would that detect if there was a source forming though? it doesnt seem to have that method
same with ctrl + s
I cant just do it once, i gotta spam it 20 times
i do it twice
i gtg to school but im gonna try and fix this when I get home
i still have no idea how
imagine school
i just spam it, i lost so many things before im paranoid
IT WORKED
i once lost everything i had previousoly done on my server for more than a year by deleting my ssh access key when clearing my disk space
bruh
no way you spent 7 hours on that
bruh
Hi
How can I make enchanted glass please ?
ItemMeta meta = glass.getItemMeta();
meta.setDisplayName("Β§e");
glass.setItemMeta(meta);
inv.setItem(0, glass);
inv.setItem(1, glass);
inv.setItem(7, glass);
inv.setItem(8, glass);
inv.setItem(9, glass);
inv.setItem(17, glass);
inv.setItem(36, glass);
inv.setItem(44, glass);
inv.setItem(45, glass);
inv.setItem(46, glass);
inv.setItem(52, glass);
inv.setItem(53, glass);```
enchant with luck and hide attribute
ever heard of a loop
theyre doing certain slots
use ChatColor#translateAlternateColorCodes(char, string)
but i guess an integer list
Its better to add all the items you want first
List.of(0,1,7....)
yea
then iterate over all slots, and only add the item where material == air
Yes but can u help me ?
not to hard to add a ItemFlag and Enchantment to an ItemMeta
I hope it worked Iβll check when I get home
Make the STAINED_GLASS_PANE enchanted
well i did just tell you
.
I just donβt know if my thread started
I'm not English I didn't understand anything... CAN YOU change my code and send it back to me?
Please
thats called spoon-feeding
If someone wants to they will, but you are better learning this stuff that way you arent asking again at a later date for the same thing
if you learn a programming language you can code in literally any other language thatβs what I figured out like three months ago π€£
how do i modify the server list on 1.8.8?
so easy I hopped to Java from python and am coding so easily in it like itβs nothing
Serverlistmotd
just different syntax
the only thing I donβt understand is maven
I need to learn more about maven
package manager
hopefully you learned oop style code
maintaining thats gonna be a bitch without it
Lots of object oriented programming
Itβs very easy
Whatβs mainly new to me though is
Casting an object
Player p = (Player) commandsender;
Thatβs the only new thing to me in oop
i want to make it myself
ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 11);
ItemMeta meta = glass.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&e"));
meta.addEnchant(Enchantment.LUCK, 1, false);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
glass.setItemMeta(meta);
for (int i : List.of(0, 1, 2)) {
inv.setItem(i, glass);
}
never used list.of
so idk if thats right
it is
you can do that i guess
why would i come into help-development to just get linked to a plugin
@sacred mountainThx !! Why never use lsit.of ?
But it makes sense, using child and main property to get access to the parent attributes by making a new instance
i just havent used it for what i need thats all
you would need to use Packets more than likely im not entirely sure how to do it
you could look into the source code of one of those plugins
yes i tried using the OUT_SERVER_INFO packet but it doesnt work on 1.8.8
and i dont really understand other plugins
is it better to do polling or use a rest api
not sure, havent touched 1.8 api in years
it depends
i have been thiinking about this, and i don't know how to do it : how do i prevent water sources forming, like AT ALL?
im trying to prevent infinite water sources for a minigame
Yesterday I made a change stream that grabs updates and loops over constantly with a thread, I believe this is a way to check for constant updates, especially as it worked for me just fine. I just donβt know if itβs a good way of polling or not. When it comes to using memory I try to use the least amount of it and not use multiple threads. But this stops the thread and starts a new one so only the main and other thread are always running https://github.com/AlexPurcell/MongoLiveUpdates
commonthreadpool or whatever
are you checking the 1.8 protocol
you can always decompile plugins to see what you want
decompile moment
or find them on github if you're lucky
ServerListMotd has it's source code on github if that helps you at all @mighty pier
decompiling makes you learn nothing
you gotta do it yourself sometimes
make the mistakes
yes
gain experience yk
but if you want to learn why a pathfinder no worky
its more or les to get a baseline of what you need to do
better to just decompile it
My biggest step into making a HCF core is figuring out how to edit ender pearls the way I want, I donβt quite understand the concept of how allowing others to pearl through fence gets and blocks works
gates*
so does anyone know
so youβre getting rid of all water in the world
hes just trying to prevent infinite water sources, not water itself
yeah
so i just want to
when the water is flowing, i dont want it to create any new sources
not remove sources that were already there
that is an enum
yeah I have absolutely no idea
well it doesnt have that attribute
I found it
hmm
no i wanna remove it if it IS staionary
i dont want new sources to form
Well remove it if is that then
yeah but what is the event
isnt there a Water state
You just getWorld.getBlock() and grab the material
nope
i think theres a method for detecting is a block is a full water block
STATIONARY_WATER
can you fork spigot easily and just remove that bit of code lol
that just means its not moving right
not that its a full block
the issue is deleting all the water would literally get rid of non flowing all water in the world
BlockPhysicsEvent?
BlockFromToEvent yes
oh that event
no i only want to remove it if it is new,
and check adjacent blocks
Right
this
ill give it a go
he even linked his src code
dayu
@EventHandler
public void onBlockFromToEvent(BlockFromToEvent event)
{
Block block = event.getToBlock();
int sources = getAdjancentSourceBlocks(block);
if (sources >= 2) {
if (block.getRelative(BlockFace.DOWN).getType() == Material.CAULDRON) {
addSourceBlockToCheck(block);
}
}
}```
ill have a go at some things
Okay no i cant figure it out
@EventHandler
public void onBlockFromToEvent(BlockFromToEvent event) {
Block block = event.getBlock();
if (getAdjancentSourceBlocks(block) >= 2) {
event.setCancelled(true);
}
}```
so if a place a block and there is more than one source directly around it it will cancel? but infinite water can be created in tons of ways
https://bukkit.org/threads/fix-water.39560/ this thread's last post is exactyl what i want
But once you remove a source block it will just flow and create a new source block?
Load player skulls without delay?
https://github.com/okx-code/Rankup3/ can someone help me compile this plugin?
it's open source paid plugins
pls teach me how to compile source code to a jar file
if you'd like to
yeah thats the problem
i jus want to disable the forming of new sources entirely
thats why im thinking, is it possible to modify the spigot jar to allow this
easily that is
npcs:
jeff:
texture: ewogICJ0aW1lc3R
signature: ExylUXAG7JsBe
location:
==: org.bukkit.Locatio
world: world
x: -17.5
y: 166.0
z: 71.5
pitch: 0.0
yaw: 0.0
steven:
texture....
How can i loop through npcs?
I have absolutly no idea how i would do it. i want to be able to get the texture from jeff and then the next item in the for loop it would get steven's texture. can someone please help me?
just loop through the keys in 'npcs' and get the texture from each one
getKeys() and loop through that
getkeys!!! thank you! thats what i was looking for
how can i have an attack speed as vanilla swords and stuff
if i add the attribute it is instant no matter what
its a very small atrribute
maybe increment by like 0.01
i tried doing modification like speed and stuff and the differce was a lot
i guess...
Hey do you know if the middle click fonction in Inventory has been removed for player in survival ?
..????
Database issue
Middle clicking in an inventory in survival mode does nothing last I recall, though you can still middle click a block in the world and it will move the item into your hand, yes
Is there any way to see if an items name has been changed by an anvil
For Creative mode
events on creative mode are hella weird
as creative mode is its own little party
copying items copies the client version instead of the server version
I just thought about what if you use a constructer?
Plugin pl;
public ListenerClass (Plugin plugin){
pl = plugin;
}```
and in start up getServer().getPluginManager().registerEvents(new ListenerClass(this),this);
Yes constructor DI is preferred
how can i take a multiple word argument
How do I set text lines below and above the player name?
I saw this on other servers
hi can i have a question would be that the KingdomsX plugin will print this when I insert it Could not pass event ChunkLoadEvent to KingdomsX
and therefore i can't use the plugin because if i type it in / k it will throw out the server can anyone help?
pls help
Ask the plugin developer not us
Also don't ask in every damn channel jesus christ bro learn patience
why
It's a plugin issue not a spigot issue
ok chill
Am I supposed to have the source and knowledge of every plugin?
If you can't contact the dev find a replacement or have someone try to Recreate it for money
hacker pfp
Why...
Hey guys! I'm looking to build a plugin utilising Towny, Vault and Economy APIs, does anyone have experience with any of these plugins previously?
why i can't send png
you gotta verify
You need to verify
just look at their wiki..?
no sign opens and no errors..
1.18.1
This is not linked to Spigot but I don't know where else to ask. I'm making a Java wrapper for a Minecraft server hosting API. Are there any design principles/tips I should follow while designing the wrapper?
Hi! How can i center a location i got from a block? Because if i use Block.getLocation(); i get a corner location. I actually want the center of the block.
I am, trying to decipher this
Iβm a webdev, very new to Java documentation
ye just ask away
Looks like Java provides some sort of method documentation out of box for plugins
I mean even tho we dont maintain 3rd party apis many of us are still knowledgeable in them
well u have javadocs
Oooh, thatβs very handy
mye
basically turns comments on methods and fields into a set of html pages
Idk, itβs so much of a refreshing way to code
it is, altho a bit obsolete in comparison to more modern languages
yeah haha, itβs really cool
ye
True
Another question, how can i orientate a block?
wym by orientate a block
like what you would do with a debug stick
oh
BlockData in principle
what repository do i need to include to use paperweight userdev
i currently have this:
plugins {
id 'java'
id "com.github.johnrengelman.shadow" version "7.1.2"
id "io.papermc.paperweight.userdev" version "1.3.5"
}
``` with no buildscript repositories
this produces

ye probably Directional then
orby
Yes Directional is right 
oh
thank you
basically
//settings.gradle
pluginManagement {
this.repositories {
this.mavenCentral()
this.gradlePluginPortal()
this.maven("https://papermc.io/repo/repository/maven-public/")
}
}
i think
It seems that some sql databases don't recognise the '-' (dash) as a character. In my case when storing an uuid as a varchar/string. What is the best solution to resolve this? Replace the character with something else, store an uuid as bytes or edit database settings (which is not preferred)?
how do i load an entity from an nbt tag with nms
i am using
nmsEntity.saveWithoutId(tag);
``` for serialization, but i cant find any methods in the `net.minecraft.world.level.Level, ServerLevel` or `MinecraftServer` classes that allow me to load back that entity from the nbt (without id, so its technically a different entity)
I promise there is not a sql database that can't handle the dash character
It's just that sometimes UUIDs are formatted without the dash
i also dont expect the bukkit classes to be of any use, ive checked CraftServer regardless but as i expected still nothing
Are you able to have NBT data for custom recipes input?
not through the bukkit api
you have to make your own system or use a third party one
i think
Anyway I can get function and field names when working with nms?
you need to use remapping
with maven use buildtools and specialsource
with gradle i use paperweight userdev
k ty
so how do I do this?
that's my current pom
kk
do you have a link?
how do you make a book GUI
Can anyone help
Im trying to make a sign gui with packets
anyone know how to set the effect of blindness on the nlogin plugin when logging in and registering?
anyone know what's going on here?
My java version in the java control panel is different from what's being displayed on control panel
I'm guessing I have different JREs which aren't oracle official like openJDK?
But I never had issues with the way I used to do it
how can I select between different versions?
just because it's wrong doesn't mean it won't work sometimes
but it's a string
wrap it in quotes
and please, if you are executing queries in your code, please use prepared statements and not string appending
Is there a way to make it so you don't lose speed when drawing back a bow?
Thank you
I'm pretty sure that's clientside
Trident trident = world.spawnEntity(location, EntityType.TRIDENT,);
trident.setVelocity(velocity);
Ah thanks
You can also do Entity#launchProjectile
that is what i used
anyone?
sorry no i am also lost lol
Trident
Provided:
Entity```
Lol :/
You have to cast to trident
spawnEntity returns an Entity
Trident trident = (Trident) world.spawnEntity(location, EntityType.TRIDENT);```
this ^
you really didn't have to ping me for that
how would i force aplayer to break a block?
what do you mean force a player to break a block
you want plugins to respond to the block breaking as if a player broke it?
yes
you can fire a BlockBreakEvent yourself
well also the server itself
what do you mean the server itself
i need it so like the drops and all that are as if the player broke that block
woith their tool
like damaging the pplayers tool
ok well read this method's javadocs because it does literally exactly that
yeee
maybe i was thinking of the wrong thing
i knew that method existed but like i thought it just broke the block
always good to read javadocs
Detecting when a player is no longer viewing an inventory?
not sure if this is solved, but its most likely that your PATH in your env variables is pointing to the wrong jdk/jre
where do I change this?
For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.
I love that there is a Page for Everything that a User Does
use path to create a second variable that points to the other jdk, so for example I have java pointing to java 8 and java16 pointing to java 18, if you open your env variables and copy/paste whats currently in java it should work
hopefully
environment and internal java stuff deserves spoonfeeding, its not the easiest thing to google sometimes
π€
am I in the right place?
I don't see a java
R.I.P.
How can i kill / remove entities by name? I look at
entity.setCustomName("name");
and outside my if statement i want to access it
is there no way you can just keep a reference to the entity instead of searching for it by name?
Well the thing is the entity is declared inside an if statement
so?
wait that means i could use a set method ig
Entity entity;
if () {
entity = new Entity();
}
Or a list?
or something like that?
ye like that but when you try use entity out side the if it says it hasn't been declared and when you try to declare it it makes it null
Can I see your specific example because there will definitely be a way around it
whats the reason that the console does not display msg content packed in [] ?
ingame it does
but console not
parsed with sendMessage()
@EventHandler
public void click(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
if (event.getPlayer().getName().equals("RaiderRoss")) {
Trident trident = (Trident) event.getPlayer().getWorld().spawnEntity(
event.getPlayer().getEyeLocation(), EntityType.TRIDENT);
trident.setVelocity(
event.getPlayer().getEyeLocation().getDirection().multiply(2));
trident.setGlowing(true);
trident.setCustomName("trident");
trident.setDamage(10.5);
}
}
if(another action){
-> kill tridents
}
}
strange, this is what mine looks like, java being there 1 from the bottom https://gyazo.com/67cfcf2fea2d1229938f00d5bb1d89e7
wdym, can yous how an example of whats in []
ok I see
slightly trickier example
is there only ever one trident per player?
or can a player have multiple tridents?
cause if it's just one trident per player or something like that then you can use a hashmap
linking a player to a trident
or even a player to a list of tridents
then pass in the player to the hashmap on the other action to get the tridents
well no
only player can do it
@fading lake this is the string thats getting sent to the sender java parser.appendLine("uuid_getUUID", new String[] {ChatColor.GREEN + "[Click here to copy] {uuid}"}); and this is the code used ```java
public static boolean execute(CommandSender sender, String[] args)
{
if (sender instanceof Player)
{
Player p = (Player) sender;
if (!p.isOp())
{
p.sendMessage(Utils.getStandardMsgByString("CMD_PERMISSION"));
return true;
}
}
if (args.length == 1)
{
UUID uuid = NonReflectables.getPlayerUUID(args[0]);
if (uuid != null)
{
String msg = ((Callbacks.defaultMsgs.containsKey("uuid_getUUID")) ? Callbacks.defaultMsgs.get("uuid_getUUID").replace("{uuid}", uuid.toString()) : Utils.getStandardMsgByString("CMD_ERROR"));
if (sender instanceof Player)
{
TextComponent uuidMsg = new TextComponent(msg);
uuidMsg.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, uuid.toString()));
((Player)sender).spigot().sendMessage(uuidMsg);
}
else
{
sender.sendMessage(msg);
}
}
else
{
sender.sendMessage(Utils.getStandardMsgByString("NO_PLAYER"));
}
return true;
}
return false;
}
well that's not what I was asking
multiple
what are you trying to do here specifically?
if a user right clicks with a specific item it shoots out tridents
and for lag reasons i would like to be able to kill those tridents
@fading lake the console output is just the uuid the output ingame is [Click here to copy] + the uuid
what if i use a runnable?
oh i can do that
when?
when they fire another trident?
after a set period of time?
when they left click the item?
welp guess I'm just fucked
yes
and sorry u had to guess all of those events :(
i had to help my dad with sum
it's alright
and you want all the tridents to be destroyed?
or just the last trident they fired?
okay the you want a hash map
but i realised i can use a runable
that's strange, can you print it to be 100% that its actually being called
how will a runnable help?
to kill them after a certain amount of time
add the correct jdk there and it should? work
sure, btw the parser is a self written ini parser and the rest are also my methods to process data
wait so do you want it to be based on time or left clicking?
time would be easier
because
trident.setDamage(10.5);
new BukkitRunnable(){
@Override
public void run() {
trident.kill
}
}.runTaskLater(this,10);
}
yeah but left clicking is really ez too
sometimes im thinking that people dont know that && and || exist
and discord doesn't like the formatting :/
so just pick which you'd prefer
in the name
Bukkit.getScheduler().runTaskLater?
why is manually creating bukkitrunnables even possible :/
ππ
Idk ask spigot developers
I love that syntaxx
you can do stuff like this
that code there creates a pig launcher
fires a pig in a straight line which implodes upon impact π
yea thats useful on its own but the bukkitrunnable object requires you to immediatly calling a method on the newly constructed object
that's still fine I think
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(plugin, () -> {
Bukkit.broadcastMessage("Mooooo!");
}, 20L * 30L /*<-- the delay */);```
right i see ur point now-
u can use it to run any task
:)
hm ye personal preference ig
yeah
I find that using inner classes tends to allow for more flexibility
otherwise you end up having to pass in a bunch of lambdas for everything as parameters
in the case of the scheduler tho it doesn't matter too much
smh assigning the scheduler to a variable
It doesnβt require that
Its an anonymous class
if you do new BukkitRunnable() {void run()} it wont do anything i mean
Right but thatβs intended?
Like java canβt do something if you donβt tell it to
Well i guess you could make your own runnable class and add run() to the constructor
How do i rotate the body and head pitch for an NMS npc?
which packet do i need to use?
i dunno if i'm doing something wrong, but getHitblock on ExpBottleEvent seems to always return null
wdym?
if I do that I get the imports
but still no nms mappings
refresh maven?
I did
so they come up in intellisense but donβt actually work
tabnine kek
if I use spigot-api then I don't get imports
if I use just spigot then I get imports with no mappings
gosh i used to use tabnine, it made the intellisense windwo soo much slower
any ideas?
am i getting it right that PlayerInventory is not serializable?
how to serialize it then
like
the most simple solution
put everything in wrappers?
store all data in primitives?
ItemStack is Serializable
i tried
it fails
Utils.serializeToFile(new ItemStack(Material.DIRT, 1), invDir.getPath() + '/' + p.getUniqueId().toString() + ".bin");
ItemStack invFile = (ItemStack) Utils.deserializeFromFile(invDir.getPath() + '/' + p.getUniqueId().toString() + ".bin");
``` ```txt
19.04 18:03:52 [Server] INFO Caused by: java.lang.ClassCastException: class java.io.WriteAbortedException cannot be cast to class org.bukkit.inventory.ItemStack (java.io.WriteAbortedException is in module java.base of loader 'bootstrap'; org.bukkit.inventory.ItemStack is in unnamed module of loader java.net.URLClassLoader @dcf3e99)
the serializer works just fine using a string
why tho because ive checked ItemStack is serializable
anyone?
why both spigot and spigot-api
look at the tutorial I sent
I have them there cause that's what it tells me to do
I have no idea how these mappings work
any other tutorials on how I can get nms mappings?
It's kinda impossible to use it without
for the stuff I'm looking at anyway
whatβs your serializeToFile function
@crisp steeple ```java
public static Object serializeToFile(Object obj, String str)
{
try
{
ObjectOutputStream s = new ObjectOutputStream(new FileOutputStream(str));
s.writeObject(obj);
s.flush();
s.close();
return 0;
}
catch (Exception e)
{
return e;
}
}
public static Object deserializeFromFile(String str)
{
try
{
ObjectInputStream s = new ObjectInputStream(new FileInputStream(str));
Object ret = s.readObject();
s.close();
return ret;
}
catch (Exception e)
{
return e;
}
}
try with resources brr
should probably print the stack trace instead of returning it
perhaps use getContents and setContents as thats just Array<ItemStack>
Array<ItemStack> is a weird way of describing ItemStack[]
kotlin moment
^
Conclure
ye
hi there
π³
you got any idea about nms mappings?
mye
