#help-development
1 messages ยท Page 118 of 1
tbh
nah for real
we were impressed from your skills
but something is fucky fucky with your server
first
why it takes
more then 2 min
connect to a local host
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
nice
who?
man we use static
everywhere instead
works kiss kiss
i go to smoke brb
this guy has issues
inclined to agree
Can I somehow send World files from one spigot server to another?
Just skip completely on OOP and Classes/Objects and declare everything static
that's not what they meant
@quaint mantle tell this idiot learn what is static
he think he can teach us java
he dont know static
Or maybe explain it to him instead of flaming
i statically ignore static whenever I can
Either connect them to the same database and store them there
or
Add a small rest-api to your servers that can be used for transfer
or
Create a web application outside of your minecraft server that stores received files inside the mc-servers directory
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
go here @iron glade mister dont know static
who said I don't know static
static is pretty easy
static too much is bad
static too little is bad
static sort of is sort of bad
anyway static > di
Eh
๐
it was the joke
At some point DI has less bugs than static
the type of guy doing static abuse
ooh thanks a lot
nah, who use static be like "I'll just take some money from the public bank"
if I create one world on Server 1 and use Rest Api to get it to Server 2
will Server 2 able to load it?
usage of static is fine if done correct. dont be scared to use it
if done correct is the hard part
Enough people fail at it to make it seem hard
They never read what it's used for
make it a local variable
Seems more like a user problem than anything
Any misused programming pattern is a user problem XD
Of course
It's not hard to understand when to use the static keyword
They just never bother to read about it
is there any way to get the damage modifier from an EntityDamageEvent before the final damage is calculated?
?jd-s
Honestly, I think that more users get scared of using static when told not to do it. Since most people here never tell why or when to use it
Sure, why not? Might consider zipping and unzipping it
That's fine. They can be scared of it until they decide to learn more about it
^
I'd argue that same principle applies for functional programming
Yeah, but they shouldn't be scared in the first case
Don't use a lambda if you have no idea what it means
but wont that loading lag server 2 a bit?
Most people could handle it better
I mean, you certainly should be scared of static when you first start off because you will slap it onto every Problem
Specifically state
Where it really has no place
for a OOP lang, its weird that most tutorials get you to use static
You'll have to download the world first then load it
Yeah also that
Not using it until you had the time to properly learn it is going to be better than slapping it onto everything and then running into 50 walls
People blindly follow tutorials on making plugins when the maker abuses static
You will never be able to properly learn it before using it
biggest problem i realised when learning java; is I was just writing code and not knowing why something did what it did
one day everything jsut clicked
You did some pasta sauce
Obviously not but when you just get started with java and coding in general
The somewhat ugly issues static can cause are not really benefitial
For the upsides that static would bring you
Sure, you should wait a bit before using it. But that applies to most stuff
You don't just start making a game when you start developing
people start making massive plugins without knowing a drop of java
people dont want to take the baby steps
It's because people are getting more and more lazy everyday that goes
cannot wait for the GitHub copilot days
Where peeps come in here with fully generated code and have no idea what it does
lmfao
yea thats going to be good fun
Super fun
we can always just tell em to ask copilot why its not working
Guys, why is my plugin becoming sentient?
did you reload the server?
why did this started to occur?
Okay so for an EntityDamageEvent, if i do getFinalDamage, can I then after setDamage and finaldamage will update after my listener finishes?
show your code
this is the tick method
ik i should use getter for games
is the class inside the jarfile
static ๐ฆ
yep
it worked whole time, until I booted up the server today
without changing any code?
yep
hard to believe
I mean the list of games should be static
However it shouldn't be exposed
well just one piece
but its heavily irrelevant
๐ plz
?tias
can you show NWGame class
?tryitandsee
Try it
?paste yep
Alright :/
Hey guys, does my entire skyblock core work?
I'll paste all the classes gimme a min
๐
are you initializaing the class beforehand
static abuse
No
where are your damn getters
I was going along with the joke
my god
well the first time I use the class in whole cycle is when generating World using WorldCreator and in Tick method
I do know how to use static and when
ik
basically everywhere
I can't spot the difference between those 3
what the heck is dis xD
spawnpointLL.setX((spawnpointLL.getBlockX()>=minX&&spawnpointLL.getBlockX()<=maxX)?spawnpointLL.getBlockX():((spawnpointLL.getX()-maxX<spawnpointLL.getX()-minX)?maxX:minX));
spawnpointLL.setZ((spawnpointLL.getBlockZ()>=minZ&&spawnpointLL.getBlockZ()<=maxZ)?spawnpointLL.getBlockZ():((spawnpointLL.getZ()-maxZ<spawnpointLL.getZ()-minZ)?maxZ:minZ));
spawnpointLR.setX((spawnpointLR.getBlockX()>=minX&&spawnpointLR.getBlockX()<=maxX)?spawnpointLR.getBlockX():((spawnpointLR.getX()-maxX<spawnpointLR.getX()-minX)?maxX:minX));
spawnpointLR.setZ((spawnpointLR.getBlockZ()>=minZ&&spawnpointLR.getBlockZ()<=maxZ)?spawnpointLR.getBlockZ():((spawnpointLR.getZ()-maxZ<spawnpointLR.getZ()-minZ)?maxZ:minZ));
spawnpointUR.setX((spawnpointUR.getBlockX()>=minX&&spawnpointUR.getBlockX()<=maxX)?spawnpointUR.getBlockX():((spawnpointUR.getX()-maxX<spawnpointUR.getX()-minX)?maxX:minX));
spawnpointUR.setZ((spawnpointUR.getBlockZ()>=minZ&&spawnpointUR.getBlockZ()<=maxZ)?spawnpointUR.getBlockZ():((spawnpointUR.getZ()-maxZ<spawnpointUR.getZ()-minZ)?maxZ:minZ));
spawnpointUL.setX((spawnpointUL.getBlockX()>=minX&&spawnpointUL.getBlockX()<=maxX)?spawnpointUL.getBlockX():((spawnpointUL.getX()-maxX<spawnpointUL.getX()-minX)?maxX:minX));
spawnpointUL.setZ((spawnpointUL.getBlockZ()>=minZ&&spawnpointUL.getBlockZ()<=maxZ)?spawnpointUL.getBlockZ():((spawnpointUL.getZ()-maxZ<spawnpointUL.getZ()-minZ)?maxZ:minZ));
how can you even know whats going on this point
I changed location in every time
some shit I wrote at 2am and somehow without it doesn't feel like working
Hey guys,,,, Can I ask bout github again...?
?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!
No
You're not allowed to ask anything
I dont?
Yes?
lmao
where tho
public static ArrayList<NWGame> games = new ArrayList<>();
pls call this GAMES
its not a gamemode tho
its just the class
Well wtf is that class
its the class I sent here??
manage current game, setup world, check team events
You store the class that contains that arraylist inside that arraylist?
So you store every game inside that class
Lol
That shouldn't be handled there
Make a data class
yet I didn't ask 'bout this
I wasn't worried about my trash code
Just for server not wanting to accept the jar anymore
lmfao
Maybe listen to what I say
anything in the console?
I apreciate your help
but I don't care about those problems rn
Yes you can
just java.lang.NoClassDefFoundError:
show the stacktrace
what's line 50?
How do I export a jar in eclipse using maven and I include a library it is dependent on?
Shade the lib
nope
don't even have a clue on how to do that
Well it couldn't find the class
Can you walk me through it?
ยฏ_(ใ)_/ยฏ
have you opened the jar with something like winrar
to make sure its in there
private static List<NGame> GAMES= new Arraylist<>();
public List<NWGame> getGame() {
return this.GAMES;
}
Try this
I just need to easily access it from anywhere without creating new Object every time
I could store it in some Manager tho
but can't do anything rn
not near pc
It should not be exposed
due to exploits? or potentional bugs
Hi, please tell me how can I forbid the skeleton NoAI(true) to turn its head?
How can I let the player take only half the damage he took?
?jd-s
EntityDamageEvent
and just get Damage amnt /2 and set it to damage dealt
intercept a damage event and reduce incoming damage by 2 times
setAware(false)
wipes AI but not gravity
you don't quite understand me.
I inherited a class EntitySkeleton and
disabled calling tick, passengerTick, movementTick
And the monster stops moving, exactly as I wanted.
However, this skeleton is sitting in the boat, and if I leave the boat during the turn,
the skeleton's head will turn ,,by inertia,,s
oh you're doing that stuff
you might need to lock the yaw or change it back every tick
maybe just stop yaw packets from sending
it would be perfect, but I haven't found where it is called yet, I've been looking for 2 hours
IIRC
setting lastYaw = yaw
should fix it?
As the datawatcher won't detect it as "dirty"
basically each datawatcher is checked for modifications
if it's modified, it sends the new packet
oddly specific
Hmm.. This gave me 1 thought. Thanks
is there any better way to do this ?
Use pdc
tks i should have known this sooner
Hello there! I wondered how I could create fake player in tab through ProtocolLib, and maybe even assign them a skin that you see in the mini-square
Can you help me guys?
it's a private one sorry, but you can get a limited feature one that's kinda outdated but still works. I got the idea from it, just the code may not be similar
it's called something like fakeplayers
How can I send to the client a huge block change? Something like updating 300000 blocks. I have seen the PacketPlayOutMultiBlockChange but I dont know what is each parameter
SectionPos, a ShortSet of Positions, a LevelChunkSection, and a boolean for if it should suppress light updates.
You should probably use Mojang maps if you're gonna be messing with packets btw
i got a method that parses a string math expression into a double value, only issue is that java doubles occasionally format themselves in the scientific notations so it starts producing errors saying it doesn't understand "E"
for such cases i'd need to use bigdecimal right so doubles aren't formatted like that
is there a way to use InventoryClickEvent#setCursors functionality in a non deprecated way?
You cant upload pictures... ๐
if(args.length >= 1){
if(args[0].equalsIgnoreCase("start")){
if(sender.hasPermission("kts.start")){
if(kts.started){
sender.sendMessage(ChatColor.RED + "The game has already started.");
}else{
if(Bukkit.getOnlinePlayers().size() >= 2){
Random random = new Random();
kts.sheep = Bukkit.getPlayer(Bukkit.getOnlinePlayers().toArray()[random.nextInt(Bukkit.getOnlinePlayers().size() - 1)].toString());
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "-~-~-~-~-~-~-~-~-~-~-" + ChatColor.AQUA + "Lusion's Kill The Sheep" + ChatColor.DARK_GRAY + "-~-~-~-~-~-~-~-~-~-~-");
Bukkit.broadcastMessage(ChatColor.GREEN + "Kill The Sheep has started! Go to /warp events to play!");
Bukkit.broadcastMessage(ChatColor.WHITE + "The sheep must be hit 2,000 times!");
Bukkit.broadcastMessage(ChatColor.WHITE + "You win by getting the most hits!");
Bukkit.broadcastMessage(ChatColor.GOLD + "The sheep is " + kts.sheep.getDisplayName() + ".");
kts.started = true;```
How can I format that
so its readable?
do this ```java instead of just ```
early returns
How do I iterate through event.getInventory().getContents() to find if a slot has red wool, and then replace it with a diamond_block?
remove nested ifs
if(args.length >= 1){
if(args[0].equalsIgnoreCase("start")){
if(sender.hasPermission("kts.start")){
if(kts.started){
sender.sendMessage(ChatColor.RED + "The game has already started.");
}else{
if(Bukkit.getOnlinePlayers().size() >= 2){
Random random = new Random();
kts.sheep = Bukkit.getPlayer(Bukkit.getOnlinePlayers().toArray()[random.nextInt(Bukkit.getOnlinePlayers().size() - 1)].toString());
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "-~-~-~-~-~-~-~-~-~-~-" + ChatColor.AQUA + "Lusion's Kill The Sheep" + ChatColor.DARK_GRAY + "-~-~-~-~-~-~-~-~-~-~-");
Bukkit.broadcastMessage(ChatColor.GREEN + "Kill The Sheep has started! Go to /warp events to play!");
Bukkit.broadcastMessage(ChatColor.WHITE + "The sheep must be hit 2,000 times!");
Bukkit.broadcastMessage(ChatColor.WHITE + "You win by getting the most hits!");
Bukkit.broadcastMessage(ChatColor.GOLD + "The sheep is " + kts.sheep.getDisplayName() + ".");
kts.started = true;
tat?
not at all
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length >= 1){
if(args[0].equalsIgnoreCase("start")){
if(sender.hasPermission("kts.start")){
if(kts.started){
sender.sendMessage(ChatColor.RED + "The game has already started.");
}else{
if(Bukkit.getOnlinePlayers().size() >= 2){
Random random = new Random();
kts.sheep = Bukkit.getPlayer(Bukkit.getOnlinePlayers().toArray()[random.nextInt(Bukkit.getOnlinePlayers().size() - 1)].toString());
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "-~-~-~-~-~-~-~-~-~-~-" + ChatColor.AQUA + "Lusion's Kill The Sheep" + ChatColor.DARK_GRAY + "-~-~-~-~-~-~-~-~-~-~-");
Bukkit.broadcastMessage(ChatColor.GREEN + "Kill The Sheep has started! Go to /warp events to play!");
Bukkit.broadcastMessage(ChatColor.WHITE + "The sheep must be hit 2,000 times!");
Bukkit.broadcastMessage(ChatColor.WHITE + "You win by getting the most hits!");
Bukkit.broadcastMessage(ChatColor.GOLD + "The sheep is " + kts.sheep.getDisplayName() + ".");
kts.started = true;
if (args.length < 1) return true;
if(!args[0].equalsIgnoreCase("start")) return true;
if(!sender.hasPermission("kts.start")) return true;
where you see kts. the "kts" is red
is there a reason ur checking args.length >= 1?
and so on
like /kts start blabla would also start this
return false?
cuz why not
who wants that ugly message to be printed
i don't know what the guy wants
np but personally I never return false in onCommand
.
in the permission you mean?
no was just wondering, you can return false if you want but most people don't want that message to be sent
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
if you don't specify usage in plugin.yml, you won't get any message
used it a lot
rly?
it says "can't resolve symbol 'kts' "
Guess I'll just remove usage in plugin.yml from now on lmao
you don't have kts varible in your class/method
ahh
I never added it to my yml
idk why but my worldguard spawn pvp protection wont work at all it says "Hey Sorry but you cant pvp here!" but it does damage to people
idk why I always added it tbh
I first found it out like half year ago
something I've done when I started making plugins and just kept doing
with coding experience from like 1.5.2)
BrewingStands have getBottles to get the contents of the bottle area, but how would you get the item that is put in to brew with?
Object kts;?
If you wrote it you should know what it is
If it's not your code just make own plugin
no. im seeing how much this AI can do in terms of making a minecraft plugin so seeing if it can make a minigame. I can't do much in Java, only plugins i've made are simple little things.
Cause if this AI can do all this shit for me.. im not going to learn Java anymore.
Bro
It's made everything so far
You will have to learn java anyways
lol
programs AI to code java plugins so he doesn't have to
Cuz Base64, ByteStreams, Desktop, and System/Runtime
You will have to write it with your own hands
just make a bot that does that
Cuz it's using string parameters
Bro what is this ai
send a link
I'm gonna write ProtocolLib player lie-fly animation
this is what I did...
package com.lusionmc.killthesheep;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class ktsCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return false;
}
}
I gave it that code - and then said "create the command: /kts start"
then it gave me that. And it seems perfect so far
other than what I can't figure out
why that shit is giving an error
KIll the sheep plugin so a sheep spawns & players gotta hit it 2k times
and player w most hits wins
and gets reward
and this is the start command
There should be a class
@Overrid
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length < 1){
if(args[0].equalsIgnoreCase("start")){
if(sender.hasPermission("kts.start")){
Object kts;
if(kts.started){
sender.sendMessage(ChatColor.RED + "The game has already started.");
}else{
if(Bukkit.getOnlinePlayers().size() >= 2){
Random random = new Random();
kts.sheep = Bukkit.getPlayer(Bukkit.getOnlinePlayers().toArray()[random.nextInt(Bukkit.getOnlinePlayers().size() - 1)].toString());
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "-~-~-~-~-~-~-~-~-~-~-" + ChatColor.AQUA + "Lusion's Kill The Sheep" + ChatColor.DARK_GRAY + "-~-~-~-~-~-~-~-~-~-~-");
Bukkit.broadcastMessage(ChatColor.GREEN + "Kill The Sheep has started! Go to /warp events to play!");
Bukkit.broadcastMessage(ChatColor.WHITE + "The sheep must be hit 2,000 times!");
Bukkit.broadcastMessage(ChatColor.WHITE + "You win by getting the most hits!");
Bukkit.broadcastMessage(ChatColor.GOLD + "The sheep is " + kts.sheep.getDisplayName() + ".");
kts.started = true;
}else{
sender.sendMessage(ChatColor.RED + "There are not enough players online.");
}
}
}else{
sender.sendMessage(ChatColor.RED + "You don't have permission to use that command.");
}
}else{
sender.sendMessage(ChatColor.RED + "Usage: /kts start");
}
}else{
sender.sendMessage(ChatColor.RED + "Usage: /kts start");
}
return true;
}
}```
there is a class
with fields "sheep" and "started"
How to resend the chunk to the player?
how is there a typo on override
ok
And you have to make a variable called kts and initialize it with a new Kts object
i deleted the e bc discord message limit
Well if you didn't know
does this mean the player using the brewing stand?
In your code
you'd have to return after args.length < 1
That means block which holds brewing inventroy
ah okay ty
this looks like a pretty dumb ai
try getView() if exists in class @timid jetty
@ebon ether
and remove all if brackets
I think you can get player viewing inventory with InventoryView returned by getView() method
how you gonna teach an Ai to write java without knowing java
ty chief
#include org.bukkit.plugin.java.JavaPlugin;
public static int minigame extends &JavaPlugin {
}```
anyways related to the past questions, anyone have an efficient way of implementing custom brews before I try figuring it out myself
you guys know how to create normal cpp array with size specified with keyboard
that's
int size;
cin >> size;
int* array = (int*) malloc(size * sizeof(int));
is that a question
because if it is
i'd say doing it like this is a VERY bad idea
it will work though
Should there be an & there? ๐ค
nvm wait that whole thing is wrong
the better idea is to do:
int size;
cin >> size;
std::vector<int> array(size);
ye
but array != vector
ye
but you need to free() array
vector > array
and it basically does all the things that array does
+++
in destructor
only talking about creation here
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:test.db");
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0);
}``` i found this in a sqlite tutorial, do i have to replace the jdbc:sqlite:test.db with something else?
shuts the jvm down
how do get that
thats my own code lol
Make sure to make the onDisable block handle errors in the onEnable block correctly
just create a file and make sure it exists and add the absolute path to the connection string
Especially when working with data - although flatfile data is a more important critical issue than remote DBs given that usually you won't load the full DB into memory and then overwrite the remote DB
i only get a few npes when my onEnable fails and onDisable is called lol
like calling userManager.saveAll() but usermanager doesnt exist
There is a danger that you could overwrite the full thing if you are not careful enough
why is createInventory crossed out?
deprecated
go to javadocs and find why
[Server thread/INFO]: Named entity EntityZombieHusk['[Lv1] Husk 7/20:hearts:'/886, l='ServerLevel[world]', x=-19.61, y=128.00, z=-122.22] died: [Lv1] Husk 7/20:hearts: was slain by TheGiorno how do i stop these notifications from appearing?
How can I send to the client a huge block change? Something like updating 300000 blocks. What would be the best method?
nms
hold up i got a resource
I want to use fake blocks
what
I want to use fake blocks
not really cuz if i dont use my nms plugin it doesnt show up
use them then
How
packets
How
what exactly are you trying to accomplish
Send to the client a huge block change
Just resend the chunks with your alterations
How to change the chunk then
link
That cannot be used to create ghost blocks
Or well it can, but not to a large degree
idk man i hate nms
its been fucking me over for weeks
wait
why cant it be used for a large degree
I have never used NMS at all, but at least I know how bukkit works and thus can infer how the protocol works based on the documentation
it does acknowledge changes right
Yes
What do you not understand in acknowledge?
the client realises that a block change has occured
like place/remove
am i getting this correctly
Acknowledge block change is clientbound
As such it will confirm SERVERBOUND block changes, not the other way around
what the fuck is event.getWhoClicked() why can't it just be event.getPlayer(), can a mob click a gui?
oh
But not like 300k blocks
less confusing
?jd-s
more* it's just annoying
Yeah, no clue
returns humanentity anyways
to be fair if you have decent autocompletion (which should be the case if you are using eclipse), you won't have to try to find out what method you are looking for
I'm using intellij
autocompletion algorithm / ai
nice
Just changing event.getPlayer() to event.getWhoClicked() is annoying
I mean, it doesn't change much but like why have it in the first place xd
i love copilot
@lost matrix @smoky oak I was just eating and I thought of a better solution to ItemStack[] compression algorithm. I'd watched the addItem function do the compression on my testing before, and it clicked on me just now.
O(n), too, though this one is limited by the maximum inventory site of 54, as a pose to the prior algorithm that could work on all sizes
public static List<ItemStack> compress2(List<ItemStack> items) {
Inventory compressor = Bukkit.createInventory(null, 54);
items.stream().filter(item -> item != null && item.getType() != Material.AIR).forEach(compressor::addItem);
return Arrays.asList(compressor.getContents());
}```
and how do i fix it?
undeprecate it
bukkit prodigy
you were born to do this
and how?
that some advance stuff right there pretty neat
idk why its deprecated
uh can you correctly run an #equals() to evaluate two array lists of strings?
does anyone know why createInventory is deprecated?
what version?
paper
1.19.2
what about the overhead from creating an inventory?
how much does that slow it down?
ah
i was a bit worried it might slow it down
because a smaller O(n) isnt necessarily a fasater algorithm if the overhead makes it slower overall
it's just how it scales
Yeah that's alright. Also I forgot to mention that after testing, I had to filter out the null objects from the array to list conversion, so to add to the method...
and how to generate the ShortSet?
public static List<ItemStack> compress2(List<ItemStack> items) {
Inventory compressor = Bukkit.createInventory(null, 54);
items.stream().filter(item -> item != null && item.getType() != Material.AIR).forEach(compressor::addItem);
return Arrays.stream(compressor.getContents()).filter(Objects::nonNull).collect(Collectors.toList());
}```
Not sure if the return is all correct since I'm writing this on my phone
But yeah.
How would determine the correct slot of each item?
thats not really the goal here
is there a way to stop this from existing
dont have double files
usually you should replace it with the file last edited
you could use a script to force copy it
isn't there something in settings to disable that pop up
bro i gave it english and it@made that dont think its rhayd umb
no, but what you can do is a 'verify replace' copy via shell:```sh
copy /b/v/y origin_path target_path
that*
ah that's gonna be useful ty
and it seems correct?
what's the /b/v/y
It's just a compressor, to compress down the items to their stacks. This was just a small follow up from something a week ago
iirc its bytewise verify yes
I don't understand but okay
Windows powershell right?
alr ty
This produces a List with a bunch of null values at the end
he fixed it further down smile
Ah ok
for reference
If i want to create a bossbar that shows the health of a specific person in the game, how do i do that? Im trying to make a person a "Boss" so i want his health shown in a boss bar
How would i do that?
I tried with the /bossbar command but shit aint working
so can i somehow make a plugin that does it?
scheduler that updates the boss bar with their health, onkill check that removes it from existence
Create a BossBar, when the targets health changes you change the BossBar
Scheduling would be a bit expensive because EntityDamageEvent and EntityRegainHealthEvent exist.
I guess it wouldnt be too bad because it just calls a bunch of getters. So either is fine.
it copies both the plugin and the original- plugin, any way I can add a filter or something like that
you can just reference the file directly
Also, can i somehow change the values of a item the player is holding? Like if the name of the sword is test i can change the damage it gives, or if armor is named test i can change the resistance
the PATH for me ends in target/Shards-v1.0.jar and plugins/Shards-v1.0.jar
ah so add the plugin's name too?
there should be a getname method or something similar for itemmeta
smile, do you understand the PacketPlayOutMultiBlockChange?
you have to copy the file youre building and that ends up in /target to /plugins
so path/target/BuiltFile.jar to server/plugins/BuiltFile.jar
copy /b/v/y C:\Users\me\IdeaProjects\Minecraft\Shards\target\Shard-1.0-SNAPSHOT.jar D:\Creation\Minecraft\plugins\Shard-1.0-SNAPSHOT.jar
thats how mine looks
How would i get the meta data? Like in what event do i get the players inventory items?
alternatively, just build it directly in the plugin folder
Although I myself do not like this
yea me neither especially since I use nms sometimes
three plugin files isnt a great idea
especially if they start insulting you
'no such method: L()'
u could do it on interact. And meta is just item.getMeta iirc
player.getInventory().getItemInMainHand().getItemMeta().getDisplayName()
would this work
to get the display name of the current itemi n the hand?
what event do i put it in? PlayerItemHeldEvent?
your best bet is probably to either change the damage value of the sword once it's held, or to modify the damage it deals in an EntityDamageByEntity event
Okay im trying in the EntityDamageEvent
How do i get the player from that?
is there like a event.getattacker
i dont know the method but yes you can get the entity that inflicts damage
check if its a player
if yes cast it to a player and proceed from there
or you could follow mnfalex suggestion and do if(!(entity instanceof Player player)) return;
Can anyone help me with PersistantDataContainers. I have one plugin that makes an item and gives it a "canDismantle" tag. When i try to test for that tag in another plugin, it doesnt detect it, even though returning the PersistantDataContainer keys shows it is in the item.
if (meta.getPersistentDataContainer().has(new NamespacedKey(LitcraftBasicUtilities.getPlugin(), "canDismantle"), PersistentDataType.STRING)) {
chainsawMeta.getPersistentDataContainer().set(new NamespacedKey(LitcraftItemUtilities.getPlugin(), "canDismantle"), PersistentDataType.STRING, "true");
I dont know if i need an instance of the other plugin to test for it or not. if i did do something wrong and stupid pls correct me.
and yes the metas are the same. It is just getting the same meta from the same item in another plugin.
The image is the keys of the item i am holding.
oh wait u cant add images
hold up
verify spigot account
!verify
Usage: !verify <forums username>
You need to use the same plugin. PDC is written to prevent you from messing with other plugins PDC by accident.
ah alr
@prisma palm alternatively make a api plugin that handles the pdc you want shared between plugins
did you just change ur name
why
i verified
guys someone knows how can i set the hight of the name tag?
how could i do that ? i know change the name tag with packets and scoreboard. My problem is, i'm teleporting an armostand to the player with custom name and it has the same high of name tag, and i need to move the name tag (no the armorstand)
Move the armor stand
i need to move the name tag :(
Time to make a mod then
!verify
Hey, how do I go around changing a player's skin for itself?
Using 1.18.2
My code looks like this so far, running the command doesn't do anything
I might need to set the property name to "textures" honestly
no clue to what that is
you could use SkinsRestorer or
is there a way to convert an inputstream to a File object without actually saving a file to the OS?
that's not what I'm looking for
that makes no sense
The File object messes around with the filesystem
a file configuration ?
like a spigot YamlConfiguration ?
that would actually be a lot more doable lol
yeah
like, a lot lot more doable
get it as an inputstream
that's where I was at
YamlConfiguration.loadConfiguration(new InputStreamReader(stream))
try with resources
^
What about a byte array
ByteArrayInputStream
if the byte array is just your string
input stream reader not input stream right
you can also just, loadFromString
update: the skin changes once I die, any way how I can make the player die and respawn or something?
I wonder if Player#spigot#respawn does it
ehhhhhhhhhhhhhhhh
premadeTranslationsConfiguration = YamlConfiguration.loadConfiguration(new InputStreamReader(MetadataHandler.PLUGIN.getResource("translations/" + parsedFilename)));
that's hot, that's hot
be and good
I use paper's api but why do that when I can be an idiot
oh
What are you trying to achieve

getting a specific fileconfiguration entry for one of the languages prepackaged in my plugin
pov: you're international
without actually making it a file outside of the resources inside of the plugin for reasons
From the web?
I am absolutely lost. What is wrong with this code? ;-;
PreparedStatement ps2 = connection().prepareStatement("INSERT IGNORE INTO `cuud` (NAME, UUID, RANK, GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RANK, GEMS, XP, KILLS, DEATHS, GEMBOOSTER, XPBOOSTER) VALUES ('NeonOwlGery', 'bd' at line 1 - console
Wouldn't it make more sense to use a bytearray then? Saves it in the memory
public static boolean checkDependencies(Plugin plugin) {
if (Supported.hasLibraries())
return true;
AtomicBoolean isLoaded = new AtomicBoolean(true);
Consumer<Exception> error = ((ex) -> { // This consumer runs if an error occurs while loading the dependency
plugin.getLogger().info(ex.getMessage());
ex.printStackTrace();
isLoaded.set(false);
});
Consumer<String> loaded = ((name) -> { // This consumer runs on a successful load.
plugin.getLogger().info(name + " loaded!");
});
// Read all libraries from the plugin.yml and manually load them (pre 1.16.5).
YamlConfiguration description = YamlConfiguration.loadConfiguration(new UnicodeReader(plugin.getResource("plugin.yml")));
List<?> libraries = description.getList("libraries");
if (libraries != null) {
libraries.forEach(lib -> {
String[] split = lib.toString().split(":");
if (split.length == 3) {
new MavenCentralDependency(plugin, split[0], split[1], split[2]).load(loaded, error);
}
});
}
return isLoaded.get();
}```This is reading the plugin.yml contents.
I think I got mine working now but I'll double check
all of this to make a safe translation autoupdater that doesn't overwrite custom values...
Where can i find the TNT texture in a texture pack?
I cant seem to find it anywhere
in the json file for tnt it says the location is in texture/block/tnt_top,tnt/side,tnt/bottom
but i cant find it
anywhere
i searched the whole texturepack folder
its not there
yeah it worked
man this is a cursed workflow
I do think I got it as simple as possible though
i dont think its development related
update: was missing the respawn packet
I just made a custom tnt, so i want a custom texture for it
so kinda development related ig?
datapack afaik
can someone help me
i have code that writes to file
but it writes to another file too
and i really dont see where im making mistake
?paste
how would i do backstabs?
double angle = ((vector.getX() + vector.getZ()/2));
if (angle <= 45) {
damaged.getWorld().spawnParticle(Particle.SMOKE_LARGE, damaged.getLocation(), 10);
damaged.damage(e.getFinalDamage());``` this is my current code
here is 3 classes
when i run /mute
it writes to ban file and mute file
but when i do /ban it writes to mute too
Is there any API to download bought premium plugins from spigotmc.org to build an auto updater:)?
You want to throw the player back instead of forward? Negative numbers?
what is the problem in this? ๐ฅด
https://paste.md-5.net/fileyelohe.java
here is 3 classes
when i run /mute
it writes to ban file and mute file
but when i do /ban it writes to mute too
example?
you mean spawn a particle behind the target entity?
raytrace, get hit position, negate it, add to entity location, spawn particle
aa i got it
might be that UUID is a data type
rename it to id
๐ค
Strange
Every other plugin supports it
and the console doesn't even shows it as an error ๐ค
humm
Yet thats still strange
others of my plugins supported it
what the heck is wrong with me?
place your bets, will I get this automatic translation update system working in my first try
I thought stuff working first try was a myth
yep messed up lol

bruh top rare moment?
how can that be possible?
Pretty sure it's not possible
it most be reviewed many times
The column is actually created, the system just cannot put the data inside the database for that reason that is written down in the idkwhatwecallthatlol.
so, I clearly don't get what's wrong
before it was saying its a f*cking NullPointerException
how do i check if player is on the ground
player.isOnGround()
it's deprecated
should work afaik
because it can be faked
The client tells the server if the client is on the ground.
humm
Its fine so long as you don;t need it for cheats
checking if the block below the player is not air... is not the most correct idea, right? ๐ค
no, you can shift and hang off a ledge
c###
Well either you go with what the client tells you or you perform the calculation on your own which a) more expensive and b) might not be correct
I might be a bit too tired I guess
pick your poison
but kinda feeling weird
I mean as long as you're not doing cheat detection, if the client lies about it then the only thing that can happen is very funny things probably
Imagine being on the ground... while flying... or something haha
Anyone know how i would be able to get the killer from PlayerDeathEvent
getLastDamageCause()
check instanceof EntityDamageByEntityEvent, cast and getKiller()
or getDamager()
thanks
it is, if its a player
oh yeah, if it's another entity then one need to do what you sent
Wouldnโt it be possible to check if theyโre sneaking and then look at their Y velocity
So check if itโs null
Ik
would also advertise for that method if you need a player killer
stuff like "what zombie murdered this poor soul" become harder
and you'd have to go along the elgar described last damage event route
I was showing mfnalex and ElgarL
sometimes my genius frightens me
especially when it's 3 am 2 years later and I'm reading my old code

what the hell why did my french file get chinese characters
oh come on
just can't catch a break, it's japanese now
saved as utf8 and read as utf16 or something like
yeah
and unicode reader gives me a malformed input, this is lots of fun
aight
just forced a charset on the stream, we good now... probably
block animations and falling blocks are something completely different
you can spawn falling blocks with spigot
after they have landed?
ofc
well pretty much anything is possible
if you want them to do damage when they hit an entity I think you'd need to check every falling block to see if they are touching anything
and damage and then delete the block
someone knows how to do that empty space? D:
why is this not working
p.getInventory().clear();
for (int i = 0; i < oldInventories.get(p).getSize(); i++) {
ItemStack item = oldInventories.get(p).getItem(i);
if (item != null) {
p.getInventory().setItem(i, item);
}
}
oldInventories.remove(p);```
i save their inventories into a HashMap<Player, PlayerInventory> but it doesn't work
the inventory instances are not re-created
e.g. the one of the player remains the same
Hide player name, and put an armorstand sitting on the player
just saving a reference to it into your oldInventories map won't clone it
are there another option? :(
use another plugin and use the api of said plugin
personally I use https://github.com/NEZNAMY/TAB
oh
so i should save the ItemStack[] contents?
i saw that plugin but i would like make it by myself
like in the plugin
Store copy of inventory
I have made a deep copy of a player's inventory, so as to save the inventory before anything happens in a GUI. However, for some reason, when I get the variable value, it returns the current inventory of the player. I have no idea what's going on.
Backing up the inventory
Accessing
There's literally nothing inbetween that changes the field
- the field is final
contents should already be a copy
Yeah, I thought so too at first, but they just sync up for some reason, instead of backing up
it's annoying
the items inside are potentially craft item stacks
which directly map to the minecraft stack
Oh, yeah they are.
I'll have to make a new array mapping the craft item stacks to Itemstacks then
Thank you
Also forgot to say, but everything worked! Thank you so much :D
why whenever i teleport someone after they take void damge
damage
does it cause them to be stuck
i make it so if someone takes damage in the void, the event is cancelled and they get teleported to spawn
but they get stuck there and can't move for what seems to be forever
I am having some trouble working on chat pings, so say I have @IkeVoodoo @IkeVoodoo2, my result would be @IkeVoodoo ยงeยงe@IkeVoodooยงr2ยงr
for (Player player : server.getOnlinePlayers().stream().sorted((plrA, plrB) -> Integer.compare(plrB.getName().length(), plrA.getName().length())).toList()) {
if (message.contains(PING_PREFIX + player.getName())) {
message = message.replace(PING_PREFIX + player.getName(), PING_COLOR + PING_PREFIX + player.getName() + PING_RESET);
}
}
```That's my code (Sorting is done so the longer names come first, an attempt to try and fix the issue)
How could I go about fixing that?
\@.* \@(.+)
something like that
handles @ @one
@Hey @There would make group1 There
why this code that detect if there is a custom item in the result slot and delete the incridients doesn't delete the ingridients if it's shiftClick?
how do i add values to my scoreboard. player.getScoreboard().registerNewObjective("Name", Criteria.DUMMY, "objectName" );
i came so far to make a score objective. but thats about it
and it exist in game, so that works as intended
well basically you just put some placeholder and each scoreboard update replace it with actual values?
but likke, how do i add the placeholder XD
i have been trying to find some kind of way to just type an interger, and make it show up in minecraft
like, i know it wont be as simple as that, but at least something where i can add a score would already help
but the only thing i can find are getters
there is this great thing called google
theres probably hundreds of tutorials on scoreboards
Why dont you use an already built scoreboard api?
Something like Assamble
Let me look something for you
1m please
There you have their github
At the end of the readme they have some examples
Let find another tuto because that doesnt explain match what you want
Im not really sure
I dont use HikariCP
I just know its a pool manager
Its like any other sql library/ whatever, its just different implementation to interfaces
also making connection is a bit different
but its pretty much same
There you have a great tutorial
I mean they use static things
Not really okay doing that, but atleast you can understand how it works
Hmn i dont think its just like normal Mysql driver
But designed better i think
Read the tuto
it will help you a lot
whats the difference between armor defense points and armor toughness
HikariCP doesn't run queries. It pools connections
You get a connection from HikariCP, then you do queries like you would normally
can you have a space in plugin name?
I forgot if you could or not
ive always done it without a space
No
ok
You used to be able to, but modern versions explicitly disallow it
I want to say 1.13+?
alright, its no problem
just wondering
doesnt bother me
should I use cammel case for plugin name
or it really doesnt matter lol
ive j done caps for every word
including first
Standard naming conventions is PascalCase for plugin names, yeah
never seen anyone use camelCase for plugin name wtf
๐
public static boolean isLocationInArea(Location location, Location location1, Location location2) {
if((location.getBlockX() > location1.getBlockX()) && (location.getBlockX() < location2.getBlockX())){
if((location.getBlockY() > location1.getBlockY()) && (location.getBlockY() < location2.getBlockY())){
if((location.getBlockZ() > location1.getBlockZ()) && (location.getBlockZ() < location2.getBlockZ())){
return true;
}
}
}
return false;
}```
idk whats wrong with this code at this point
it keeps returning false
Are you sure that location1 is the minimum corner and location2 is the maximum corner?
And are you sure that you want it to be exclusive on both ends?
same
Use a bounding box
yes
because its giving me a stupid error
which is
class file has wrong version 60.0, should be 52.0
What error
Itโs expecting java 8?
it's set to use java 8
Strange
Add this file to your project
And make sure you have this in your build
hm i found something out,
player.getLocation().getBlockX() //return -154```
but when i check minecraft, it says my cords are -153
Or if you're using maven I don't think it's needed
it is giving -1
wdym by that
okay so
i've tried changing my java version to 1.17
but keeps getting this error
and i've asked this channel
and they couldn't fix it
Unsupported class file major version 61
everything is set to java 17
so idfk
maven gay ngl
hm even weirder, it works when i use location.getX()
You using IntelliJ?
declaration: package: org.bukkit.util, class: BoundingBox
yeah
Check your project settings.
How's your pom setup?
Try this instead.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
Well, I have seen some people having issues with Java 17. Not sure why. My best guess is that it's still not finished, but do you need Java 17 for anything specific? Why not just use java 16?
i dont think i can
or i can change my paper version ig
but
i can change it to 1.13
instead
shouldn't break anything
public static boolean isLocationInArea(Location location, Location location1, Location location2) {
BoundingBox box = new BoundingBox(location1.getX(), location1.getY(), location1.getZ(), location2.getX(), location2.getY(), location2.getZ());
return box.contains(location.getX(),location.getY(),location.getZ());
}```
why does it still not workkk
still false
I mean, that shouldn't affect your plugin would it? Unless paper now requires Java 17? I don't use it so I wouldn't know, but I have Java 17.0.1 installed and I just write Java 8/16 code.
Yes, Java 8 is version 52.
which is weird
yeah
Jitpack only builds properly with Java 8. You can change it with a .jitpack file iirc.
Can't remember the specific details of that file though
i just logged all values and they are all the same except they are doubles instead of integers
maybe i need to convert to whole number?
Yeah. You can make a jitpack.yml file
jdk:
- openjdk9
before_install:
- ./custom_setup.sh
install:
- echo "Running a custom install command"
- ./gradlew clean install -xtest
env:
MYVAR: "custom environment variable"```
(obviously you would only need the jdk part though)
okay
so would i change it to openjdk-17.0.1?
Not sure because it's not called openjdk anymore. It's temurin. Lemme see if I can find supported versions
like, i've tried to fix this issue but never could
should i use spigot for this
instead of paper?