#help-development
1 messages ยท Page 2227 of 1
XD
if i wanted to make a plugin that supports 1.12 -> 1.19 but i want each version to be able to use their materials and not just the api version ones would i need to use nms for that
i was thinking, dont you have to convert to radians first?
or is java math degrees
what do you mean?
Either use a library or implement your own thing to get the material, because below 1.13 is legacy iirc.
if i made the plugin for 1.18 and a player uses the plugin on 1.19 because it needs to support multiple versions but the player wants to use a skulk sensor for example
it can be 1.13+ then just an example
oh
Set the api-version to 1.13 and you're fine.
and thatd support 1.19 blocks as well?
But If you don't handle the error yourself, If 1.13 trying to use 1.19 material, it will throw an exception.
Yes it should be as long as you're using the 1.19 (latest) api
alright thanks
But it might break If there are materials that change names between 1.13 and 1.19
How would I take a item given from command and when placed and walked over do //code
is there a place or smthn to compare to see if there are any
has to be that specific item from the command
Might need to look at the javadocs yourself.
You want to do something If player walks over a specific block?
I'm making Launch pads. But i dont want to check if the player walks over a pressureplate and if that happens make him jump. I want /launchpad gives the player a pressureplate called launchpad and when placed and walked over jump
Okay, this is all you need to do
- Put a data with pdc on the itemstack
- On block place, check if the item has the pdc
- If so, put data on the placed block either store its location or use https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
- Then listen to PlayerMoveEvent and check the block under player, if the block has the data then do something.
Alternatively you can listen to PlayerInteractEvent if the block is always pressure plate.
did i screw something up here? the code doesn't work when i use a diamond
do you have an item in BOTH hands?
yeah
You should also use matchMaterial not valueOf
it works fine when i manually specify the material in the past, the code itself works fine, it's just that whenever i try to have it take in a value from a config file, it doesn't work the way it does in the past
aight thx
I am adding commands to the commandMap, can I also add tab completion to them?
still doesn't seem to work
My eyes
top 10 saddest anime deaths
note that match material is used for minecraft:sth while valueOf is used for enum
they are different
'
you gotta be more specific than doesnt seem to work tho
?
you can?
cuz literally even if you do it in reflection its still setting inside the map like getCommand()
Gotta buy the yearly sub 
i found the issue, nvrm
if you have a school email you might qualify for github student
and you get it for free
just ida pro and reverse engineer that
its a Command
not a PluginCommand
it has no tab completer
Or just yknow buy it 
too expensive
oh right my bad
the plugin tab completion can still exist when the plugin command does not exist according to my knowledge
worth it imo
Way better than Adobe's pricing 
u do also get a perpetual license to the latest version at the time of your license's expiry.
Plus it gets cheaper every year
for me it's not since spigot development is the only java coding i do and i don't do it much
Yh if I was still just doing Spigot development I wouldn't, but I use the integrated profilers a lot as well as Spring and all the other jazz.
java is stupid im using notepad++ for that
(confused java fans noice)
lmao
elon musk
I use a wide variety of products. PHPStorm, Intellij, DataGrip, Pycharm
he has enough anyways
PHP ๐
i use vsc for python lol
vsc works well for python
Better than JS
i use a wide variety of products.
MSWords, MSPaint, notepad, notepad++
php actually pretty nice
nah ms paint for the win
layers is for noob
I love more primitive tools
more creativity
my main lang is js ๐ญ
though i've started doing more ts
My condolences
everyone hates js
worlds smallest violin
does anyone know go here?
i've been thinking about learning it for like backend api stuff
I know csgo
Spring Boot 
which i normally use nodejs for
yo same
yoooooo
you pay for that o.O
champion
Yeah, I own all products 
Vlang, rust or elixir would be goto backend languages
that is not worth
the added features over the community editions do not warrant that
I mean assuming you're not using it professionally sure
Just like how elongated muskrat bought twitter, when you can get twitter in app store
not quite
yesn't
get a software engineering job, they pay for it ๐ค
The database integration, profiler, etc are very much worth
buy ida pro instead and crack it
ida pro worths much more
database is very nice, meh i wouldnt py tho lol
I don't think I could go without IJ Ultimate tbh.
IIRC the spring support without it is horrible
Plus I'm supporting a company that provides an amazing licensing system and product
nicee but ruining minecraft is a much bigger sin than good
microsoft should stick at what they're good at
you got a point
software solutions not games
yeah exactly
If you think Jetbrains is expensive peek at Windows Server DataCenter MSRP 
Wait, they are good at software solutions?
nah if you think that's expensive try buying some antimatter
good in huge quotation marks but its what they kind of built their empire on
If you think that's expensive, try buying a planet
it costs 62.5 trillion per gram
How much does a planet cost? ๐ค
Maybe, but not all planets are created equal
if you think thats expensive, try buying printer ink!!
๐คฃ
if you think thats expensive, try buying toilet paper!!
Try gas
cheaper to drive it on scotch
how can I make my jar support Java 17 and below?
Use the lowest java version you want to support
If you want to support 8-17, compile for java 8
If you want to support 17+, compile for java 17
oh ok
hello there is something in the bungeecord and a son who is the sonoyuncu client cannot login
ha okey sorry
?
interact events dont trigger when there is a block behind an entity
or basically when an entity is too far to be attacked, but a block is close enough to be targeted
@lost matrix sorry for the ping but this was what i was talking about, quite wacky
What are you trying to do?
ya actually hitting the mob? F3B
If you want to detect when player left click an entity, use EntityDamageEvent
no im literally just demonstrating that an interact event is not triggering when it should
im not actually trying to attack an entity here but im showing that if you are within that specific range interact events dont trigger
and no you use an EntityDamagedByEntityEvent, but that's not what im showing here
yeah that's what I meant.
is there a way i can disable tabbing, when writing a command?
wdym? like you dont want tab suggestions?
yes.
make a command implement TabExecutor instead of CommandExecutor, and return an empty list
if you return null it'll default to player names
Someone knows the enum value in Material for floating Water (even with update) ?
i dont know about that one pillow
Is there any different when you don't hold an item while left clicking it?
its just water. It then has a height value. (also wdym 'floating')
Is there a way to prevent the water to flow ? I want to make a floating sphere of water
Is there any way to pass an argument to a Runnable?
constructor or properly scoped variables
iirc if you place blocks while saying 'false' in updatePhysics it should float
im not entirely sure tho
Mmh
how do i get the plugin specific logger?
plugin#getLogger
or you can just make your own logger
eh
i was asking cuz of the prefix
but if it's plugin i probably should use the bukkit logger anyways
How can i increase players kb when he was rod hitted?
Like hooked
I couldnt find right event for this
the GENERIC_ATTACK_KNOCKBACK attribute unfortunately doesn't work for players, so you either have to apply the knockback enchantment or apply velocity to the target manually if you don't want to do this
I have a custom ore-mining system which cancels the event and sets the block to bedrock, then gives an item to the player. But, i found that efficiency on the pickaxe causes the block to not do any of that and instead cancel the event and only running the code after mining it twice while holding constantly. Any help?
plz use switch
I would like to apply velocity to the target that was hooked but what event should i use?
if you want to detect when an entity was hit by another entity, EntityDamageByEntityEvent
oh you mean fishing rod
PlayerFishEvent should do it
Alright, thank you
and specifically on the CAUGHT_ENTITY state, if you're reeling in
Hi.
I'm trying to store a list of locations and I've used a File to store the data between server restarts. but im having some trouble retrieving and storing the list to a variable. I know that im retrieving the List correctly but when im trying to make it to the variable it breaks.
What ive tried:
public static List<org.bukkit.Location> DrillLocations = new ArrayList<>(); DrillLocations.addAll(FileHandeler.getFile().getList("Cords"));
And:
public static List<org.bukkit.Location> DrillLocations = FileHandeler.getFile().getList("Cords");
Does somebody know where to find the Spigot Obfuscation Mapper?
Location is configuration serializable, you can save and load location with FileConfuration#setLocation/getLocation
how do i get the information to a variable?
wdym?
since the locations are in a list i think you have to save it in another way
you need to verify your account to do that
So - i'm chaning a lot of blocks using NMS, because the basic bukkit methods aren't fast enough, but i ran into an issue - the block changes are not being sent to the client. How can i achieve that? The blocks only update if i right click them. ๐
Yeah, put it in the configuration section or something.
what ru using to change the blocks
i dont have acc
public static void setBlockInNativeChunk(World world, int x, int y, int z, int blockId, byte data) { net.minecraft.server.v1_8_R3.World nmsWorld = ((CraftWorld) world).getHandle(); net.minecraft.server.v1_8_R3.Chunk nmsChunk = nmsWorld.getChunkAt(x >> 4, z >> 4); BlockPosition bp = new BlockPosition(x, y, z); IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(blockId + (data << 12)); nmsChunk.a(bp, ibd); }
Yes, i know, 1.8 .. ๐ But i don't think that matters in this case
do you mean
`Cords:
- ==: org.bukkit.Location
world: world
x: 1.0
y: 119.0
z: 0.0
pitch: 0.0
yaw: 0.0 - ==: org.bukkit.Location
world: world
x: 0.0
y: 119.0
z: 0.0
pitch: 0.0
yaw: 0.0 - ==: org.bukkit.Location
world: world
x: -1.0
y: 119.0
z: 0.0
pitch: 0.0
yaw: 0.0`
are u sending the packets to the server?
Send it to both the server and clients
It seems like it's not sent to the client, the problem is i'm unsure how to send it to them. ๐
Loop through all online players, and send the packet
coords:
0:
location...
1:
location...
Do you know which one it is?
I don't know I forgot
you're not using any library like protocollib or packet events?
No ๐
People like instantiating bukkitrunables lol
Question, how can I render a block in world even smaller than by putting it on the head of a small armor stand?
๐ whats up with all the else if else if else if ...
Because as it is right now, it is still a tad too big
render it as dropped item
Rotation is not acceptable
What else am I supposed to do?
that's what java does to a man
then ya dont
ever heard of switch or enums, is there a match keyword in java I'm not sure
there's many alternatives to just a bunch of else if statements
There is no way to render a block smaller?
you could still use the block change clientbound packet, the packet ID is 0x09
That's rust lol
python too as far as I know
and Java has enums aswell I'm sure of that
Ferris in the status
But that doesn't change functionality at all does it?
just need to find a way to make use of the keywords, that's why they exist
uhh not that i know of
if you put it in the hand of an armorstand
it might be smaller
than on the head
it's not ALWAYS about functionality, it's also about readability and applying to as many cases with as little code as possible
and a bunch of else if's hardly provide either of those points
hate how people just said switch is more efficient than if
they have literally the same performance, or worse
but that will require some funky rotation maths
I didn't say they're more efficient
nah i meant some people out there
just saying
oh, yeah that's right
good point, you should prioritize using if else but in this case rownox I would just be using a switch statement
pretty sure they will be compiled to roughly the same bytecode
the readability is roughly the same tho
you ccan always open a new scope and add a comment above it ๐
its just readability
there's also ternary operators and as far as I know they're optimized by the compiler anyway soo. Like to have the same ops as if ... else ...
yeah its probably just syntactic sugar or sth
I agree but why not use it when you can? It's not like it's going to harm anyone
in some cases like enum switch is much better
but in some cases it takes much more time to type
java isn't all that fast either so I don't see a point in having to use if ... else unless we're going for record times
if you use switch make sure to add braces in the cases
switch without braces is utterly confusing for me
right, I'm not that familiar with java so I'm not sure if the implementation is different as to how I'm used to it but what you're saying makes sense
lol python devs trippin rn
if you have lots of cases, switch is faster
and switch can be usefull if you have alot of cases resulting in the same outcome
also switch is a funny word
i like the word switch
wonder why it was called that
probably the dude who invented it was into bdsm
its not rlly "switching" is it
switch means you're switching roles

