#help-development
1 messages · Page 1971 of 1
just hte instance
:breh:
LGBTQ RPG haha.. ha. no?
youtube moment
:{
I'm glad that didn't embed
clash-royale-clash-royale-emote-gif
hehehehaw
For real though, if you're asking for help it's usually a good idea to show code when you ask your question rather than waiting for someone to ask for it because we basically always will
And it's also not a good idea to shout at the people trying to help you
i just exagerate everything i say
Yeah well tone it down
Remember that nobody owes you help and if you rub people the wrong way they will stop helping you
half serious
ik
i appreciate it
:}
anyone know bungee and 1.16 optimization on world loading and cpu usage
im looking to hire for my netwokr
What does that even mean
This is not the place to hire people
why are you using 1.16 still?
?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/
regardless this is for plugin dev
cuz my dev doesnt feel like upgrading and he is slave unpaid
bruh

wonder why he doesn't feel like it
I know you're joking but that's still pretty messed up
i used 1.16 a month ago
lmao
That you would call your dev a slave and then rail on them like that after not paying them
If you're rich then pay him
All $2 of it
it was $4
smh
i wish
I'll donate $1 if you can solve a coding problem
OK BET
Ok
Given a java program and its input, determine if the code will run indefinitely or stop after a finite amount of time
ok
lol he just threatened to kill someone
give me the program
there should be a channel for this kind of things lol, pretty fun
No the challenge is you have to write a program that can take in any java program and its input and determine if it will run forever
Let's say it can only be one method to keep things simple
The input function will only ever be one method
hmmmmmmmmmmmmmmmmmmmmmmmmmmm
Why does my file clear when I restart my server?
private static File deletedPunishmentsFile;
public static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormatter.ofPattern("[dd/MM/yyyy] [HH:mm:ss]");
public static void initialize() {
try {
deletedPunishmentsFile = new File(Main.getInstance().getDataFolder(), "deleted_logs.log");
if(!deletedPunishmentsFile.exists()) {
deletedPunishmentsFile.createNewFile();
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void log(String message) {
try {
FileWriter fileWriter = new FileWriter(deletedPunishmentsFile);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
bufferedWriter.write(LocalDateTime.now().format(DATE_TIME_FORMAT) + " " + message);
bufferedWriter.flush();
bufferedWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Do you want something easier
You're not opening in append mode
wdym
When you write to a file
It doesn't append by default
It puts it at the beginning
You should be writing to the end of the file
writing
Also you should just use a logging library for this
how do I do it
Ok
trying to use https://github.com/JEFF-Media-GbR/MorePersistentDataTypes, why do i get this classNotFound error?
https://paste.md-5.net/wakefayipo.sql
Did you shade it
Given a board of conway's game of life as input, determine if it will run forever or eventually stop changing
no
ok, ty
Well that's why
I am currently making a Utility plugin and am working on a glow command. So far, everything works except when I try to set a specific player to glow. It sends no message to me or the player and there is no error message in console. Here is my code:
https://pastebin.com/8YShkNg5
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
conway?
:\
Conway's game of life, look it up
This is an easy problem I'm sure you can get it in a few hours
What do you run to make a player glow
If you want a specific player to glow you run /glow enable/disable [playername]
hmm not checking instanceof, thats an expensive one
Player playerglow = Bukkit.getServer().getPlayer(args[0]);
args[0]
Yes
Do you want a better solution by the way
I have a library that makes commands waaaay easier to write
Cool
still happens even after shading
Did you make sure it's being shaded
Look into the output jar and double check that it has everything from the library you're trying to shade
yes
If not, you did something wrong
it is building suspriciously fast...
That's not what you should be looking at
ik lol
You should be inspecting the built jar and making sure it has all the classes from the library you're trying to shade
ok so one of them is shaded but the other one refuses to
do you have multiple output jars too?
are you using maven or gradle
ok apparently i added the fork as a dependency oops
ItemInUse vs ItemInCursor?
right now im using getItemInHand
im assuming that is just main hand only
which is what i would want i think
although its deprecated
its player.getInventory().getItemInMainHand() the non deprecated one
wheres my dollar
Someone got any idea why I'm unable to reconnect to the database? Tried pretty much anything but to no avail.
ok i made 81 locations https://pastebin.com/m4gbx69V
how do i set each of those sections to one of these without writing 100000 lines
List<Material> jigBlocks = Arrays.asList(Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.BRICK, Material.GOLD_BLOCK, Material.NETHERRACK, Material.ENDER_STONE);
damn all the helper people left sadge
guess ill do it the long way
oh no
thats, a uh, very interesting way to go about making all the locations
what i would do is just put them in a list or a set, loop through each of the locations and pick a random one from the jigBlocks
500 lines
totally him
god how do i write plugin
god take a look at that paste
so how come you piss on my code which is fucking FINE! and then you turn around and tell me that is okay
cannot believe you smh
ill warn you chapster
how get hitbox watter block?
4 what
god has like code OCD
you can't say thats bad
hey god you wanna see my code it is 4000 lines+ for one class
what do you mean
he does
could you please press alt+f4
ok
its not FINE
its "okay"
we've made it much better with my advices
but @turbid shoal whats the case now
what
i just made 81 locations then induvidually changed each block in a new timer method for each one seperately ez
can we see please

believe me, nobody would wanna see that
im sure nobody would want to be associated with your code
no imagine would do that tho
suck my cojones

duke
who is duke
.
imagine being verified EW

LMAO
MY THING DOESNT EVEN WORK
WTF
I SPENT SO LONG
oli would like to refactor it for you
hold on i can figure it out
if i cant figure it out ill show
I want get block hitbox
also i might have overexagerating how much code
why... this seems like an xy moment
but there is still a lot
0~1
?
stfu
there is no block hitbox. you would have to go over the location. each blocks offsets are 0.0~1.0
do I have to answer this question? 😅
uh well it helps us a bit yeah
"us" --- "ignore him"
wdym?
🤢
💀
exactly what i wrote
us is Fourteenbrush

👉👈
generally it wants to check if the player is in the water block
"don't work"
what doesnt work
its not setting the blocks
ok, so you can just get the players current location and check if that block is water
oh yeah alsop List<Material> jigBlocks = Arrays.asList(Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.BRICK, Material.GOLD_BLOCK, Material.NETHERRACK, Material.ENDER_STONE);
List<Material> jigBlocks = Arrays.asList(Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.BRICK, Material.GOLD_BLOCK, Material.NETHERRACK, Material.ENDER_STONE);```
no
why not just put the locations into a set or something an iterate through each location and get a random material from the list?
the player can catch a part of the hitbox for water but can be in a different block
he doesnt know loops
or make 1 location and add offsets instead of making a new location
only reference 😛
ITDOESNT MATTER THAT THE WAY I DID IT IS UNEFFIECNET
why isnt it changing the cblocks
you're doing it the wrong way, which is why it's not working...
it's not the "efficient way..."
right i see what you mean
but it should still work right?
right?
like ik its not efficent, but idk why it isnt working thought
there are no errors
the only thing i can think is to get their location and then check the locations a bit around the player
the location next to the player may be water, but the player may not catch it
your world is probably invalid
i doubt its overworld
its probs "world"
Jeez
This is why you shouldn't just try to write a plugin before you understand programming concepts
def a():
a()
does rescursion or nested functions in general cause memory increase
im guessing so because it would be storing a bunch of memory locations
no
Well, it fill up the stack
Whenever you call a function from another function, it has to push a new function context onto the stack
since it will land on the stack
stack = memory
So it will take up more stack memory
kk
But not all that much
Generally stack is much much much smaller than heap
So it's usually not something to worry about unless you actually have unbounded recursion, in which case you'll get a stack overflow
Stack is memory
Heap is a different part of memory
imaginedev yeah in functional programming languages this can actually become an issue, in which trampolines usually must be used as a workaround
Many compilers will try to use tail recursion
Tail recursion is when the last call of a function is the recursive one
And it allows the compiler to convert it into a loop, essentially
It's more efficient
ok i understood a little bit
anyone by chance know what playerkickevent#setleavemessage was deprecated for
tryna null out kick messages
You are using paper
it's now leaveMessage() to answer your question at least
Paper deprecated all string message stuff
Which is very annoying
Realistically it doesn’t matter
They can’t remove support for it unless spigot does
So all it can be is a warning
Paper sometimes breaks API stuff
I just stopped using their API even for my own projects
I can just get external APIs from spigot site
ik there is a better way to do it. and i could figure it out. i just don’t feel like it
it’s not like i think that is the best way
and it is overworld. i use locations a lot in the plug-in and they work
so that’s not it
It would be so much faster to learn these concepts and then come back and write 10 lines of code instead of 200
boundingbox would remove all that code 🙂 well most of it
declaration: package: org.bukkit.util, class: BoundingBox

is there a shorter way to write this? wondering because hashmap's #replace(K,V) doesn't put it if it doesn't exist which I guess is a blessing but also sucky in some cases unless I don't know something, no other hashmap methods caught my eye. basically a replace that puts if it doesn't exist, kind of like merge but not for merge and instead for replacing
HashMap<K, V> hm = ...
if(hm.replace(K, newValue) == null) {
hm.put(K, newValue);
}```
Why not just use put
Sounds like just put
Put replaces by default
lul
that's so damn smart
No joke. I didnt even know the replace method existed...
The javadocs make me think that replace is just the disabled brother of put... cant think of a good scenario where i would consider using it.
same…
Unless you’re trying to put without adding anything if it doesn’t already exist
I think that’s pretty much the use case
oh yeah, true
I just gravitate towards computeIfPresent(K , BiFunction<K,V,V>) when something like that comes up...
replace is nice in certain scenarios. Replace only replaces something if it is mapped. If there is no mapping for what you are wanting to replace it simply does nothing lol
Do you guys know why I get this error that is crashing my entire IDEA?
where as put will still update regardles
Replace is basically put if it already exists
but even I do not understand why I typed what I did and asked for something shorter
I am very tired though
looks like the decompile got stuck in a recursive loop.
Or you dont have enough memory for the application you are trying to decompile.
There is actually a trick that can be used to protect your project from being decompiled
by basically using a zip bomb.
I have 32 GB of RAM.
RAM memory
NBT tag
ATM machine
RIP in peace
But its very odd that you are trying to decompile bukkit.Material.
Just download the sources.
Eclipse doesn’t like decompiling that either
My eclipse would freeze whenever I used autocomplete with the material enum.
I KNOW BUT I AM LAZY
IT STILL doesnt answer my question :{
why doesnt it wrk
Any errors in your console?
nope
Where does that code live? Do you actually call the method its in?
?paste
its a command
dump it in there pls
BRUH
but you arte going to tell me to change a bunch of ohter shit to make it better
done
dont
ok?
just how to fix this current problem
Xd
sure...
Brace for impact
lol
Ok so you are getting teleported?
yes
everything happens
accept for the mass block replacement
even the
jig1pos1.getBlock().setType(Material.SNOW_BLOCK);
jig1pos2.getBlock().setType(Material.SNOW_BLOCK);
jig1pos3.getBlock().setType(Material.SNOW_BLOCK);
jig1pos4.getBlock().setType(Material.SNOW_BLOCK);
jig1pos5.getBlock().setType(Material.SNOW_BLOCK);
jig1pos6.getBlock().setType(Material.SNOW_BLOCK);
jig1pos7.getBlock().setType(Material.SNOW_BLOCK);
jig1pos8.getBlock().setType(Material.SNOW_BLOCK);
jig1pos9.getBlock().setType(Material.SNOW_BLOCK);```
that happens
Is "GO" being sent to you?
yes
Double check your coordinates
Make a screenshot from your F3 screen
what?
you want me to prove to you that its at the right coords?
i dotn have minecraft home atm
on*
i just got home but i double checked earlier
You either did not compile and upload or you are simply at the wrong coords.
maybe you gotta reload the chunks?
And its for sure not this.
I don't feel like reading through the code
You have to understand that the larger your code gets, the harder it is to maintain and the easier it is to miss bugs
that is awesome
then the more in depth i will understand the epuic code i right
write
Bedrock plugins are developed on Php?
idk a friend tell me
just looking at some random ones on github, they are made in php...
wft
Altay is php
but isnt php designed for websites?
There are others in java, go, and C#
i cannot understand how they orks
why php?
me too
Idk ask them
But isnt support it from Spigot?
What
Can the bukkit object output and input stream also deal with non-bukkit types?
I thought spigot was inside Java development and Bedrock
Spigot has nothing to do with bedrock
Oh
What makes it cancer? I’ve never really used it before
for starters its impossible to edit the resulting file
Isnt the object stream serialized into bytes?
Like for sending and receive serialize the object using Serializable
Please confirm someone
The object io stream requires another io stream
Yeah the ObjecStream is over InputStream and OutputStream
I just watched a tutorial for the object streams and output it to a file, it came out almost readable with a simple person object using things like a string for name, int for age, etc
player.sendMessage() is only letting me use strings, and not TextComponents?
You could get the byte array with a byte stream though
player.spigot.sendMessage
player.sendMessage() only allow sending messages
player.spigot().sendMessage() for sending component
So what do you think?
on what
Right, my brain farted and forgot about that lol.
Um.
player.spigot() isn't an option either.
Still nothing.
Are you using spigot
it is a method
API, or NSM Spigot?
Ye, no work.
are you using the Player interface?
Player player = (Player) sender;?
player.spigot().sendMessage(component)
Ik, but the thing is it is saying that spigot() isn't a valid method of player.
Yep.
It does not allow it.
this is what you need for sending components
Ikik, but it is saying that spigot() is not a valid method of player.
can u try to invalidate your intellij cache
why
Ok.
Didn't work.
I found the problem.
For some reason Vault removes it, which is a problem cause I need both the Vault API and player.spigot().
When I removed the Vault dependency, all of the sudden it worked and I didn't change the player import at all.
Found a salution.
Changed the dependency from what Vault API has on their page to <dependency> <groupId>com.github.MilkBowl</groupId> <artifactId>VaultAPI</artifactId> <version>1.7</version> <scope>provided</scope> <exclusions> <exclusion> <groupId>org.bukkit</groupId> <artifactId>bukkit</artifactId> </exclusion> </exclusions> </dependency>
Why does vault include Bukkit
Idk.
I guess it depends on Bukkit and then your project ends up depending on that
I don’t really know how dependencies of dependencies work
thats weird
Now, final thing. How do I have 1 part of 1 message be clickable but other part be normal cause textcomponent + textcomponenet doesn't work. .-.
forgot to tell you to rebuild your project too
is it possible to add aliases for a command through a config?
just gotta retrieve it then setAliases
However I think you would have to register the command yourself to use it
Otherwise it’ll be too late
“Sets the list of aliases to request on registration for this command. This is not effective outside of defining aliases in the PluginDescriptionFile.getCommands() (under the `aliases' node) is equivalent to this method.”
declaration: package: org.bukkit.command, class: Command
This is my MenuEvent i want to ask how i would get the HandlerList on MenuOpenEvent
plugin.yml does not require aliases to be denoted
I don’t actually know when spigot registers commands from your plugin.yml
should be done when the plugin is enabling
That’s not very specific
It could be when the class is instantiated, around onLoad, or around onEnable
I see, I onced used aliases by setting them in the plugin.yml
Or just a commad framework
It would be easier because you dont need to register them on plugin.yml
I tried both:
getCommand("claimpvp").setAliases(aliases);
getCommand("claimpvp").setExecutor(new ClaimPvpCommand());
getCommand("claimpvp").setExecutor(new ClaimPvpCommand());
getCommand("claimpvp").setAliases(aliases);
neither worked
aliases is not empty
Yeah like I said it probably doesn’t work after the command has been registered
I tried it before I registered the command
I get ignored.com
ah ok
Hahahah
so what is the point of that method?
It’s used internally
alr
And can be used if you are using some kind of framework
Or making your own framework
ok thanks
I liked your FileHandler, if you have a command framework send me it aswell xD
Allright
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I'm trying to use ChatColor.translateAlternativeColorCodes() in a ComponentBuilder, and the color code is &x&1&6&8&2&d&b&l, but for some reason it is returning the text as &b&l.
I get ignored :/
Use Component.color
Legacy color codes do not work in components
(Unless you use TextComponent.fromLegacyText)
Well, their behaviour is undefined
Well, ur undefined
That for Bungeecord
Though yeah general rule of thumb is to avoid them entirely when using components
.-.
They do if you use ComponentBuilder#appendLegacy()
Ah lol
didnt know
How would be sub event done?
I have done a custom abstract Event that extend Event clas
And i done an OpenEvent that extend custom event (the abstract one)
I still haven’t managed to figure out how to loop this until a condition is met :p
Futures be kinda weird
Try teleporting the player outside PaperLib.bla.bla
public class testingListener implements Listener {
@EventHandler
public void onXPBottleBrake(ExpBottleEvent e){
Block b = e.getHitBlock();
b.breakNaturally();
}
}
says block is null
What does that have to do with looping until I find a suitable location
Ah
I thought the player get teleported
does anyone know whats wrong?
maybe it's like the playershearentity event where, instead of returning a copy of the held shears, it returns a copy of the block
which still needs to be updated in the docs
im trying to break a block when a xp bottle hits a block
Yes
so why is it saying null
oh I did not see that
What are you trying to do
this
im trying to break a block when a xp bottle hits a block
when i try b.isLiquid()
it still says block is null
try doing a projectile hit event and, after including some guard clauses, do your thing
or a pyramid, whichever you prefer
Well, no, just check if the block isn't null lol
its always null
I did my google research and it happens to others
i directly hit a block and null
public class testingListener implements Listener {
@EventHandler
public void onXPBottleBrake(ProjectileHitEvent e){
Block b = e.getHitBlock();
b.breakNaturally();
}
}
this works
very nice
dakie
but check if it's an xp bottle
otherwise any projectile will break any block
So uh. I have this in my Component Builder, but it won't become bold.
.append(ChatColor.translateAlternateColorCodes('&', " &fTo get your code")).reset().bold(true) there is a reset because the previous one has a click event and I don't want this one to have a click event too.
public class testingListener implements Listener {
@EventHandler
public void onXPBottleBrake(ProjectileHitEvent e){
Block b = e.getHitBlock();
b.setType(Material);
}
}
what do i put in set type?
Material.<the material>
.
b.setType(Material DIAMOND_BLOCK);
like this?
oh
b.setType(Material.DIAMOND_BLOCK);
he asked before me
unless youre not using stringbuilder then idk, you should show the whole thing
I also cannot read
Lol.
maybe the reset cancels out the bold?
try setting the event to null instead of reset
is there a way to check if EntityDamageByEntityEvent is a critical hit?
I think you could use damage modifiers for that
Oh, maybe you can't
You can check the conditions that would cause a crit though
😦 theres a lot of condition for crit
isn't there a method to check it?
If the following conditions are met, it should be a crit:
- The attacking player is falling (velocity has a negative Y component)
- The attacking player is not in water, gliding, or flying
- The attacking player is not on the ground
- The attacking player is not sprinting
I believe these are the conditions for a crit
I could be wrong
yea i think so
isnt there just 1 simple method that brings this all together and return a bool value?
no
not sure why people think that because there is an API means they don't have to create code o.O
not hard to check all those conditions
well it would be convenient
yes everything would be convenient if someone else does it for you
oh god
I mean it's kinda annoying but it's not that hard to implement
yup
Wait, there’s no api way of checking if an attack is a crit?
I think none exist even in DamageCause
So I'm trying to make a custom item with spigot, and every tutorial I've seen makes one static instance of the item and gives it to many players, then when used, they compare it with the original item. The problem is I'm trying to make it so the Material is changeable, and obviously that's not possible with this method.
In an attempt to fix it I did a weird attempt to use NBT to store a tag that says it's one of this custom item, and inherit ItemStack to make a custom item type, but I've run into another problem and that is I'm not sure how to change an ItemStack's nbt data when the ItemStack is this.
yea. you need to check the velocity + 8 other conditions for it
use pdc
well create an object of the item and save it in a map
everytime you register your items onEnable
I haven't used nbt so imma head out
could try using something like https://www.spigotmc.org/resources/nbt-api.7939/ and adding a tag/checking if that added tag exists on the item.
That’s genuinely surprising
same, that was my first thought
I'll give that a try, I saw it but didn't see how to get the ItemStack back, unless modifying the NBTItem modifies the original ItemStack as well
is there a pr for it perhaps?
I believe you have to use getItem() on the NBTItem object to get back your item with the modifications made.
Alr, thanks
np
how can I change the default max enchant amount, I think by default is 40, but I wanna set it to 60
EDIT:
I used AnvilInventory#setMaximumRepairCost(60); so now if the player is in survival mode and has 60 levels they can get the item, however the test "Too Expensive! still shows up, is there any way to remove this?
Image showing this is below: ⬇️
The client displays that, unfortunately
As far as I'm aware, that should still let you click it, but the client is always going to show that when above level 40. That's not something the server can control
is there a way I can send a packet to the player changing that text?
Doubtful, almost certain it’s client controlled
However I’ve noticed in certain situations, the text disappears altogether
bruh
I found a solution
Tell tell tell
since when version 1.10 is the equivalent to 1.1
wait crap I was in gamemode nvm

I did find a way to remove it all together tho,
to do it you run this:
AnvilInventory#setRepairCost(0);
AnvilInventory#setMaximumRepairCost(99999999);
this turned out to be 1.1 when I test the plugin on a server ._.
although it correctly shows 1.10 during maven build processes
guess plugin.yml takes the blame
a quick and dirty fix is doing something like this:
public void prepAnvil(PrepareAnvilEvent e) {
AnvilInventory anvilInv = e.getInventory();
anvilInv.setRepairCost(0);
anvilInv.setMaximumRepairCost(99999999);
}
that will remove it, and then you can setup a on click event to look for when the collect the item and make it so that the plugin takes the xp, other than that idk how to do it rn
In my current project that deals with anvils, currently no price displays
And the price is set to 1
Which I don’t really understand
yeah that doesnt make too much sense lmao
Might be because the items I made combinable aren’t normally combineable
It does take the blame because version is interpreted as a double first, then a string
Now that I think about it, that’s probably what’s up
You can hack around it by forcing it to be a string, version: '${project.version}'
Assuming that's what you're doing
yea
yeah that would prob do it, im thinking of just making the max enchant level set to 30 or something so that it will show up in the anvil, I dont like it but I think that may be the best way, so that people can see what their spending
oh? thanks!
I think that’s going to be the cleanest solution, albeit disappointing
yeah I may be able to get it to work with packets but ngl idk how to use em
If you work up some black magic that works, you better tell me
tfw best practices are called a hack
You’re a hack
oof
What other uses are there for reflection than sending a packet for multiple versions
Relating to spigot plugins specifically
hack + no repercussions -> best practice
I meant hacking around the "interpreted as double first" lol
this is how you send commands through console as console right? Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "condump");
if so, are you able to send them onDisable? because this doesn't work for me java public void onDisable() { // Plugin shutdown logic // Always dumps console to repo on shutdown, just because Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "condump"); }
if not, no big deal I'll figure something else out
just so you know the max level for enchantments that aren't "Too Expensive!" is 39. I was looking into NMS but I got confused, too much black magic for my small brain
No, the server won't accept commands on disable
Nor should you really have any reason to be executing commands at all through the console in your code
If condump is one of your commands, you should export that command's functionality in a method and invoke said method
Hello guys, I need help with some java logic. Say I got an abstract class foo, a class bar that extends foo, and an interface baz. Is it possible to check in the foo's constructor if its child class bar implements baz? If so, how would I do that?
not sure what exactly you are asking or trying to do o.O
This sounds like a design problem to be honest. There might be a kind of hacky way but you should probably overthink your abstraction.
public abstract class Foo {
private final int x;
public Foo() {
if (this instanceof Baz) {
x = 10;
} else {
x = 5;
}
}
}
Yea true. I've been pondering that as well. Just wanted to see if I could somehow let a parent class know that its child class has an interface implemented. I'll experiment other ways then, thanks!
Yea that's what I've also done, mine's getting an error. Not sure if it's related to it though
Im not even sure if this works because the identity chain is build top to bottom. I have literally never seen this.
Whats the error?
Lol yea, I'm not certain myself as I've just begun learning about things I could do with abstracts and interfaces
Incompatible conditional operand types Foo and Baz
Maven or Gladle? Serious question
You wanna start a war?
I think the overall concept of a dependency manager is better grasped when using Maven as it has a more configuration style approach while Gradle is more execution driven.
The community of Maven is still considerably bigger that the one of Gradle. So if you are not really experienced then i would gravitate towards suggesting Maven.
But eventually you should learn both
Compile error?
Or runtime
Nvm, found the problem. Forgot to change my Baz from class to interface lol
I agree, I started with Gradle but now I found a lot of issues with dependencies not availables on Gradle but yes in Maven:/
how do i add spawners into shopgui+
But yea considering your comment here, I'll look deeper into this
cause i dont know
Was about to say. For me it compiles fine.
Yea, thanks a bunch!
well no ones helping
Then ask the developer
as specified for Type comparison operator instanceof:
RelationalExpression:
RelationalExpression instanceof ReferenceType
If a cast of the RelationalExpression to the ReferenceType would be rejected as a compile-time error, then the instanceof relational expression likewise produces a compile-time error. In such a situation, the result of the instanceof expression could never be true.
Yep, I realized the error too lol. Thanks for letting me know 😄
hello, do y'all regularly clear out ur m2 cache
mines is like 6gb and i havent cleaned it for 2-3 years
I dont unless i got a problem with some repos.
my disk space is my problem xD
no
I've had mine for 6+ years and its only 20gb
probably a lot of goodness buried in it
wat the heck xD
just about every version of everything
you must be doing a lot of projects ig
looks fine to me.
Suggestion: Get WinDirStat and see what cloggs up your system
with loads of depends
my projects are on my other ssd
i can technically move my m2 repo right
like the location
uh
gotcha!
isnt the m2 repo location an env variable
or no
I think its defined in your settings.xml so you can have different profiles for different repos. Not sure on that one.
the page file is for extending your memory using virtual memory
ah
so it stores anything that doesn’t fit in your memory
ahhh alright
for my game problem actually
someone said this on their forums
they said cut and paste- meaning it's okay to delete the folder i assume?
i just realized this is the wrong channel
my bad
thank u for this tool i bumped from 7 gb back to 39gb
Rip
I got what I was working on earlier figured out, now my only problem is how to prevent an ItemStack from being able to be moved in creative mode. I read somewhere that Creative mode is handled client-side (which would be dumb if that's the case) but this doesn't cut it:
@EventHandler
public void onMove(InventoryClickEvent e) {
ArrayList<ItemStack> items = new ArrayList<>();
if (e.getClick() == ClickType.NUMBER_KEY) {
items.add(e.getWhoClicked().getInventory().getItem(e.getHotbarButton()));
}
items.add(e.getCurrentItem());
items = items.stream().filter(Objects::nonNull).collect(Collectors.toCollection(ArrayList::new));
if (items.size() == 0 || items.stream().allMatch(itemStack -> itemStack.getType() == Material.AIR)) return;
if (items.stream().noneMatch(itemStack -> new NBTItem(itemStack).hasKey("HotbarItem"))) return;
e.setCancelled(true);
}
If I use number keys or click then every other click picks up the item (maybe smth to do with DOUBLE_CLICK?) If I shift-click it works, number keys work, etc.
The only thing I could find is ClickType.CREATIVE but I'm not sure how to use that
There is an InventoryCreativeEvent iirc
Welp, thank you
Idk how I missed that lol
Wait... wtf is that stream even for?
Why do you stream a list that will always only have a single element in it?
True
I need to get the two items that could appear
Remove nulls for items that don't exist
Check if any have the nbt tag and then cancel if it does
I'm assuming for InventoryCreativeEvent I have to use InventoryAction?
@EventHandler
public void onMove(InventoryClickEvent event) {
ArrayList<ItemStack> items = new ArrayList<>();
if (event.getClick() == ClickType.NUMBER_KEY) {
items.add(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()));
}
items.add(event.getCurrentItem());
items.removeIf(Objects::isNull);
if (items.stream().map(ItemStack::getType).allMatch(Material::isAir)) {
return;
}
if (items.stream().noneMatch(itemStack -> new NBTItem(itemStack).hasKey("HotbarItem"))) {
return;
}
event.setCancelled(true);
}
My first iteration. But i see some more stuff that can be simplified.
There is more than one AIR material btw
Oh you are using 1.12 -.-
Yeah
For the purposes of this server we cannot go above 1.12
Or it would break a lot of the fundamental concepts behind it
Like what? What can you do in 1.12 that you cant in 1.18?
excuses excuses lol
parkour exists in 1.18
Most parkour players prefer 1.12
Not saying it's not possible but when you get to really complex jumps 1.13+ breaks everything
basically it isn't that you can't update, you just don't want to update and fix stuff is all
Interesting. At least its not "mah pvp"
X- and Z-facing jumps are no longer a thing, water jumps do not exist, etc.
Not what I said at all
There is no "fixing it" it's entirely removed
Half the physics things that the parkour jumps use do not exist anymore
yes means you have to adapt
There are servers that have tried
They failed because no one wanted to play them
The parkour community is a lot bigger than you think lol
obviously not that big
Im fine with it as long as its not 1.8
If you think it's under a hundred you're wrong but I'm not here to have this argument. We're sticking to 1.12
Hell most parkour players don't want to move from 1.8 so this is already outside their comfort zone
I will agree it is better then 1.8
Trust me I wish I could use things like PDCs and stuff
you can
In 1.12?
nope
but you can still allow old clients on new versions
and you can still bring back old mechanics if you really wanted to
For more difficult courses it would either be impossible or buggy as hell
Again, trust me
Servers have tried
And failed
Look I've consulted people who have done this for years ok
I'm not having this discussion, seriously.
I don't know of these servers you claim of and supposedly failed, servers fail all the time and not because of using updated versions lol
And you're saying I'm lying why?
Literally why would I want to stay with 1.12 if I don't have to
What would I gain by lying here
Literally nothing
And clearly you don't know parkour
I also don't automatically believe everything someone says either
not sorry for that either. If you can't specify which servers you speak of, then I assume they don't exist
Cool, then do your own research or zip it. If you're not gonna believe anything I say then why bring it up at all
Again I gain absolutely nothing from lying about not being able to use 1.13+
people are liars sometimes
And I'm asking you why I would lie here lmao
and I am telling you people don't need reasons to lie
I'm sorry you're paranoid but I joined this server to ask for help not be shat on for seemingly nothing
Anyway reason I didn't do this was because I didn't know about removeIf and didn't know how allMatch interracted with an empty arraylist
ever heard of pathological liars? they don't need a reason to lie they just do. I didn't say you were one, just stating people can lie without needing a reason
even if its to win an argument
Cool, I'm not doing that lmao
I have no reason to do that
This argument is stupid
I've tried to end it multiple times
empty = false
Alr, thanks
I figured from the code snippet I got, didn't know that before, hence the check if it's empty
wait, not false. its true then. removeIf will be false
since it technically matched everything
Oop
I mean I guess for this case it doesn't really matter?
Cause if you're moving two null items then it's not like cancelling it would do anything
But it's good to know for the future
Is there a way to kill an entity with the drops just like a player killed it?
The drops dont change for player kills, do they?
Unless he has a looting sword ofc
I guess so, yes
What is your concern?
I want to kill an entity using my plugin but make the entity drop it's drops like it was killed by a player
Try calling the EntityDamageByEntityEvent by yourself.
how do I do that?
Hi! Anyone know how to use brackets < and > in maven and not trigger a module. I mean Java have \\ for \ char, maybe there is something \< (not working) for maven?
So you want to know how to escape < and > in xml?
Yes
Yes, it works, thank you so much!
this is where reading the spec helps
you could use the loot table for the entity and then just spawn those items from the loot table
say i want to temporarily delete a class in intellij
how would i do it
other than commenting every file in the package
is there a simple way to just ignore that package/file
move it out of the directory
structure you see in the IDE is also the structure for the directory of the project
hm ok
not directly related to spigot, but i need some math help.
i have this:
if (client.options.getPerspective() == Perspective.THIRD_PERSON_FRONT) { // double f5
// set opposite yaw
}```
as the comment says, in there i want to set the camera yaw (field called `cameraYaw`) to the straight opposite (so 180 degrees i guess? idk)
how would i calculate that exactly? as yaw goes from -180 to +180
What language and do you use a game engine? Depending on that there is probably a simpler way.
its just a mc mod
fabricmc to be clear
but fabricmc's discord is trash, so i ask here :/
I see
what i basically want to do is set the camera yaw to the exact position that double f5 corresponds to
My approach would be -> add 180 (so you have a range from 0 - 360) -> add your flip -> subtract 180 again. Something like that.
how much do i even have to add to get the the "half rotation" huh my braiiiin
is it 90?
180
180
there it begins lol
thx
aight the yaw seems to work. but the pitch is still behaving kinda weird
yea ik but i mean
wait
as soon as i change the yaw/pitch, it goes from the first image to the second image
yaw works fine now
why the armor stand head is dont rotating to my direction
Maybe my picasso level paint skills help
Hm could also be a full circle depending on the relative anchor of the camera
uhhhhhhhhhhh
that is too much for me
ngl
i mean, i can't do the same for the pitch as for the yaw apparently...
i actually did it?
if (client.options.getPerspective() == Perspective.THIRD_PERSON_FRONT) { // double f5
this.cameraYaw = ((180 + this.client.player.getYaw() + 180) % 360) - 180;
this.cameraPitch = -this.client.player.getPitch();
}```
this seems to work fine
Do you have a constructor in your main class?
yeah by accident
i fuxed it tho
i must have accidentally added it in at some point idk how
does high ping affect code execution
More context pls. If you make a rest request then the latency will affect how long the thread has to wait.
like it rekts the tick execution
Some of the events I have from my plugin doesn't execute well on a 200 ping server
The server always has a ping of 0.000ms to itslef
The server doesnt care about the connected clients... Your TPS is the only value that is relevant for code execution.
I'm thinking of the reason might be the ping but you proved it wrong ig, and the other one which is what the server software is being used
I'm on an airplaine server rn with 200 ping some stuffs aren't executing well due to the delay
but the tps is fine though weird
If you have a ping of 200ms then you also see your actions 200ms later.
The packets travels to the server in 100ms. Then the server computes it in some milliseconds. Then the server sends back a packet which takes 100ms
Airplane server?
fork
Oh i was thinking of a plane
xD
The server is probably fine. You just see everything delayed because your data is sent later and received later
it doesn't cancel the events though which is supposed to be cancelled
The ping does not affect code logic in any way
kinda weird though, might be because of the server software but not sure untill tested for which I have no control of unfortunately, thanks though
Then dont. Good code is self documenting.
The only place where it makes sense is on exposed APIs.
Make it short but be precise.
Cover one or two common edge cases.
Notify about possible exceptions.
Thats pretty much it.
And use annotations like JetbrainsAnnotations to define contracts and nullability
how i set a nbt on entity?
Difficult. By using nms
about my problem 7smile
those values are updating but
this works once and never updates armor head position again
Is it possible to take away 10 durability on shoot with a bow?
Because this code doesnt work.
bow.setDurability((short) (durability - 10));
This is not how you change the durability anymore.
What version are you using?
1.8
Well... This version is ancient and support was dropped years ago. If you have an issue you should just
search in old forum posts from half a decade ago.
ahh okay.
*Or you update to the latest spigot version
cant do that, its for a 1.8 server
try durability + 10 and see if that changes things
il try that
does the use of backticks in sql statements only works in mysql?
I'm using a HttpUrlConnection in java to get a http response, using an url like https://api.jeff-media.com - can I also add the IP address to the HTTPURLConnection so it'll also work without DNS?
Well, it works in H2 aswell
erm sure, why wouldnt it work
How would I get the max health attribute on a custom mob?
because they were talking all the time about mysql
AttributeInstance attribute = this.getAttribute(Attribute.);```
Tried this but only Max name length exist
no
in vanilla vanilla?
No
why don't you just use a plugin if you run spigot anyway
You need a command for that
When opening a gui does it open your inventory too I forgot?
