#help-development
1 messages Ā· Page 1678 of 1
all you have to do is check if the command sender is a player and, if so, cast the sender to a Player object and call playSound on that
If you can't figure it out ||((Player) sender).playsound||
so pretty much this right?
that's basically what that does, yes
yeah now its cool and all but
how do i make it stop the command at that point?
return false?
no
return true?
you generally want to return true and handle any issues yourself
return false does weird shit.
hm ok
bro im so ashamed to ask basic questions
uh
i started coding when i was 11 and i was a dumbass.
||Unreachable statement||
I started on roblox lmfao
use that
still no idea why this is happening
nothing has changed
but now it's just stopped updating lmao
please for the love of god fix your whitespace
and press ctrl + alt + L if you're in IntelliJ
it fixes your indentation
which ones to tick?
i don't understand what the fuck it is about new programmers and having 400 lines of whitespace
but almost every single one does this
hit. the backspace. key.
anyway. rant aside, let me read this
yes thats quite the spaces
yeah sorry
so i want to make the lifesteal smp remake but i dont know how to setPlayerHealth bcs its confusing
literally Player::setHealth x)
so basicly everytime i right click this item it gives me a heart
also dont you need to set more generic health?
?
so do i just do player.setplayerhealth(player.getplayerhealth + 1)
ok thx
isnt that like a /heal command
might have to check if its below or equal to 19 tho
idk how spigot handles the overflow
pretty sure you have to set player's generic health
also how does isOp() work ?
waht
setOp is set operator
isOp is a checker
i think
ye
can ops do /gamemode and such
si
ok
depends
what the hell
you can restrict permission even for ops
what dw i fixed the spaces
https://gist.github.com/9dacca0d2fc57df7d0793dbe36d76f64 here is one if ur eyes cant handle the whitespacing
'''
'''
'''
?
my dude
oh ok
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use that command!");
return true;
}
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("deposit")) {
if (sender.isOp()) {
if (player.getName().equalsIgnoreCase("mexican_dream2")) {
player.sendMessage(ChatColor.BLUE + "[Lifesteal]: " + ChatColor.RED + "sorry an error occurred");
} else {
player.getInventory().addItem(Items.Hearts);
}
return true;
}
return true;
}
player.getInventory().addItem(Items.Hearts);
return true;
}
is that correct ?
the label check is redundant
DrawUtils.drawRoundedRect(mc.displayWidth / 2 - (width / 2) - mc.displayWidth / 9, mc.displayHeight / 2 - (height / 2) - mc.displayHeight / 13, width, height, 2, 0x90000000); How can I make it so the right side and botton isn't so big. Also when I go full screen the drawing is gone
if its longer than 3 lines and just one method then your code is bad
i want this spesific person to not able to do it
idk depends on what u want do do
depends really
@solid cargo so...
if (command.getName().equalsIgnoreCase("boop")) {
}```
you're checking the command name here when there's absolutely no need to, and you're straight up locking yourself out of the rest of your code by enclosing absolutely nothing in the braces
if its a try catch finally it probably should be longer than 3 lines but yeah 3 lines good
thats what i believe TechnoVision teached me
well, no, you didn't use an else
it stands like this in my 3 clean code books. if its in those books, its true. simple.
books never lie
wat
so it's not locking you out of the code, but it's completely redundant
same lol
principles and books are good but that doesnt mean we should follow them blindly
that is true though
if (target.getName().equals(sender.getName()))
sender.sendMessage(ChatColor.AQUA + "You can't boop yourself!");
( (Player) sender ).playSound(target.getLocation(), Sound.ENTITY_VILLAGER_NO, 99999f, 1f);
return true;```
this isn't in curly braces
only the sender.sendMessage line will actually execute based on the conditional
the sound and return will execute regardless
what you've effectively written is a method that returns true and then a bunch of unreachable code right after it
hm ok
and then for some reason after the return you have more code
also, you're checking if target is null after executing code that will throw an NPE if target is null
additionally you should really be using the ChatComponent API and a utility class that handles sending your plugin messages, but that's more about having clean, consistent code than it is an actual logical error
alright so
however, you do need to consider that if you want to change your plugin prefix and chat colors at any point, you will have to MANUALLY go through and update every single occurrence
as long as the plugin isnt large, its a breeze to do
it's still extremely bad practice
true true
don't let yourself fall into bad habits
habits are hard to break
i'm 22 and still have this awful habit of picking at the skin on my lips when i'm stressed
same
same
its satisfying
but not when it starts bleeding
it's satisfying but also i tend to have blood on my mouth more often than not lmao
lip blood hits different
arm blood is metal
thank god the spigot discord blocks external emoji, i almost used a shitpost version of pensive that i made
š„²

incidentally it's fine to use a "magic string" if it's a single occurrence, in which case it's not a magic string, it's just a constant
at least that's my personal philosophy because why would i go and define a string constant that gets used once
anyway @solid cargo you don't at all have to go this far but this is what my Messaging class looks like lmao
we should 110%
pretty much anything can be changed through config later
and it's all in one location
you can ignore all the annotations, that's more advanced shit that you don't have to worry about rn
you have a statement in the way
lol idk r u trolling now
Definitely not trolling
yo guys, I need a strategy to monitor player's ping!
BasicallyI keep sending them packets in a very spammy way (animated stuff), but I need to ensure that by doing that i don't make their ping go higher; so plaese give me strategies, I thought about this one:
If their ping is equal to UWU ms, then I will send them the packets only every UWU ms. (and i update the UWU value everytime ofc)
But I kinda feel like this strategy will not suffice, will it? Please tell me your opinions.
And before you propose "just add more delay to your animation" well there is already enough delay imo, plus it runs asynchronously in a very smooth way, therefore i wanna make sure it adapts to players
heās like 0% serious duh
āI need to monitor someoneās ping, so I will send a packet at the rate of their pingā
yes
yikes
do you think it's a good idea?
what
how could i
i'm sending them packets because i'm animating stuff
Player#getPing() I think
If that doesn't work then ((CraftPlayer) player).getHandle().ping
returns an int
ty for this, but it's not really what i asked
i asked for strategies
mine is "I need to monitor someoneās ping, so I will send a packet at the rate of their ping"
setting aside your use of UWU as a placeholder, you need to work out some sort of error function
idk if u think its good
its probably not a good idea no
it's bad because you're just generating needless traffic
and a shit ton of it
ping naturally fluctuates
so what do you propose?
sending an animation packet doesn't really cause a lot of lag
just send all your packets normally and go from there
if you're doing something like animating an armor stand, that's still not going to cause nearly as much as lag as sending 50-100 packets per second
packets dont usually cause lag to a client unless you're sending hundreds per second
basically just do this
You are aware that i need to keep sending them packets right
yes but like
if you're animating an armor stand with a runnable
the most packets per second you can send with spigot is 20, assuming you send one packet per runnable update and you're doing this every tick
you're not going to cause incredible amounts of lag
you'd have to have a sizable number of armor stands animating simultaneously in order to cause that sort of lag
Anything higher would probably not be noticeable on the client
honestly, yeah
First I'm running this async (no spigot scheduler bullcrap used here), second i'm sending litteraly 50 different every 20ms to a player
that brings me to a quick aside - would it be plausible to send JSON strings containing custom model/animation data to a modified client?
then rethink your approach
i don't really know your use case, but this sounds excessive
Is crazy crates 1.17.1?
You shouldnāt access spigot api async
yeah and that's shit
No
not really, it's a game server
i don't know what you're expecting lmao
there HAS to be some level of synchronicity going on there
it's...a game.
The scheduler is a very helpful tool
can someone help? i'm getting some errors with this code: https://paste.md-5.net/vudifokeya.java
error 1: when i click on an empty slot that is any of the specified ones that i can click it sends this error (sends the error if i have an item in my cursor slot or not): https://paste.md-5.net/asirizixin.sql
error 2: when i click on an item that is in a slot that is specified slots that i can click it sends this error (like if i put an item then take it): https://paste.md-5.net/piyibinoqu.sql
I couldn't do that sync, i'm litteraly sending 50 image packets (1 per map) every 20sm to every player in a specific zone
async is extremely useful for maintaining data that's independent of the game loop. i use async to handle chat and saving player data
(any help is appretiatited, and btw i'm buenny aka floofsy)
why are you doing that exactly?
You can do it sync
also yeah
You can send > 20 packets per second lol
you can absolutely do that synchronously
i tried, it crashed server
gif in mc
they're sending 50 packets every 20ms
Schedule repeating task every 20 ms
ms*
it's not every 20 seconds
arent they equal tho?
that's not the problem
whatās the if right above?
actually i said 50 every 20ms, but it could be even 50 every ms, depending how many map to animate there is in the zone
ah who me?
anyway 50 * 50 = 2500 packets per second
Yes
for one of these 50-map things
more context
show us the code above that image
^
Also please don't screenshot your code
they asked to ss it
@vivid cave
you're basically smurfing your players
please do ss your code
discord sucks on mobile
okay fair enough
?paste
i could use some help too!
but code screenshots are okay imo
pls
if (doorOpen) { closeDoor } else { openDoor} else { tf } ?
mb, i have the same issue where i post a question and it gets steamrolled. i've asked no fewer than 5 questions recently that never got an answer
why are you trying to earrape ppl with a volume that doesn't even exist?
youāre calling else after another else
this as well, max volume is 2 i think
you're setting your volume to 99999
no?
Max is 2
it objectively does not go higher than 2.
what if the player suddenly teleport?
i've been doing spigot dev for 6 years
it is not unlimited
Then they probably wouldnāt hear it
that's such a fringe case and doesn't matter
bruh time
ok that shouldnt fix the problem anyways
i'm not entirely certain what to do about the gif thing honestly
your options are a shit ton of bandwidth
a clientside mod would actually do a lot more here but
yo do you wanna test my feature? It works pretty smoothly both client and server side
The last thing I need is sth to make sure that people with low connection won't have worse ping because of it
Otherwise i'm pretty proud
I can invite you to my server so you test it š
you can add your own gif in the game, as big as you want ^^
so getCurrentItem() on an inventory click event returns the clicked item, and you're trying to call getType() on something that's null. that's your first error. check if getCurrentItem is null instead, don't do Material.AIR
your second error is happening because of code that I can't see (it's in CraftingRecipes, not CraftingEvents), but from your stacktrace, you're checking if an ItemStack that doesn't exist is equal to something. in your slots array (line 64), you've got two problems related to this:
- You're setting slots[0] every time. Nothing except the first element of the array is being set, so the array you're passing in is going to contain the item at the 31st index of the clicked inventory and then 8
nullItemStacks. - If at any point the code you're executing in
recipesCraftingoperates on anullItemStack, you don't have a null check in place, so it's going to throw a NullPointerException without fail unless your crafting grid is completely full (and you fix the problem where you set slots[0] and no other elements of the array).
i am very dumb and lazy and still trying to work out why my scoreboard suddenly broke
also @solid cargo look into the ChatComponent API, it's simple as shit and works great
i was told to check if it's material.air blame them not me
:p
also if i do null then it says it's always gonna be false
learn to read stacktraces and infer
show the code where it's doing this
dis is problematic boi:
if (e2.getCurrentItem().getType() == null) {
System.out.println("hi");
// error here VVV
if (player.getItemOnCursor().getType().equals(Material.AIR)) {
e2.setCancelled(true);
System.out.println("hi2");
}
}```
What is your issue?
I'm assuming that your scoreboard doesn't want to display right?
i changed top line to == null and now it's saying it's always gonna false
i posted it several times already. hang on
please send a paste of the code.
?paste
i already did
send a paste of what you're trying to do
i need context and specifics, I can't help you if you just say "I changed the top line to == null"
the enum will never be null
if i had the code of what im trying to do then i wouldn't have a problem
oh nvm
i'm fucking blind sorry, I tabbed out
yeah uh
you need to be checking if the itemstack is null, not its type
currentItem == null
your error is coming from the fact that you're calling getType() on something that doesn't exist
not from the thing you're checking getType() against
i changed literally nothing and it's now casually shitting itself in real time
it's stopped updating and is now appending a number to the end of each line that corresponds to the score
i've been having issues with the scoreboard since updating to 1.17, but
Maybe I'm wrong, but could it be from an external plugin interfering with your scoreboard? Like trying to send their scoreboard too sometime
I literally do not have any other plugins running.
wait so what do i do
I'm testing my own plugin on a local server
though
that's a lead
I might be registering the scoreboard twice
ok i removed .getType and it fine now
you should be performing null checks pretty much anywhere there's a chance you could be operating on something that's null
this is it now, player.getItemOnCursor() == null says it's always gonna be false
if (e2.getCurrentItem() == null) {
System.out.println("hi");
// error here VVV
if (player.getItemOnCursor() == null) {
e2.setCancelled(true);
System.out.println("hi2");
}
}```
in that case, yes, you want to check if it's Material.AIR
Basically if you're pulling an item from an inventoryslot, check if the itemstack is null
spigot is dumb and inconsistent with how it handles these things
ok i undid the second check and now it's == null and then .equals
minecraft is dumb
it's either "no item" or "an item, but it's air, so it's not really an item, but it's still technically an item"
yup
you can use == safely for enums iirc
or maybe that's my C# brain acting up š
you can š
okay good lmao
did you use fishing net "try catch" to debug the error?
i'm not entirely sure how Java perceives enums, since in c langs they're basically just numbers tied to some extra shit
there is no error.
that's why i'm scratching my head over it
if there were an error at all, I'd be able to track down the problem immediately, but debugging behavior that's technically correct but undesired is much harder
is it in while true loop for updating or do you use schedulers
ok so now i get this error when i put an item in or take an item from the allowed slots: https://paste.md-5.net/wuxatufaju.sql
well it's certainly not because of trying to register a second scoreboard
Backend yes, they just become a number starting from 0. Basically never have to worry about it tho unless you're saving to a database then it's maybe useful
schedulers. i limit scoreboard updates
yeah this is what I was thinking about, since Java's enums are way more flexible than other languages' enums
the two things I like about java are anonymous overrides and its enums lmao
i should add that the information displayed on the scoreboard is tied to the game itself so i'd prefer it remain synced up
If I were you I would do the following:
- make sure that nothing else may interfere with your own per player scoreboard
2), if not fixed: only for debugging time, add some System.out.println(...) a bit everywhere in the task, sending as much contextual data as possible
you may also want to do slower updates for this kind of debugging
yeah who cares xD
debugging = removing/finding bugs/weird behaviours
not definitive code
already did these
but if u have better debugging tools sure
what's bugging me, pun not intended, is that I didn't change anything
something seems to have changed in how scoreboards work
I know but I coded a scoreboard feature as well, i updated my server to 1.17.1 and nth broke
it keeps running smoothly
what with haha?
and it dynamically updates every half second (if there's anything to update ofc)
hang on
we have an electrician over
and they're about to randomly shut off all the power
and i do not have discord on my phone lmao
oh boy
anyway before I disappear
i get this error (https://paste.md-5.net/wuxatufaju.sql) with this code (https://paste.md-5.net/anecapocus.java) when i try to put an item in my gui or i take an item from the gui in the allowed slots
Shut of your pc before windows gives your system a big bonk and breaks Ur install
Hey is it possible to not open the players inventory when creating a gui?
So for example opening a chest without the hotbar etc.?
No
entity tracker is basically assigned to each entity and holds all players that should receive updates in regards to that entity
what
what kind of metadata
the "datawatcher" ?
can i have any example/ressource of how to detect player standing on a block/beeing in water?
it's pretty easy in command blocks but api idk
do i have to loop thru all players and check? ideas? ping me
oh, hmmmm. I guess you could attempt to modify the entity in the entity tracker entry to be the creeper instead of the player
might have some very very interesting side effects tho xD
worth a try I guess xD
halp me pls
Why are you using an array but only setting one value in it
Also send the class where the error is from
wdym
Error is in the CraftingRecipes class
no?
By the way, how do I get a Map of the values in commands:?
commands:
test:
description: Tests a command
usage: /test
Your own plugin or all plugins
This is just a YAML file I have in my own plugin.
I assumed that was the plugin.yml
So it's not just a yaml file from your plugin
Why is this happening? https://imgur.com/a/AeKyCFb Im drawing the image above the the background
Yaml yaml = new Yaml();
try {
FileInputStream inputStream = new FileInputStream("src/plugin.yml");
Map<String, Object> yamlData = yaml.load(inputStream)
inputStream.close();
if (yamlData.get("commands") instanceof List) {
// May need to change this
List<Map<String, Object>> commands = (List<Map<String, Object>>) yamlData.get("commands");
}
getCommand("test").setExecutor(new CommandTest());
getLogger().log(Level.INFO, "Carter enabled");
} catch (IOException ex) {
getLogger().log(Level.SEVERE, "YAML file does not exist for this plugin.");
getPluginLoader().disablePlugin(this);
}
It is plugin.yml
getDescription in Plugin
then getCommands
^ this. Your code won't work very well
Umm, what I'm trying to do is see if I can get a Map of commands from the YAML file before registering the commands.
thats what it does
declaration: package: org.bukkit.plugin, class: PluginDescriptionFile
@NotNull
public Map<String,ā Map<String, āObject>> getCommands()
Where do i put plugin.yml?
under resources
oh god i'm so dumb
Actually, I was initially wondering too, like the following?
/MyPlugin/src/main/resources?
ye
After seeing the question, I realize I may have made an error...
Thanks!
How do i fetch the server on player login event?
Bukkit.getServer
You can;t. in the Join event the players actual world is unavailable. During Login you will only get the main world
?
Your message is not clear.
During the log in event teh player data is not loaded. It will have a default Location, being the main server world.
Only in the Join event will their data be available and the world they will spawn in be available
they said the server
org.gradle.internal.resolve.ArtifactNotFoundException: Could not find spigot-api-1.17.1-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT:20210827.092549-59).
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.17.1-R0.1-SNAPSHOT/spigot-api-1.17.1-R0.1-20210827.092549-59.jar
``` Am I doing something wrong? I'm not sure why its not resolving, I've cleaned out the maven repo and have the repository in the build.gradle. Heres the dependencies and repos: https://hastebin.com/pahematami.properties
I don't think it's using 1.17.1 yet.
Not certain, but thinking.
I mean looking at this it shows it https://www.spigotmc.org/wiki/spigot-maven/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Gradle, yuck.
What's better than Gradle?
makefiles
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.17.1-R0.1-SNAPSHOT/ they do provide 1.17.1 artifacts
Not showing it for the Gradle thing for some reason on their page (https://www.spigotmc.org/wiki/spigot-gradle/#wikiPage):
repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
// As of Gradle 5.1, you can limit this to only those
// dependencies you expect from it
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
/*
As Spigot-API depends on the Bungeecord ChatComponent-API,
we need to add the Sonatype OSS repository, as Gradle,
in comparison to maven, doesn't want to understand the ~/.m2
directory unless added using mavenLocal(). Maven usually just gets
it from there, as most people have run the BuildTools at least once.
This is therefore not needed if you're using the full Spigot/CraftBukkit,
or if you're using the Bukkit API.
*/
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
// mavenLocal() // This is needed for CraftBukkit and Spigot.
}
dependencies {
// Pick only one of these and read the comment in the repositories block.
compileOnly 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT' // The Spigot API with no shadowing. Requires the OSS repo.
compileOnly 'org.bukkit:bukkit:1.17-R0.1-SNAPSHOT' // The Bukkit API with no shadowing.
compileOnly 'org.spigotmc:spigot:1.17-R0.1-SNAPSHOT' // The full Spigot server with no shadowing. Requires mavenLocal.
compileOnly 'org.bukkit:craftbukkit:1.17-R0.1-SNAPSHOT' // The full CraftBukkit server with no shadowing. Requires mavenLocal.
}
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
its odd that its only my laptop though too my desktop doesn't have this issue š¤
maven ftw
https://imgur.com/s5jnfko so this is happening whenever I try to draw a string the button background gets removed for one of them https://paste.md-5.net/usujoqenay.java
nothing. both gradle and maven are perfectly fine. I personally don't like gradle, but it has no real reason. I just don't like it. I'm a maven guy^^ there's also other solutions like ant but tbh ant really is shit lol
ant is superior
Personal preference
tbh I don't know much about ant, all I know is that both maven and gradle are more powerful
ant is easier and all
<?xml version="1.0"?>
<project name="Hello World Project" default="info">
<target name="info">
<echo>Hello World - Welcome to Apache Ant!</echo>
</target>
</project>
but yes, after all it's just personal preference. and maven and gradle are much more widely used
I grew up with maven, so that's what I use
I'm pretty sure that every proper build / dependency management system will be fine for 99% of the people. just choose whatever you're most comfortable with
Indeed
becauuuse? ^^
Where do we start?
very objective description lol
Conclure you seem very good at openGL
I, for example, don't like gradle because it invented its own syntax instead of using existing markup languages like XML, and because it has to download the wrapper everytime from a really slow server
yeah well
that's not 100% true
it has to download the wrapper once for each project
hmm
e.g. Essentials uses Gradle version X, another plugin uses Gradle version Y
so you wouldn't know how to fix my issue then
it's like a 100MB file everytime and it always takes a minute to download - I have a 1Gbit/s connection so it could be downloaded within a second, but gradle's servers are slow as hell
yeah but maybe you can explain WHY it's shit š
I can also say "gradle is shit" but it's not worth anything without explanation
^
the syntax is slow?
well I did but I actually fixed it I was missing GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
nooooo, that's just one aspect. and tbh as I said, gradle servers always take at least a minute for me to download the wrapper although I have a 1Gbit connection
Bomp maven is a lost cause, not worth arguing
I already said: Gradle is NOT shit. It's perfectly fine
I just don't like it for different reasons
takes me 3 seconds to build a 200kb maven project
Why can't we just agree that they're both garbage 
^^^^
š
I already said: both gradle and maven are perfectly fine, each one has their problems and advantages. I myself grew up with maven so I stick with that, but that doesn't mean that I hate gradle. I just don't like it for reasons I cannot properly explain. It's like that boy from the neighbour house. You just don't like him, but you also don't really have a reason for it
I use Gradle and usually it makes me wanna die, I hate both of them 
it doesnt matter what you use 
reasonable š
both are bad
It really doesn't matter LOL
š
Nah, it's called lack of caring the entire structure of how gradle works.
TL;DR: Bomp is biased, everyone else says it doesn't matter what you use
?kick @quaint mantle flamebaiting
Done. That felt good.


...
I liked the other giggle
Alr
wasnt really a giggle
A giggle on all the drugs maybe
mhm
Yeah but those emotes are kinda meh
what
send a better one then

maybe we should invent our own system, called Drain (the opposite of "spigot"). It's slow as hell, uses YAML and downloads a huge amount of hentai before it actually starts doing anything. Then we can all agree that this system is shit but we will use it anyway. I think that's a nice solution
Brilliant
Well I guess he did go over the limit
and the command to compile a project will be drain decompile (just to confuse people)
Incredible
Anyways alex the reason why I like gradle is because itās vey much more configurable which can be quite neat imo
That's a reason I can understand
i like gradle for that
Then itās also in kotlin which I personally like
Yeah that's useful, you just have to put in the time to understand how to actually use it lol
maven pom.xml files can indeed grow very much because of the xml syntax
but i just dont like how many errors you come across while building a simple project
^
maven is bad for xml
Sure it does have its complexity
I was annoyed so much by the huge pom files that I made a website to generate pom.xml files for my personal use, so yeah I can understand why people prefer gradle š
the fact you can't build external libs into a gradle project without a plugin drives me up the wall
yeah but isn't that a design choice? maven also prints a huge amounts of warnings when trying to use "external" libs, stating it won't be supported in future versions
Ye, on the contrary maven is way more common in companies so having experience in it isnāt useless at all
In fact useful (:
It probably is design choice, I just don't understand the logic behind it. It seems like that would be it's primary purpose as a build tool. LOL
again, TL;DR: use whatever you like. There will always be some people claiming "X is better than Y". Just use whatever you're more comfortable with
I thought with "external" libs you meant libs that are not provided by a repo (locally or remote) but by an absolute path, like C:\Users\Idiot\MyLibs\WhatEver.jar
Oh, no I meant by repo.
aaah oh ok
System dependencies?
sry I misunderstood you then
?ban @quaint mantle excessive complaining about moderation decision, DM profanity & insults
Done. That felt good.
Yep
I remember it from my Counter strike times like 10 years ago lol
but tbh
did anyone of you ever encounter a project that used ant (talking about MC plugins)
Gradle actually supports the absolute dependencies better than repo dependencies when it comes to compiling them afaik
gradle vs maven is like the Canon vs Nikon debate
What's Nikon 
Canon photographers always nikon users, and vice versa š
System dependencies or what u mean with absolute
aaaaah
but their printers suck lmao
Giving it a JAR from your file system. System Depends is probably what it's actually called lol
Ah yeah, both maven and gradle support that equally good imo
Like C:/Users/user/Desktop/spigot.jar or whatever
yeah but both mock you for using it š
Yeye
both actually want that you install it to your local repo instead
Lol tru
Gradle doesn't really seem to throw much of a fit, you just have to add stuff to get it to do it
But do I know what I'm doing? No
Maven hasn't really seen any changes in years tho... it's sigificantly slower than gradle.
Just out of interest - does it matter whether building a project takes 20 or 40 seconds for you?
Best seen with a multi project
Having used both in production environments for years... I've had some INCREDIBLY poor experiences with both... but primarily maven... since it's inflexible... once you start doing something more advanced than a simple fat jar it just tries to consume your soul.
No mean to offense, it's just an honest question
Also, certainly for tiny projects it's not THAT big of a deal... but when you are dealing with a 30 minute android build
30 minute hEH
when I'm running maven, my largest project takes about 30 seconds in total. about 20 seconds is consumed by the actual java compiler
but of course I can understand things are different when you are handling really large projects
But the other aspect here is
I'm only using maven for my spigot plugins, so I can understand that it's an entirely different story when you have to handle REALLY huge projects
instead of just a 2 MB Spigot plugin
readability... a nicely cleaned out kotlin gradle project is very compact and readable... it requires no external dependency to build.
oh okay I'll probably start the next debate, but: I hate kotlin's syntax lmao
Meaning for example it can be built in a multistage dockerfile where the first stage is just any java container
And it can never suffer from versioning issues since doing something like changing your system maven version doesn't really exist.
I mean regardless of if yu hate kotlin or not... I think you would be hardpressed to say that
groovy syntax is better than kotlins
since ultimately they look almost identical when it comes to gradle...
and the kotlin dsl is way more typesafe
The functions look like variable mutations but ye
What do you mean by that?
Oh well in groovy u can do stuff like shadowJar.classifier "all"
It looks like youāre assigning a variable a value
Anyways kotlin dsl is the way to go so yeah
Oh yeah, postfix notation
I mean it effectively takes the place of assigning variables
I'll probably start to love kotlin when I ever start to learn it
Yeah exe
but everyone has to agree that the syntax is strange š
and every method in kotlin is funny
like in scala where a "getter" and a "setter" may form a property by having a pair of methods:
def whatever(value: Value)
def whatever(): Value
then postfix notation would all you to do
thing.whatever newValue
println(thing.whatever)
(fun whatever(...))
I'm not a huge fan of the missing = myself... so I feel that.
I'm a big kotlin fan
It's just more powerful
Indeed
but I certainly disliked kotlin at one point too so I understand where you are coming from š
I will probably be one too in a few years when I'm forced to learn it, but right now I'm still avoiding it for reasons that are stupid
Jetbrains is a genius
IDK about that one š
Sometimes š¤Ø
let's agree on one thing
The worst part of kotlin is the fact that the jetbrains team is often times not a big fan of listening to the communities ideas
people who use M$ products to code in java / kotlin are inbred lol
Yeah got a point actually
Compared to something like rust or scala where the language evolves based on the needs sand desires of it's users.
(jk but for real, it's strange lol)
Yeye, I got to go but nice chat exe š
oh also to this... yes lol. Way back when... there was a fair bit of ant being used at mineplex.
real men use makefiles
I compiled like about (just guessed) 100 plugins from others, and only one ever used ant
I've not seen it since, it's certainly rare
but I have yet to see anyone use bazel either
š©
oh btw I got another question to all devs publishing their stuff to repos
are you using self hosted repos / github (jitpack etc) / etc? or what's your solution?
I use Jitpack, but you can use CodeMC or maven central
It's googles build tool
what
Bazel xD
I setup a simple ProFTPD server to deploy my stuff, that's also reachable through HTTP(S) but tbh I don't really like it. Thought about using Nexus buuuuuuuut Nexus sucks
Oh
I use a fair bit of jitpack for personal projects... sometimes I use gitlab cicd... but someday I'll change over to using github actions and repos
since apparently those are free
yeah github has some awesome features
I spent a long time mostly using gitlab ĀÆ_(ć)_/ĀÆ
but I'm afraid because I don't understand most of githubs new stuff lol
I still dislike the lack of subrepos on github
subrepos? what exactly do they do?
Seems like a branch to me^^
so you can create a project that has multiple components and split it up between multiple repos... the ultimate issue is that it doesn't really fix things.
I dont think subrepos are fundamentally good
Also nah branches are just seperate versions of the same repo effectively
yeah true
I'm unsure on subrepos... I've been back and forth on this problem
Why is there a black background when I add a transparent background? https://imgur.com/a/R1qYjbc
instead of MyOrganization/MyProject-Bukkit and MyOrganization/MyProject-Forge, I could have MyOrganization/MyProject/Bukkit and MyOrganization/MyProject/Forge, right?
isn't github projects sth like Trello?
Yes that's correct @tender shard
Oki thanks
but also this means that even if Myorg is taken
you can still have You/YourOrg/MyProject/Bukkit
yes
okidoki thanks
Yep np
I think they exists. https://github.com/PaperMC/Paper/tree/ver/1.8.8
isn't that just a branch?
Those are called submodules
basically each of them is a "link" to another repo
when you clone the main one
Oh
it clones the submodules
btw stop posting 1.8 stuff lmao
it works but has one fetal flaw...
which is that you cannot build a submodule without it's parent beacuse the build tool will be setup as a submodule not as a primary project.
Somebody used the worldguard api before ?
I try to check if a player is allowed to break a block, but the api always returns true..
I don't know why.. without api i can break blocks on that location...
My Function looks like this: https://paste.md-5.net/uyaciyedel.java
Like why is there this background https://imgur.com/undefined
on the first look, it should work tbh
Is this of any help https://worldguard.enginehub.org/en/latest/developer/regions/protection-query/
I assume that calling a simple BlockBreakEvent isn't a vialable solution for you?
because that's what you'd normally do when trying to support ALL protection plugins
Never did that before, do you have a example for that ?
BlockBreakEvent event = new BlockBreakEvent(...)
Bukkit.getPluginManager().callEvent(event);
if(event.isCancalled()) {
// not allowed
}
sth like that
@cold field Ok well for me a not uncommon time is when I create a new component engine... I may create:
/Name/Architecture
jvm-main
js-main
native-main
/Name/Components/Java
jvm-main
/Name/Components/Redis
jvm-main
js-main
native-main
/Name/Components/Bukkit
jvm-main
/Name/Components/Bungee
jvm-main
/Name/Components/React
js-main
But you could also just have a single project...
/Name
with submodules that are not separate repos
both options have pros and cons
I will try that, thanks š
np! Dm me when you got questions, I think we already know each other^^
I would not do that
because the block isn't actually breaking
The api almost certainly has a solution for you I know it has in the past
I'm probs (once again) stupid but what am I missing?
If i just have a private class private PacketInterface packetInterface;
And do this
if (version.equals("v1_17_R1")) {
packetInterface = new Packets_1_17_R1();
}
(which gets triggered)
Y is this triggered later? (in a diff method but the same class)
if (packetInterface == null) {
Bukkit.broadcastMessage("wot?");
return;
}
IIRC you need to get the current region and then check the region flags or some such.
unfortunately it does not have a solution
all I can imagine is cancelling the event by oneself on HIGHEST
I read diff as dilf
I'm ruined
@tender shard why would it not have a solution?
Because noone implemented it, probably
I don't see any "canBreakBlock" method somewhere in spigot^^
@toxic mesa can you send a bit more code?
@tender shard sure but this is a worldguard thing
oooh you misunderstood @rigid drum
I was suggesting that, to support ALL protection plugins, the BlockBReakEvent should be called
declaration: package: org.bukkit.entity, interface: Player
of course when it's only about worldguard, there's a method for that, that's true ofc
tbf tho a rather new addition to the API
but other plugins like CoreProtect, Essentials etc could still block the block breaking
oh thank god they added that
that's why I suggested to use a generic event
It was such a pain before lol
If the event thing from @tender shard don't work, i will check it.
But i have to support all plugins, so it makes sense to use that event.. i guess š
@tender shard sure but in that case it depends on what his goal is... if the goal is to actually break a block calling block break event is certainly the right call.
it WILL work. only bad thing that could happen is that plugins like coreprotect will log "yooo a player broke a block" although it did not actually happen
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.
true
That was the reason why i never tried it š But should that not happens, as coreprotect could also check if the event was cancelled ?
exactly, coreprotect will run on MONITOR
it depends what you are trying to do
Oh okay
when you want to break the block indeed, then you're fine by calling the event
when you just want to check it hypothetically without actually breaking the block, you might get false logs by logging plugins
I hope you know what I mean š
yes š
final Packets packets;
{ switch (version) {
case "v1_17_R1": packets = new Packets_1_17_R1(); break;
case default: error("No packet interface for version: $version")
} }
obv if ur interested in statics you can make both the initializer and the field static
das still weird tho cuz it returns: return packetInterface != null; and it does return true? // something has to be messing up here right?
how do i get the ParticleEffect dependency?
what do you mean by that
I mean I sort of agree but it seems like maybe you have 2 instances of "the class where the shit is going on"
one you call startup and it's true
and the other you do not
but generally making things more immutable will reduce the potential for bugs
because then in order to even use the class it has to be initialized already.
CustomModelData
PDC is not responsible for custom textures. You are probably searching for https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/ItemMeta.html#setCustomModelData(java.lang.Integer)
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
found it first :p
yeah i got mixed up with other things
because those are useful for some custom items so thats what i thought of
are you talking about XSeries?
CustomModelData is what youāre looking for
that github repo doesnt any information about gradle / maven dependencies etc
seems like you have to add the .jar manually to your classpath etc
are you using maven / gradle / something similar?
clone the repo and run mvn install to install it into your local maven repository
anywhere on your machine ?
i've never really used maven anywhere and no good documentation or tutorials anywher

does anyone know how i can get the second skin layer of my npc to load? this isn't doing anything to the layer: no errors at all..
//npc is an EntityPlayer
npc.getProfile().getProperties().put("textures", new Property("textures", texture, signature));
npc.getDataWatcher().register(new DataWatcherObject<>(17, DataWatcherRegistry.a), (byte)127);
connection.sendPacket(new PacketPlayOutEntityMetadata(npc.getId(), npc.getDataWatcher(), true));
i also tried using just one of the bytes from https://wiki.vg/Entity_metadata#Player instead of 127, but that didn't do anything either
i'm using 1.17
halp me pls
bump
You still haven't sent the code where the error is caused
its in the message
try e2.getCurrentItem().. apparently that gets the itemstack in the clicked slot
they mean the part of the code where the error is occuring
yeah it is
player.getItemOnCursor().equals(Material.AIR
//and
e2.getCurrentItem().getType().equals(Material.AIR)
am already using that
This
its in the code i sent
I told you this a few hours ago
Yes
does anyone know how to fix this? I've been trying to download 1.8 spigot using buildtools, the only thing i modified was portable git to the latest portable git and maven
idk why that is
Why 1.8?
It's null because the slot you're checking is empty
is not
no reason, I don't want to talk about how i had the addiction of getting types of minecraft servers.
anyways lets get to the point
why did it crash
Ok well make sure build tools is up to date
wait it's getInventory not getClickedInventory
it should be, I re downloaded it yesterday
Idk maybe you need an older version of buildtools to download a spigot version that old
no it worked making a 1.8 jar before it did this
The only thing I can think of is downgrading the stuff you upgraded
Ok.
you are using java 8 right
nope still doesnt work
Anyone know how to get data from the actual minecraft.jar, or from datapacks?
by data you mean?
I mean roughly speaking rename .jar to .zip
and then you can look through it
but to see the code itself in a readable way you need to decompile that
i still need help btw, i'm trying to figure it out alone but it's not going very well
bump - im so confused
nms :(
so annoying lmao
Anyone know of a way to generate an end island?
Like the default island that the dragon spawns on
don't you have to set count to 0
no
it still spawns a single particle
but the particle should not go into any direction xD
do what
using player.getEyelocation()
afaik the three 0's are responsible for that if you set count to 0
tho that only works on some particles
let me link you an indepth tutorial
i need help again:
i'm making a crafting table custom gui thing and i have one problem: idk how to make sure the player gets the right recipe they're looking for since lets say you want to make a crafting table, but a crafting table's recipe also has 2 vertical oak planks which can also make 4 sticks, so how do i know wether they want to make sticks or a crafting table?
btw im checking for everything instead of making a method for it
ok scratch that im gonna use vanilla crafting to make the custom one... btw new question: how do i do that
Try looking at similar plugin code
@paper viper if I had sr.getScaledWidth() - (this.width / 2 - 35) that should to the right side correct
god damn it you did it wrong again
How
How am I suppose to put it all the way to the right
without a constant
makes no sense
Then just do everything in terms of relativeness to the width?
This is not super hard...
like try stuff like
sr.getScaledWidth() - this.width/3
or something
like this
sr.getScaledWidth() - (this.width / 6), sr.getScaledHeight() - (this.height * 14)
let me tell you why
what if the scaled height is smaller than this.height * 14
then you get a negative coordinate
Not necessarily
also im just really tired and we had the 3 hour conversation yesterday so im really not in the mood rn to talk
sry
i gave him 3 examples š
is there really no discord more specific to this ?
like this is just forge mod development right ?
no
oh yes it is "forge gradle"
hes just having an issue with relative stuff
like you know when building responsive sites
you have to make everything relative and use relative terms
he keeps using constants rn
ah yes, the pain of every developer xD
Mhm
No flexbox better
real heros just do that with incrementing z indexes
i hate u
Margin 0 auto
O; wait should I have a offset?
see this is what I did with what I was doing yesterday I added a offset sr.getScaledWidth() - (this.width / 2 + 80) - smallOffset
no just no no
it works though
well
it wont lol
it does
Now what about other devices?
mobile?
sigh
where is rem on forge
rem
idk btw there is a 30k member moddedmc discord
until you hit like the smallest thing it becomes weird
that has a channel where people talk about modding xD
maybe they have some cool frameworks or smth
sadly in Java they dont have rem unit cause omega dumb
we have to calculate our own constant for the rem based on size but its not gonna be exact anyways
Just use fixed position ez clap
actually how hard would calculating a font based unit be
to multiply your offsets etc with
can't be too complex
Is it a bad idea to use universal Java multithreading methods with Spigot plugins?
?scheduling
I wouldnt see why not?
I use Executors and a ton of multithreaded stuff
Sick
omg!
also very very useful in completable futures
which uses javas common fork join pool under the hood
I mean for my purposes it's extremely simple, but I was just going to create a thread instead of using bukkit scheduler for simplicity sake
there is honestly no reason to use Bukkit's scheduler for async stuff if you arent working with ticks
lol
creating a thread is pretty useless tho
just submit it to a thread pool
and live a happy life
myes the craft scheduler using a cached thread pool
parallel streams are one of the hottest things
have seen it being abused occasionally by bad plugins :I
why ;]
r they truly parallel tho
oh yeah they do throw exceptions but thats only if you use them incorrectly
lol
like ArrayIndexOutOfBoundsException
I mean in most cases the overhead of parallel is murdering the point
Yeah thats why I only use it for heavy tasks
unless you actually use streams for heavy task-
oh
using streams for heavy tasks smh
why are streams so slow java š¦
hmm ye good point
im too lazy to create threads in a loop
lol
its readable as hell tho
imagine if javac would actually optimize them
š„²
how do i remove 1 of an itemstack in an inventory
i tried this: e2.getClickedInventory().setItem(11, e2.getClickedInventory().getItem(11).getAmount() - 1);
has an error doe
oh nvm i see what i did wrong
Where would this go on a graph sr.getScaledHeight() + (this.height / 2) ?
just set the amount of the itemstack to the current amount - 1
i already did :p
how would i replace all words in a string that are in a certain list with *
for example, if the string was "Hey guys, how are you?" and "Hey" is in that certain list, it would become
"*** guys, how are you?"
regex is one way