as if i'm the only one who knows that smh
uhh i mean
that was not the first thing that comes to mind when i think about switch
its probably called switch in java because of these things
yea! leave the man alone!
what's your problem lol
Lmao nah
better don't look at my profile then
Savingjava final List<Location> save = new ArrayList<>(); Bukkit.getWorlds().forEach(world -> save.add(world.getSpawnLocation()) ); getConfig().set("test.locations", save);
Loading```java
List<Location> load = new ArrayList<>();
load = getConfig().getObject("test.locations", load.getClass());
load.forEach(loc -> Bukkit.getLogger().info(loc.toString()));```Its an unchecked cast, but it works to load a List<Location>.
you wouldn;t need to create a List first, just pass teh class
not if you use proper serialization ๐
its quite odd that the config has no getLocationList when it has getLocation and getList for all the other types of get
i hate serialization
why
It took me a while to get my head around it
what I've started doing is this:
Make a note what object it is
Shove into toBase64
then use that note and string to restore it
which is admittedly a terrible solution
but the only i managed to get consistently working
?paste
Well that will work. It will take up a lot more space, but it works.
and other way too?
And certainly prevents people from tinkering with the internals
i use yaml in my stuff
wait what happens if you add another entry to the map
does it still restore it using default values for the new fields when loading?
wdym
you mean you alter the fields in your Class
depends on the deserializer how it will handle it
most won;t
what happens if you serialize an object like this then add a new field and deserialize that object
it will set the added field to a default value
huh
perhaps
i kind of expected it to throw NPE
probs the same
i mean
you turn it from json and yaml into a map
then deserialize that map
so both would be missing that entry
in my deserialize method i can provide default values for each object im deserializing
the thing ive shown does not use that just yet
ah
so that example does err out because map.get returns null for new fields and old objects?
right now it will yea
so ur doing like this?
int tmp = map.getInteger("StorageLimit");
result.storageLimit = tmp==null ? 0 : tmp;
I have this: block.isPreferredTool(item). the item is a diamond pickaxe and the block is stone.
why does it return false?
il be doing map.getInteger("StorageLimit", 100);
ah
100 being default in this case
any ideas?
Hello, how could I get the amount of Item crafted in ItemCraftEvent please ? (with shift click)
I tried event.getInventory().getResult().getAmount() but it gives me 1 everytime
why not just getOrDefault
also an int cannot be null
no it'll throw a syntax error
lol
i use a custom implementation of LinkedHashMap for my class
which does use #getOrDefault behind the scenes
you could use the hand slot of an armor stand
and rotate the arm in a way that makes it display nicely
anyone?
I just made the player inventory close using a Runnable because the Javadocs said so and my server crashed :/
show code
public static void closeInventory(@NotNull Player p) {
BukkitScheduler scheduler = Main.plugin.getServer().getScheduler();
scheduler.runTask(Main.plugin, new CloseInventoryRunnable(p));
}
private static class CloseInventoryRunnable implements Runnable {
final Player p;
CloseInventoryRunnable(Player p) { this.p = p; }
@Override
public void run() {
Utils.closeInventory(p);
}
}
Im writing the dependencies in my plugin and put PAPI as a softdepend, so when im writing my code will I always have to put PAPI stuff in a try block?
Show crash log
Use lambda
^^ optional but will make your code cleaner
do a check if its loaded on startup and put that in a boolean. Then check if the plugin is present, and if yes, run the code
I don't know shit about lambdas
? scheduling
there point in doing that if i only have 1 line of code that uses PAPI?
if you can avoid a try then avoid it
even if its only one line
What does Utils.closeInventory do
yeah show that
utils is the class containing this code
So you made an infinite loop
Loop task
No wonder it's crashing
oh wait I am stupid
I am stupid actually
it's spelt stoopit
SmithingRecipe(org.bukkit.NamespacedKey, org.bukkit.inventory.ItemStack, org.bukkit.inventory.RecipeChoice, org.bukkit.inventory.RecipeChoice)' in 'org.bukkit.inventory.SmithingRecipe' cannot be applied to '(org.bukkit.NamespacedKey, org.bukkit.inventory.ItemStack)'
SmithingRecipe LeatherBootsRare = new SmithingRecipe(new NamespacedKey(getPlugin(), "LeatherBootsRareRecipe"), new ItemStack((LeatherBootsUtilsRare.createLeatherBootsRare())));
What is this problem? it says it cannot be applied but what does that mean?
You can call launchProjectile on them to force them to shoot
you're missing params
that works for me, thanks
what am i missing?
you're missing 2 recipe choices
declaration: package: org.bukkit.inventory, class: SmithingRecipe
public void reloadFiles() {
warpsC = YamlConfiguration.loadConfiguration(warps);
settingsC = YamlConfiguration.loadConfiguration(settings);
}``` why it doesn't work, I do not get any error, but it does not work (my messages is same)
thanks
So I got this working but when I try it in game, Nothing happens..
did your register your recipe?
if i have the following text in my config where the user can enter as many 'rewards' as they like how would I loop over the rewards. would for (Object reward : plugin.getConfig().getList("command-rewards")) work?
command-rewards:
reward-1:
players: 1
commands:
- "/say helloworld"
- "/say this is a command"
- "/msg %player% 1"
reward-2:
players: 1
commands:
- "/say helloworld"
- "/say this is a command"
- "/msg %player% 2"
what's your current code?
public static void LeatherBootsRareRecipe(){
SmithingRecipe LeatherBootsRare = new SmithingRecipe(new NamespacedKey(getPlugin(), "LeatherBootsRARE"),
new ItemStack(LeatherBootsUtilsRare.createLeatherBootsRare()),
new RecipeChoice.ExactChoice(LeatherBootsUtilsCommon.createLeatherBoots()),
new RecipeChoice.ExactChoice(CompactSugarUtils.createCompactSugar()));
Bukkit.addRecipe(LeatherBootsRare);
}
That's the recipe..
for(String reward : getConfigurationSection("command-rewards").getKeys(false)) {
// reward will now be reward-1, reward-2, etc
}
also namespacedkeys can't include uppercase letters
it automatically makes them lowercase
mhm....
oh it does?
yep
mb
ty
so uppercase is no problem
in inventoryclickevent, print out the items you used as recipe ingredients, and also the ones you've added into the slots
and check if they are equal
Good evening! I am making a plug-in of agencies where I have entered the permissions to hire/fire the employees of a certain agency. To get a list of all the players who have permission to do a certain thing, would you advise me to do a getOfflinePlayers() and check the permission with vault? I accept any kind of advice. Thank you!
Why should you ever need to enumerate all players that have a specific permission?
That sounds like a really bad idea
It's not how permissions are meant to be used
I wanted to do something nice, like a gui with some pages with all the players with permissions to do something in your agency and right click modify the permissions... I donโt know
sounds like it might be better to store these permissions on your own object
for example an AgencyPlayer
and if I put them in the database on a UUID basis where is the relevant company?
what do you think about that?
store their company as an id as well?
What is the correct way to change a spawners type?
Here i have this code, but it doesn't change the spawner type.
@EventHandler
public void blockPlace(BlockPlaceEvent e) {
Player p = e.getPlayer();
if (e.getItemInHand().getItemMeta().getPersistentDataContainer().has(main.spawnerkey)) {
CreatureSpawner spawner = (CreatureSpawner) e.getBlock().getState();
switch (e.getItemInHand().getItemMeta().getPersistentDataContainer().get(main.spawnerkey, PersistentDataType.STRING)) {
case "sheep":
spawner.setSpawnedType(EntityType.SHEEP);
spawner.update();
break;
}
}
}```
(MySQL) I made two tables "Agencies" and "Employees" with in one the information about the agency with an ID of recognition and in the other the employees in the form of UUID with reference to the id of their company. What if I add a "Permissions" column or something like that? And use that instead of perms for ordinary people? In your opinion? @tall dragon
sounds like a solid idea
i would create an enum with all possible perms
and store the ordinal of their perms as list
do u mean something like that?:
Employee AgencyID Permissions
MySelf 1 1, 4, 2
Thank you so much for the idea!
๐
Linux?
some1?
how do you get the items inside a brewing stand with NMS
which packet is sent when the player mounts an entity?
mob.level.getBlockState(blockPos).is(Blocks.BREWING_STAND); i have this to check if its a brewing stand, not sure how to access the items in it though
I'm using this to make it possible for a player to spectate another player inside a vehicle, but when I make the player mount the entity again, the client does not understand and thinks I am outside the vehicle
How do I check if an inventory is my custom gui?
i use xampp for this
how would I make efficient gui inventory menu with custom items and custom commands to execute without using too many if statements or switches
with a menu framework
man its such a bummer that minecraft's NMS containers are so hardcoded into packets
creating your own merchant inventory would make trade selection semi desynced
due to if (container instanceof MerchantMenu)
instead of checking menu type
i would recommend InventoryFramework
bump
you can create custom inventories where you can store items like chests
for example i managed to make trading inventory
^
bump
sudo apt update && sudo apt install -y mariadb-server
but trading functionality is broken
well trading is not broken, you can still trade, but trade selection from GUI is
if uw ant web-based interface install phpmyadmin if u have apache2
thanks, I will look into that
um
help
how do i display japanese characters in jlabels and stuff
rn they appear as boxes
change encoding?
use different encoding id guess
forgot to send the code lol
using a delay of 3 ticks makes the the player disconnects for flying
how do I get the inventory of a Block
if its a chest u mean?
if its a brewing stand yes
Block get-> BlockState cast-> BlockInventoryHolder get-> getInventory
If it's a brewingstand, get atate and cast to brewingstand
how do I get BlockInventoryHolder
Specifically for Brewingstand:
Block get-> BlockState cast-> BrewingStand get-> getInventory
I don't see any method to get BrewingStand
BrewingStand stand = (BrewingStand) block.getState()
should be able to call getinventory on that
alright
Make sure the block type is brewingatand tho
can you react to the server kicking a player and possibly interrupt that kick using the api?
well an instanceof will suffice
PlayerKickEvent
hyena
k
PlayerKickEvent -> cancel
i already know that sourcePos is a brewing stand from a previous function call
i can get that far myself, i just couldnt recall if there was an event
Hey Guys How Can I remove enchantement text from tools, Thanks!
I'm using an nms BlockPos to get a spigot BrewerInventory
Just go into the javadocs and search for "kick" lul
u can hide all of them using an itemflag
you can use ItemFlags.HIDE_ENCHANTMENTS
i have no choice
THANKS YOU!
U don't have to do that
this code is inside my custom horse
YOU'RE WELCOME!
(hyena)
It's meant to consume to seeds inside the brewing stand
Oh ok
i love when NMS errors it crashes the whole server
cant you try catch nms stuff?
do one try around the whole block
one catch at the end
then
broadcast ERROR: Stacktrace
i know lmao
which i why you should minimine nms ๐
better than deleting the server
i mean how else am i meant to implement custom horse pathfinding
yea i said u shoulnt minimize it
sometimes u dont have a choise
for example i too rather use nms than the ridiculously slow Block#setType
uhhh im getting a filenotfoundexception when trying to get a file from my resources folder, (im not using spigot btw) i solved this before but i forgot
code?
its not my code that has the problem
Hi sorry I know this is vague, but Ive made a plugin and I dont know why its not starting up, theres no error message or anything, its just not enabling in the first place. anyone know what may cause this?
/src/main/resources/text.txt will be /text.txt in the .jar
then still nothing
Guys Hey! I'm setting Players data on my config I should set some settings. How Can I check player has already did that or didnt? When Player Do settings Him Unique ID is setting on Config. So I mean I need to check there is a unique id or isnt when player tried same settings again.
are you using mvn package to compile?
yes
?paste your pom
also it works in my ide but not in the jar thats why its definitely in my pom
Using the method .remove(ItemStack) in the class inventory, does it remove all similar items as the parameter's one or just 1?
alr
Dont tinker with config files on runtime.
When a player joins -> load the players data into a class (PlayerData or something)
When a player quits -> save the data from the object back into the file.
People need to stop using configs on runtime
it's really messy rn from various SO attempts
https://paste.md-5.net/ovicewugap.xml
hm idk looks good
aaa
My plugin isnt enabling on start up. Idk if its related to my plugin yml, but ik its definitely in the right directory. I put my plugin yml below just incase something is wrong there
name: Plugin
version: 1.0.0
author: vaindev
main: me.vaindev.plugin.Plugin
api-version: 1.18
softdepend: [PlaceholderAPI]
commands:
plugin:
description: General Plugin Commands
usage: /<command>
permission: plugin.reload
aliases: [sr, rewards]
permissions:
plugin.reload:
description: Allows you to reload the plugin
default: op
then there has to be an error
there is no error
well idk plugin.yml looks ok
show the exception
Look closely on the console.
If a jar is inside the plugin folder then one of two things can occur:
- The plugin enables
- An exception is thrown
There is no other possibility
name: Plugin :kekw:
Maybe a pl with the same name or some other plugin that gives problem to yours
it does have a name i just replaced it when sending it to here
Or maybe the dependence to PLACEHOLDER API.
lol
should still throw an exception tho
its PlaceholderAPI
!paste
?paste
whats the command for paste bin

ah ty
aaa
yup
why is it helping me with stuff that doesnt work lol
they do start at 0 in java ๐
lmao i changed one line in the code i got and it worked
those fuckers are running some old java version
Even then. N and pi are almost as bad.
yeah im stupid for thinking that didnt happen๐
what if it disables itself
?paste
this is my pom
but im getting a file not found exception
when trying to access a file
from resources
Show how you access the file
and the error
Open the jar and see if your files are in there.
And then show the code that accesses those files
didnt you say the file isn't even in your jar?
JapaneseGenerator.class
.getResource("/" + (i + 1) + ".json").getFile()
yeah and theyre not there
then you shouldnt worry about the exception but why the file isn't ther ein the first place
show a screenshot of your project structure
if you like you can additionally send a picture of a hyena but that's not required
r u the dude that uses intellij ultimate for sql statements?
i doubt that there's only one person doing that lol
lol. y
when u sent screenshots, it looked like ur statements were in a separate file
i guess you're coding a plugin, just use Plugin#getResource
satisfied now
src
| _ main
|_ java
|_ resources
|_ 1.json
no im not
ahm
String createDataTable = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (UUID VARCHAR(36) NOT NULL PRIMARY KEY, CONTENTS MEDIUMTEXT, INT NUMSLOTS, INT MAXSLOTS, TEXT TEMPLATE);";
resources should be under main, not under java
thanks
Iโm not that dude but ij ult has good enough tools for working with sql
that's how my statemtns look
i dont have ultimate but it looked like you have the statements in a separate file
that looked way more organised
@Language("SQL") 
Well, sort of
altho not ideal
sooo uhh
How do you compile?
mvn package
do a clean install instead.
mvn clean install
Just to be sure
Ew gradle
Is there a better way to do this?
private String getWhereConditionForUUID(int num) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < num; i++) {
stringBuilder.append(getDataTableName()).append(".UUID=?");
if (i == num - 1)
stringBuilder.append(";");
else
stringBuilder.append("OR ");
}
return stringBuilder.toString();
}
im on clean compile package verify, do i need to do install?
You cant depend on the spigot jar anymore
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
using maven would be way easier
use 1.19?
elaborate
when it says 1.18, replace that with 1.19
yea use that
I would start a new project. Converting can be very cumbersome.
Just get the minecraft dev plugin for intellij and generate a spigot maven project.
@vagrant stratus
lmao
wat would discorwnitro be
lets say i wanna get data from my sql table where id is 1,6,4,7 or 9
do i have to append where id=1 or id=6 or id=4... or is there a way to submit an array of ids?
@quaint mantle One ban pls, sir
hacked = stupid
Doesnt matter. Dont click on shady links
.
dont be stupid anyways kekw
^^
java.io.FileNotFoundException: file:\C:\Users\pcc\Desktop\JapaneseSensei\target\JapaneseSensei-1.0.jar!\5.json (The filename, directory name, or volume label syntax is incorrect)
where ID in (5263, 5625, 5628, 5621)
hmm
@lost matrix still btw
ok
who banned him
anyone?
im getting file not found exception
java.io.FileNotFoundException: file: .........\target\JapaneseSensei-1.0.jar!\5.json (The filename, directory name, or volume label syntax is incorrect)
actually
is it there?
Well make sure that your resources get shaded
Ignore the exception
the resources folder is included in the final jar right?
no
Screenshot your project structure
If its fked then you can try defining your resources by prepending the basedir
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
i think you cant have an exclamation mark in the filename ( ! )
yeah but i dont have an exclamation mark in it...
where do i write that tho
pom
my brain is hurting
yeah but where
what's the problem?
Just dont compare every element with all elements (complexity of n^2) but do a simple "n" sort.
Like bubblesort.
ok i lost it at the "n sort"
only 10% loss
this my stuff
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int size = input.nextInt();
int[] var = new int[size];
// populate the array
for (int i = 0; i < size; i++) {
var[i] = input.nextInt();
}
// sort in ascending order, first the small stuff
Arrays.sort(var);
int diff = Math.abs(var[0] - var[1]);
for (int i = 0; i < var.length - 1; i++) {
int newDiff = Math.abs(var[i] - var[i + 1]);
if (newDiff < diff) {
diff = newDiff;
}
}
input.close();
System.out.println(diff);
}```
but with unsorted list this will require you to compare every number i with every other element in the list so n^2 if i understood the problem correctly
oh no nvm missed the sort
How would I check if a UUID arraylist does not contain a certain UUID?
lol
Dont. Use a set instead.
list.contains
!list.contains(uuid) lol
but use a set
by checking whether it contains it. If yes, then it doesn't not contain it
This is pretty much the best you can do because you sorted already.
im wondering what it means with "modification of the input"
how do u change the input
like from unsorted to sorted
so sorting the input is the modification
just an Arrays.sort ^^
i don't think that the dude who wrote this exercise wants you to use arrays.sort lol
they asked what modification of the input allows for a single loop with time complexity O(n-1)
the asnwer is sort the input
well a linkedlist may be better for this purpose i guess?
cuz the array can have 100k elements
they didnt say to sort it did they?
they just aske dwhat do u have to do to the input to only use n-1 comparisons
oh I was thinking about the previous exercise then
nah but that code is basically what they gave me and i need to optimize ๐
I think he sent another exercise before that too
na
then it was someone else on a another discord lol
i'm confused as to what ur doing honestly
here you go
same thing btw
lets use a linkedlist for the sorting tbh
project structure
linkedlist is utter garbage and has only one single purpose: Remove elements while iterating.
isnt the whole point of this to write algorithms?
isnt it better for sorting the elements? as i assume Arrays.sort needs to recreate that array multiple times?
why dont u write your own sorting algorithm?
It doesnt
ah best thing
is there a name for a sorting algorthm that iterates an array, checking that every next values is more than the one before it and if not swaps them? then repeat until array is sorted?
Hey Guys How Can I Create Health bar like Ender Dragon, Wither...
i feel like that's a good way to sort
BossBar
Thanks!
bubble sort
internet tells me that it isnt really efficient for big collections
lets do monkey sort. Shuffle the array randomly until its sorted.
how can I clear all player statistics?
JapaneseGenerator.class
.getResource("/" + "1.json").getFile() is giving me a file not found exception
is this the right way to access files in resources folder anyways?
Hey, Sorry if it's a random question but is there a way to keep some falling blocks together even after landing on the ground?
You shouldnt care because you couldnt verify it even if it was the right way.
so what do i do lol
send a picture of your project structure
I wanna keep it like this https://i.imgur.com/OghETv4.png upon landing it does this https://i.imgur.com/4c70prD.png :/
huh?
reconsider your life choices
I wanna make that tnt ball fall naturally but not break upon hitting the ground
well tnt doesnt fall naturally does it?
So my goal is it to "fall" to the ground and upon impact I want something to happen.
are you using fallingblocks?
yeah, I'm using falling blocks.
You either mount the falling blocks on invisible armorstands or you create your own nms implementation
I'll hide them dw
not that bad if thye're invis
bad enough. once had an issue where mine would duplicate
they were invis too
No idea what you are doing. Create a new project and only add the json files there. Then compile and see if they are in your jar.
yet it brought be down to 60 fps
when i normally have arround 700-1000
yet in my case
it was probably a few 1000 of them ๐
is it possible to make them all fall in sync?
ur tryna create some kinda big comet?
have a Vector for how far u want to tp them
and then just tp them to their location+vector
is the Marker entity useful?
i'm gonna hella destroy intellij soon very soon
constant. fucking. freezing.
it also eats up the cpu ๐
looks kinda straight
intellij was so good now it's so shit
why is it shit
you take that back!
seems like you need to dedicate more memory to it
.
seems like ur pc is just shite
im using 2021 version
same
I got 32GB RAM
look, read this
still intellij could be setup to only take like 2g
ahhhh i guess they meant to put the input in an arraylist rather than an array and sorting that array, cuz Integer implements Comparable or smth?
cpu using more than what its supposed to use:
everyone: dedicate more ram!!!!
more ram = fix everyting!!!
what cpu do u have
i9-9900k or something like that
my bad
lol
well check in ur task manager
ur pc is pretty much high end
pretty good cpu, intellij rlly shoulnt take that much
i have an amd ryzen 6 core proccessor or something
rarely gets over 30 % usage
maybe when building, indexing but thats it
though i do think amd is better for this kinda stuff
no. it indeed should not
intellij is using 87% cpu :/
there is something seriously weird going on then
i can have 3 intellij instances at once open and not hit that
I've seen that happen before
Restarting fixed it
Anyways you really should be on the latest version of Intellij
is there a collection that adds elements in the order based on their Comparator implementation?
iirc TreeSet does but i need an indexed collection
make ur own 
ill take that as a no kekw
You could just sort it after inserting your value
ye but isnt sorting it at insertion more efficient?
probably not
sorting algorithms are made for that
In what world is sorting at insertion not more efficient
๐คทโโ๏ธ
woulnt it have to find the position of that object every time there is an insertion?
so its a good thing to write my own arraylist impl that sorts the elements on insertion
I am sure smth like this exists XD
basically a treeset with get method kekw
treeset takes in a comparator thro constructor
toArray kekw
but ye if i really wanted to i could do a TreeMap<int, int> where the key is just the index ๐คทโโ๏ธ
still eh?
Just build with intellij
is not bot
The old fashion way
is not bot
what arguments do you use?
is not bot
using maven?
yes
heh how its that done automatically then
Create a clean new project and see if it still happens.
again maybe its your arguments
and it still happens
wdym
Try adding yml files instead of json files
when you hit build theres arguments passed to that
that cant be the problem lol
im not even in spigot
i use 'clean compile package verify' for mine
i tried with filtering off
How can i design the protection plugin for each player having many protections?
Atm it working with 1 per player
that cant be why since i made a whole new project
and its still like that
did u add the same pom tho
yes
can you screenshot the top right corner
well dont
would this be a good idea performance wise?
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: main/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 How do I fix this?
try with clean pom
uh what
You cant do that
it wont package resources then
you use intellij just do a screenshot
why though is smth there
Your server needs the same version of java that you used to compile the plugin
yea the button you hit when compiling
Set the target java version yo Java 8 or compile with jdk 8
how would i exclude a file from a shade except one?
i use package
oh
Yeah no. The other way around. Upgrade your java version.
like i have many files that have like
namenameimportantname
namenamecheapname
i want to keep important
try 'clean compile package verify'
same thing
You can set the target release to an older version
man this is frustrating
Yeah. Lets just compile our stuff with ancient java versions. Set it to 6 so it runs on machines from 20 years ago that never updated
How did you break maven like that?
Use the internal maven panel to compile instead of using the terminal. Maybe that changes things.
lmfao
idek how to use that
You click buttons...
Do you have a target path defined in your resources configuration?
Show your pom again pls
This would work, im just not sure if it would destroy my performance processing all the calculators, for every event
Change the config to this:
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>*</include>
</includes>
</resource>
?paste
Depends on how heavy your handler is. But the Block physics event alone will probably give you problems.
What are you trying to do in the first place?
Gradle is a lot more complex and you will find a lot less help because the community is way smaller.
It really takes you a while until you get a proper setup.
Im working on a anticheat and i think it would be cleaner this way
o rip
Ppl who work on anticheats are masochists
best anticheat no cap:
I mean its going alright rn
I agree
@EventHandler
public void hitEvent(EntityDamageByEntityEvent e) {
if (!(e.getEntity() instace of Player p) && !(e.getDamager() instance of Player d)) return;
if (p.getLocation().getDistanceFrom(d.getLocation) > 3) {
ban(d);
}
}```
thank me later
Oh nice. Another 1.8 anticheat. Really missed one of those. I wish we had 20 already. Then we could actually have a choice 
Fuck people who lag
yup
Get better internet or be banned
Lol. Nice joke.
actually its better
losing cuz ur opponent is lagging kinda sux
but u should only kick
does getPing() exist?
They'd just get back on and lag again
definitely needs ban
Creating a proper anticheat actually involves a fk ton of complicated statistical math.
Ive helped someone that worked on an internal anti cheat for a bigger server and it was nuts.
they can appeal with proof of new router
good thing my algebra 1 is cutting edge for spigot developement
