#help-development
1 messages · Page 1888 of 1
okay, i'm pretty sure i have the main class setup right...
package me.mrhonbon.overpoweredmobs.overpoweredmobs;
import org.bukkit.plugin.java.JavaPlugin;
public final class Overpoweredmobs extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("Over Powered Mobs has been loaded successfully.");
getServer().getPluginManager().registerEvents(new Opmobs(),this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
System.out.println("Lol yo momma");
}
private boolean eventMode;
public boolean toggleEventMode() {
eventMode = !eventMode;
return eventMode;
}
public boolean isEventMode() {
return eventMode;
}
}
now its the command part i am gonna struggle with
you want a command that toggles the listener?
yeah, i want the over powered mobs to not spawn when i type /opmobs disable and vice verse for /opmobs enable
package me.mrhonbon.overpoweredmobs.overpoweredmobs;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.inventory.ItemStack;
public class Opmobs implements Listener {
@EventHandler
public void creatureSpawn(CreatureSpawnEvent event) {
if(event.getEntityType() == EntityType.CREEPER) {
Creeper creeper = (Creeper) event.getEntity();
creeper.setPowered(true);
}
if(event.getEntityType() == EntityType.ZOMBIE) {
Zombie zombie = (Zombie) event.getEntity();
zombie.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
zombie.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
zombie.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
zombie.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
sword.addEnchantment(Enchantment.DAMAGE_ALL, 5);
zombie.getEquipment().setItemInMainHand(sword);
}
}
}```
oh and here is my command class that has literally nothing in it so far
package me.mrhonbon.overpoweredmobs.overpoweredmobs;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class OpmobsOnAndOff implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
}
}
On the right track, if it is a toggle by command i think conclure's way is better
how would i go about that?
Opmobs can expose a method, say #setEnable(boolean) that OpmobsOnAndOff can call
OpmobsOnAndOff can accept a Opmobs instance in its constructor so it has a direct reference to the listener that it should enable/disable
would i place the setEnable before all the code? or somewhere else
You familiar with OOP (Object Oriented Programming) paradigm?
maybe a little? not to sure
ohh that has to do with what types of things are put in code respect to other things
I keep getting this error from my plugin when starting it, not sure what it is
[14:01:28 ERROR]: [MMOUpgrades] [STDERR] An error occurred while loading this configuration: []: Unknown error occurred while loading
[14:01:28 WARN]: Nag author(s): '[JustDoom]' of 'CoolPlugin' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[14:01:28 WARN]: unacceptable code point '' (0x0) special characters are not allowed
[14:01:28 WARN]: in "'reader'", position 0
I mean more is there any way to find where it wants me to change the System.out/err.print thingy
and where specifically in respect to other things^
I mean
so programming consists of data and functions
You made the plugin, you should be able to find where it is
while OOP basically segregates data (here we call fields) and functions (here we call methods) into classes
it doesn't really matter the order you specify these fields/methods in a class
ahh i see
ok got it
im trying to cast a bukkit inventory to a custom inventory but im getting an error, how would i properly cast it?
It just means that the inventory isn't an instance of your custom inventory. And I don't think you can enforce a custom type of inventory
You cannot
Use the inventory view returned from openInventory
Add it to a set and check that set in the event
yeah solar, i am still super stuck. i just can't figure this out and i have no clue why, i feel like an idiot because it's probably super easy, im just overthinking it i think
even with you telling me basically what to do i am still suck and i am sorry if this is bothersome to you
so a class can be
public class Test {
int field1;
String field2;
void methodOne() {}
void methodTwo() {}
}
it doesn't matter the order you specify the methods
i feel like what would be easier for me is to use booleans in mix with if then statements, even tho it might be more to type and code, i feel like it would be easier to understand for me at least
if you get what i mean
so you can have:
public class Opmobs implements Listener {
private boolean isEnabled;
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent evt) {
if (!isEnabled) return;
// Rest of the logic
}
public void setEnabled(boolean arg) {
this.isEnabled = arg;
}
}
because i know if i can get this simple toggle on and off event, then i will be set for making basic plugins like this
like this right?
you cant have methods inside methods
You need to learn about scopes. You are trying to create a method inside a method, which you can't do.
OOP enforces that methods are members of class
Who tag me? Please dm me the one who tag me please
unlike functional programming where you can declare functions wherever you like
Yeah because this is not javaScript
but in methods, java will execute the functions inside it from the top
Confusion?
?
statements*
Should be an async task?
That was already said below.
But I am still confused.
ok LMF probably not, can't seem to find a way, or at least I think it is not meant for fields
Like how would I use Async stuffs to reduce lag with HTTP requests.
am i dumb as in i just did the same thing again or did i do this right
careful of your brackets
You should learn at least the basic of Java
If not you will have many problems
I mean i dont wanna be rude. But when you dont know the basics its really difficult
100% a learnjava moment
Giveme some minutes
nono i understand, i am learning python at my highschool and i know if u learn one language it is easier to learn another
?jd
There you have
Python is extremely different from Java.
In jd you have the scheduler
not much difference in grander scale of things
Something like a course
I learned from there
Starting with the basics. Anyway that helps you learn tbh. Java is very different from Python because it's statically typed
Among other things
I know, I'm looking for the wiki link to task scheduling tutorial for @quasi patrol
i wish they taught java at my school, they teach javascript for websites i believe
but not plain java
Javascript is to java what car is to cargo
if they teach it, i would probably die instantly
where would you go to learn if you didn't know the basics solar?
The only coding language that I was taught at my school was HTML.
Easy to learn hard to master. It's easy to write code that works it's hard to write good code that works
i would rather trust some random sites than my school teachers
Reading the docs, java has a really good documentation i have seen
I was tought full basic website development which included Html, Css and Js
Are you using a library for http request?
School taught me 1% of my knowledge base but that 1% fundamentals helped me learn the rest
i will give this a try for a little bit, hopefully will resolve some of the issues im having. the problems i was having before was more of not fully knowing the bukkit api while now it is more of me not knowing basic java, would you agree?
I say java is easy i mean oop is easy, but it is just nice that java is the perfect embodiment of oop. Of course you can say that software design principles are not easy to grasp but that's design, not part of the language
Correct. Most issues people have with the API here is a lack of ability to either write java or read documentation
Not really using a library, just using a single class that contains stuff for Discord Webhooks. Code is in https://paste.md-5.net/ifuyayuqig.java.
On my first day of Java class on Monday, my professor wrote
public static void main(String args[])
{ system.out.println("hello");
}
And then proceeded to name a class compute_Area1.
I was dying.
so i assume me reading java docs will help read and learn the bukkit api faster than i can right now?
That was not the first thing people should learn, that's why there is jshell, without getting into what main does and why it does what it does
"javascript but not plain java"
Misunderstanding of what js and java are
Javascript has no relation to java
Absolutely
It was named that to ride java's coattails
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I dont know why many people thought that Java And JavaScript are the same
And I learned this the hard way.
The last link is the best, but not a lot of people can make it through
And they are completele different, Java is typed and oriented to Object programming
Did you guys learn Java before JavaScript, or JavaScript before Java?
Learning to read documentation will save hours of not having to wait for an answer here.
Javascript is the gateway drug to programming
im not too sure ive actually made it through oracles official java page
-.-
in all like 7 years now
Backaround, i first learned Java
No js is fucking awful
Harsh words
owowowowow watch it buckaroo
js is not awful, but ts is chef kiss
Dynamic weak typing and sloppy design all over
So is marijuana but it's still the gateway drug
man you guys are really nice about this stuff, i tried getting help at the papermc discord a couple days back and man they were rude about it, you guys are giving advice to help me get to my goals faster and i really appreciate it ❤️
Ok you're wrong on both counts here lmao
Ts literaly just Js but yells at u
Weed is pretty great and it's not a gateway drug
I first learned JavaScript. .-.
No and yes
Have you tried it?
Man this train derailed quickly
Yes it did lol
JS is fucking yeath its really difficult to understand the sintaxis, sometime it doesnt have relation. I hate high level sintaxis programming languages. That why before Java i will learn C# and nothing else. Because no other language has such amazing sintaxis
sintaxis
yeath?
For me yes
syntax in his language
Im not native speaker
what is the english equiv of "yeath" tho
Marijuana is proven to not be a gateway drug, and regardless of your personal opinion of it it's shown to be useful medically and harmless recreationally
thank you guys for guiding me the right way and not being rude about it, as a beginner to everything i really appreciate it :)
The only problems I have with it are when people stink up public spaces with it
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6223748/ Harmless. Yes of course
Or driving under the influence, of course.
I don't really see much of that
We've lost #help-development, abort mission
People drive drunk much more than they drive high from what I have seen
Well sure, but you can't say that it just isn't a problem that it causes
Anyways this is definitely off topic LOL
help-brain-development
ill just have 1 quick smoke sesh with friends no biggie
3 yrs later
buying xans from local dealer
People any recommendation how i can search on google: How to get the jar output from maven proejct via MavenProject dependency
jk
I injected 1 weed and now I smoke graphing calculators
Because it donesnt search waht i expect
target folder
i injected one weed and now i write JAVA
Oh shit
bro what happened LOL
weed
The problem is that im trying to get it via custom maven plugin
Did i just misunderstood your question
Yeah it's harmless though unless you read the studies 😉
No idk
Allright thanks
If it's harmless until you read.... that means reading is the harm!
Reading kills people! Wake up America

it is harmless until u become dependent on it to function
ezpz
I mean this discord is proof that reading the docs can cause great pain and suffering to many
Lol
i got high one time on a kayak trip and my friend was asking me to steer the kayak and apparently, i was so f-ed up that i said "what the hell is a kayak" while i was laying down in one
I dont read i dont like it. And i think its lost of time
Lol?
Similar to animal models of chronic THC exposure, chronic cannabis use has been shown to blunt DA response to DA-releasing stimulant drugs in the striatum with both [11C]-(+)-PHNO and [11C]raclopride PET imaging (Volkow et al. 2014c; Bloomfield et al. 2016; van de Giessen et al. 2017) and to decrease DA synthesis as assess with PET imaging with [18F]DOPA (Bloomfield et al. 2014) (Fig. (Fig.2).2). This pattern of decreased stimulant-induced DA release is also seen with chronic use of other drugs of abuse such as alcohol, cocaine, and nicotine
Naw it's actually really bad all around
eh? what r ya? fuckin canadian?
Wtf is miles
5280
Gross
Yeah I am you wanna go m8
Wait you're supposed to be nice
how many feet are in a mile lioterally the only thing i remember from units of measurement
I remember it because of a stupid meme
its pure shit i do not know how long a mile really is
We're only nice to Canadians we're mean to Americans to keep them away
like if u asked me to walk a mile i would not know where to end
id probably walk half a mile and be like K done
Any page where i can search a specific javadocs for a class via package.className?
?jd
wait u need maven not spigot
Any javadoc lets you do that
But for general java
Far more harmful things are legal, the main risk of marijuana use is for people whose brains have not yet fully developed
The documentation for JDK 17 includes developer guides, API documentation, and release notes.
Thanks
day 1 of reading java docs
wish me luck gusy 👍
So 99.99% of the population
Lol
🤔
Man reading documentation is soulless
should i do something else instead?
For someone to learn how to program?
is there a better alternative?
It's not like you should just read through the whole thing for funsies
The better alternative is reading through a programming book
Pay for college
oh hell no never going to college
Lots of courses out there are free for learning Java and they're interactive so you're actually doing it
Reading the javadocs will teach you about the standard library but it won't necessarily make you a better programmer
Artifact on maven = the output jar right?
Among other things
Im confused right now btww
Thanks
Hey I like being spoonfed, dun say that
A Maven artifact is a reference to a Maven artifact stored in a Maven repository. ... The files stored in a Maven repository are typically called “artifacts”
codeacademy good for that?
Lol, college hasn't even spoonfed me well
Try it and see
So uh...
Cuz im running a server for debbugging spigot plugins without getting out from Intellij Idea. But i couldnt find a solution of exporting a my maven project jar directly the debug server. So i decide to code my own maven plugin for copying the artifact jar to my debug server
hahaha
College hasn't spoonfed me either, last semester one of my first assignments had a trick question

I think the biggest takeaways from college are things you wont know you need to learn outside like algorithms and data structures
And what most typical online course wont teach you
14 dollars.... its tempting
Yeeeesh Saying a lot while saying nothing at all
should i do it.
caveat emptor
I'd try something free first to see if it's for you. Buy if you feel the groove
good point
Those "sales" are always on to make you feel pressured to buy
yeah i was wondering why a course priced at 84.99 would be that low of a price
I am about to complete my first year in a computer-oriented institute. And there they don't teach you any specific language. They teach you the basic fundamentals, structures (Tree, etc). And many other things. In conclusion, nowhere do they teach you to program, you learn that by yourself
So did yall forget about me or?
Hi
New phone who dis
What even was your question?
oh
i did not know i had pro for sololearn
i think i forgot about a free trial LOL
only platform i ever used to practice code was uhhhh
codekata or something
codewars?
Fixing Discord Webhook error 400 on my plugin and optimizing HTTP requests for the webhook cause it is activated on a command and I don't want servers to lag to death.
codewars
codeforces
You're not using JDA just raw requests?
i think he was using JDA
dunno if his code is still somewhere but his webhook was wrapped in like
a DiscordWebhook class
Just use JDA
Send how you don the request
I will spoof ping the code
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy");
String str = formatter.format(date);
String reason = String.join(" ", temp);
DiscordWebhook webhook = new DiscordWebhook(url);
webhook.setUsername("Reports");
webhook.setAvatarUrl("https://cdn.discordapp.com/avatars/686346249183690769/39490b1b0a67e892256b46fa57af29c9.webp?size=80");
webhook.addEmbed(new DiscordWebhook.EmbedObject().setTitle("New Report [" + reportcount + "]").setDescription("Reporter: ``" + player.getName() + "``\nPlayer: ``" + reported.getName() + "``\nReason: " + reason).setFooter("Submitted \u2022 " + str, "").setColor(new Color(0,0,0)));
try {
webhook.execute();
}
catch(java.io.IOException e) {
e.printStackTrace();
}```
Right
The functions come from the Github I sent above.
created 5 years ago,,, that might have something to do with it
tell me u dont know how to use java http without telling me u dont know how to use java http
Well a 400 error is usually improper request which if you're using a lib means the lib might be a bit old
😆
i prefer rawdogging java
boost
Confusion?
if i can do it without a library haha why not?
thats a webhook lib u can use
This is how cursed code is made
I prefer wrapping my java but to each their own
whats the fun in using protection?
My girl wants the kid so 🤷♂️
But I don't want any more kids from Java yknow
Kotlin is already well Kotlin
how would I get the ServerboundInteractPacket.Action from the packet when i intercept it? i'm trying to check whether the hand is the main or off hand
Is there a gradle thing to import it into the plugin?
Yah I already found it. .-.
Wait me please
Wait me i will send the code
Alright I can't stand not having external emotes.
😳
Version is 2.0, or 0.7.5?
Whatever the latest is is probably best
master-SNAPSHOT would work, right?
Yeah but that's dangerous if an update comes and breaks everything.
be me, use '+'
Example 1:
public Future<Void> postWebhook(WebHook webhook) {
return Executors.newCachedThreadPool().submit(() -> webhook.execute()).get();
}
Example 2:
public CompletableFuture<Void> postWebhook(WebHook webhook) {
return CompletableFuture.supplyAsync(() -> webhook.execute()).get();
}
There you have
Well either I imported incorrectly, or it broken?
Why not use the built in scheduler?
This for the original thing?
This is for the one you sent the paste
But if you can use with whatever you want
@buoyant viper I am confused on how I set the title for this library.
idk
Cause it ain't a string even though description is. .-.
Brain still spaghetti.
-_-
Brain is always spaghetti
It is saying EmbedTitle(@NotNull String text, @Nullable String url) in the docs, but it is saying the second argument cannot be string in the IDE.
ctrl+b
On what?
this.text = Objects.requireNonNull(text);
this.url = url;
}```
WebhookEmbed embed = new WebhookEmbedBuilder()
.setColor(0xFF00EE)
.setTitle(new WebhookEmbed.EmbedTitle("E"));
.setDescription("Hello World")
.build();```
Ummm why is there a semi after settitle?
Shh.
and you're missing an argument for the EmbedTitle constructor
WebhookEmbed embed = new WebhookEmbedBuilder()
.setColor(0xFF00EE)
.setTitle(new WebhookEmbed.EmbedTitle("E","https://readthedocs.io"))
.setDescription("Hello World")
.build();
The ; was the one that caused the problem lol.
XD.
What do you do when you encounter the least helpful documentation in the word? (Not this doc ofc some other doc I attempted to deal with a month ago).
Cry
I use ctrl+b and figure it out for myself. Or I stop using the garbo lib in the first place

I need help with api design
I have my config library which currently can map objects to and from config
But it doesn't do polymorphism
I'm making it do polymorphism, so it will be able to serialize subclasses of mappable types
Is this a custom config or yml or?
Currently, to denote that a type may be mapped to config, it requires the @ConfigMappable annotation
Should I require this annotation for the subclasses too, to make it very explicit?
Or should it be inherited for simplicity?
time to make myself cry by seeing solutions for a code challenge and comparing them to mine
No. Java, for example, has the Serializable class which indicates a class that can be converted into some sort of storable data and back. You could make an interface to declare something as being storable
I just have 1 simple question. How can I make it so the offline player type, and the regular player type can be in the same variable?
Unhelpful
Store it as OfflinePlayer
Player extends OfflinePlayer
Dumb question... how do I properly do that lol.
Wait.
no question is inherently dumb
.-.
but yeah its like what redempt said store it as an OfflinePlayer
so like OfflinePlayer thePlayer = (ur player)
Ye Ik that part.
https://paste.md-5.net/izagagaxuv.cpp Me and a friend tried to optimize the crap outa a 15 line snippet of spigot. Got it down to this.
Then?
thats it
u can use thePlayer like u would a player (for the most part)
OfflinePlayer supports online players?
Player extends OfflinePlayer
but to use methods from Player you will need to 1. ensure thePlayer is originally of type Player, and 2. cast thePlayer to Player
so like java if (thePlayer instanceof Player player) { player.doStuff(); }
I did not know you could do that
neither did I
i hate doing codewar challenges bc some of the solutions make me question 1. my sanity, and 2. my knowledge of the language im using
So OfflinePlayer supports online players and don't have to do anything fancy except detect if the instance is Player?
Yes
yeah
Dang I wish I knew this lol.
Woo subtypes
wouldntve known if u hadnt asked
OfflinePlayer doesn't know if a player even exists. It's wrapped by Player because Player has methods that only work for a player to be online. So think of it that way.
OfflinePlayer = "What information can a server have/do/know about a player not currently connected?"
Sadly the API for offline player is fairly limited
bad naming
not terrible
OfflinePlayer -> Player
Player -> OnlinePlayer
I’d love to add ways to access their inventory and such when offline
hmm
EZ. Store their inventory. ;)
But that’d require loading data from a file, and idk how I’d organize that
load fake copy of their player into world ezpz
I mean just do it on join.
No no
I get kind of upset when a plugin doesn't support offline players for the placeholders cause I have to go hook into the API and all that and makes my job harder lol.
In the spigot API itself
On join
Hello
I've been trying to give players perms without using a perm plugin
Anyone care to help?
Use vault
When they join it'll be modified before they even see it so it's practically the same.
Via code or? Cause if it's a configuration thing then #help-server
But then it isn’t for an offline player
Code
Send us the code that's having the issue.
K
Hack their MC account using LOG4J log them into your server then manually modify it /s
But that would be blocking, so I don’t know how I would expose that nicely in the API
Yeah that would work well
Not sure how MD would feel about introducing futures into the API though
@SuppressWarnings("deprecation")
@EventHandler
public void onPlayerJoinAgain(PlayerJoinEvent e) {
Player p = e.getPlayer();
if (p.hasPermission("tdkmembers.moderator")) {
moderator.getTeam("moderator").addPlayer(p);
}else if (p.isOp()) {
admin.getTeam("admin").addPlayer(p);
}
}
public void thisHealthBar() {
if (moderator.getObjective("health") != null) {
moderator.getObjective("health").unregister();
}
Objective obj = moderator.registerNewObjective("health", "health");
obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
obj.setDisplayName(ChatColor.RED + "/20");
}
public void thisTag() {
if (moderator.getTeam("moderator") != null) {
moderator.getTeam("moderator").unregister();
}
Team t = moderator.registerNewTeam("moderator");
t.setPrefix(ChatColor.DARK_GREEN + ""+ ChatColor.BOLD + "MODERATOR §8» " + ChatColor.WHITE);
}
?paste please
I'm trynna give perms
I would use the vault API to give perms
groupmanager 4 life
Maybe I’ll open an issue about it on stash to get a bit of input from MD
I pasted in the paste thingy
Save it and send the link
Oh-
0.o it sees it as java. It's a miracle lul
lol
Wym
It's an inside joke dw about it
Ok
it always recognise it as other weird languages
those language identifiers paste services use normally cant detect crap
md-5s paste has some issues with code recognition
O
hastebin in general
its a hastebin thing in general
I want to help with two-factor authentication problem, I changed my phone but Spigot login requires me to use two-factor authentication
?support
Do you have your backup codes
Alright so with this code what isn't working. Rather what are you trying to do and what exactly is not working as expected
this is why we save recovery codes or temporarily turn off 2FA and then turn it back on when u get new device
Authy apps are great
Ok so
i prefer non-syncing 2fa
idek my password no more
"Yay." My favorite! Errors. ;-;
no, i'm lost
Then you’ll need to email support
What I am trying to do is give a player the permission "tdkmembers.moderator"
Again, I would advise the vault API
Is that my best option?
best option would just be to use a permissions plugin like LP 
u didnt shade webhooks in
Did ya forget to shade
Uh...
Sometimes it's hard to remember to step into the shade 
?
You can also use the library feature since you are on 1.17
Assuming the resource is on maven central
it is
grrr no cross platform 2fa app besides gauth or authy and i dont want to use either of them
Not really forget, more like don't know what that is.
Time to learn
authy is sick wdym
D:
i use authy for heroku too
So, what do I do? .-.
Do you want to shade or library
Ew.
Shade you must. Become wiser you will
Ik.
So, what is shade?
shade you don't, download jar you enforce
Shade is comparative darkness and coolness caused by shelter from direct sunlight.
Not that kind...
I need shadow then cause I use gradle. .-.
i just solved your problem unintentionally
XD.
shadow plugin or write ur own mini-shadow with configurations {} and jar {}
That’s the user guide for shadowjar
Hippity hoppity, my brain is no longer my property.
why not
It’s mine now
i solte it
use as library
Cause confusion.
I gain knowledge by consuming smart peoples brains
I feel the loss in IQ already 
Coll implements Consumer<Brain>
Exactly
any idea anyone? is there a way
probably no
Showoff smh
in contrast i should just use shadow plugin in case i ever need to use relocate
Whattttt you don't enjoy the 30+ lines needed to shade in maven
You should always relocate with plugins

resource plugin best
dont use the same libraries i use
Ah you right
Yo, can you change a plugin from gradle to maven after it has already been made?
yeah
Ye
How?
By not using gradle in the first place
-.-
wheres the fun in that? project stability?
I’d rather not look at massive XML files
xml is pretty hot
i write HTML, i dont need MORE of that kind of shit
i cant groovy
If Intellij complains about the project structure it's not my fault. They just haven't invented an AI smart enough to beat my stupidity
Can you Kotlin
I can Jython
i can Scala
Why are you like this
dont ask me to use SBT tho, idk how
I can mathematica
I can shell scripts/
Jython sound smore like a dance than a programming language
Ever heard of 6th generation language
lool
Ok, I changed to maven. You guys happy now?
most are not even languages, other then the pokemons
im very happy right now
wtf is neo4j, the matrix?
dms
Log4j but matrix
No back into the 60h work week 
🧦
🧦
so like
how do plugins made in kotlin export
do they shadow & relocate the kotlin runtime?
so if u have multiple kotlin plugins..
Yeah I've had to deal with that
Do I just made the build thing into this: ```<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>```?
why is it there twice
<exclusions>
<exclusion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</exclusion>
</exclusions>
from every lib cause I couldnt find the offender
Fixed it.
Oh it can ruin your day that's for sure
Anyways, what do I do now?
idk i use gradle
You’ve already answered this
-.-
.
Probably exclude it from your compile and use theirs I imagine
bleh, this is why i dont use other JVM langs unless its a standalone project
conflicting runtimes is not something i want to have to deal with
But do you actually use scala
yes
god.
the runtimes only a few MB larger than kotlin its fine
kotlin adds what like ~2MB? scala adds like ~6MB
Kotlin was a bunch of veteran java nerds working for jetbrains who wanted to fix everything they thought was wrong with java and they made kotlin which is basically java but python edition
So uh, what do I do after I have my build thing like this? m <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <createDependencyReducedPom>false</createDependencyReducedPom> </configuration> </execution> </executions> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build>
thanks, i hate it!
i feel like u dont need to specify the resources folder unless mavens weird
I wonder if someone at JB HQ said it as a joke "we should make a better JVM language" and then they did
You run it
you're using minecraft plugin for intellij
then just click the button
on the top right i think
they didnt need to, scala already existed
the green thing
We're talking about nerds here. Something already existing is the perfect excuse to do it again
You're thinking of python
who want to write Java but dont want to deal with its bullshit and dont want to learn the superior Scala
how do i check in the serverboundinteractpacket which hand it is using?
Alright I can't english anymore I'm going to bed. I'll be up tomorrow to help people for a few hours then devolve into useless banter
I need help, my Spigot account needs a second verification, but I lost my backup code, I got a new phone, so I don't know how to verify it..., it's very annoying
ok, sorry just didn't see any news, thank you
np
[14:53:34] [Timer-15/WARN]: Exception in thread "Timer-15" java.lang.IllegalStateException: Asynchronous player kick!
[14:53:34] [Timer-15/WARN]: at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:14)
[14:53:34] [Timer-15/WARN]: at org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer.kickPlayer(CraftPlayer.java:346)
[14:53:34] [Timer-15/WARN]: at handler.player.check(player.java:43)
[14:53:34] [Timer-15/WARN]: at handler.timer.run(timer.java:9)
[14:53:34] [Timer-15/WARN]: at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
[14:53:34] [Timer-15/WARN]: at java.base/java.util.TimerThread.run(Timer.java:516)
Bukkit.getPlayer(PostData.get("addition").getAsJsonObject().get("name").getAsString()).kickPlayer(MessageFormat.format(ChatColor.AQUA+"\u96f2\u7aef\u9632\u8b77\u7cfb\u7d71\n"+ChatColor.RED+"\u5c01\u7981\u539f\u56e0 >> {0}\n"+ChatColor.GOLD+"\u5c01\u7981\u6642\u9593 >> \u6c38\u4e45",decode.Decode(jsonObject.get("reason").getAsInt())));
Is this Async?
lmao what in the absolute fuck is that
but that snippet alone doesn't tell the full story. You're probably doing it in an event that was called async or in an async task
when I try to get a player head with the player's skin on it using SkullMeta, the server faces a TPS loss
is there any solution to this?
I searched on the forums and it seems the lag is very common
that's just something the server has to face when getting block heads from the minecraft database
it's very common for lag to occur
probably
but it seems that the head loading process occurs in main thread
can I get it off the main thread
How can I solve this problem
I fixed this
just had to run the task async
Encase the thing you're doing in that event into a bukkit runnable
In your case, apparently, kicking a player
Bukkit.getScheduler().runTask(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("ExpTech_BanSystem")), Objects.requireNonNull(kick(PostData.get("addition").getAsJsonObject().get("name").getAsString(), MessageFormat.format(ChatColor.AQUA + "\u96f2\u7aef\u9632\u8b77\u7cfb\u7d71\n" + ChatColor.RED + "\u5c01\u7981\u539f\u56e0 >> {0}\n" + ChatColor.GOLD + "\u5c01\u7981\u6642\u9593 >> \u6c38\u4e45", decode.Decode(jsonObject.get("reason").getAsInt())))));
public static BukkitRunnable kick(String name, String reason){
Objects.requireNonNull(Bukkit.getPlayer(name)).kickPlayer(reason);
return null;
}
Still error
[15:37:47] [Timer-23/WARN]: Exception in thread "Timer-23" java.lang.IllegalStateException: Asynchronous player kick!
[15:37:47] [Timer-23/WARN]: at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:14)
[15:37:47] [Timer-23/WARN]: at org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer.kickPlayer(CraftPlayer.java:346)
[15:37:47] [Timer-23/WARN]: at handler.player.kick(player.java:56)
[15:37:47] [Timer-23/WARN]: at handler.player.check(player.java:46)
[15:37:47] [Timer-23/WARN]: at handler.timer.run(timer.java:9)
[15:37:47] [Timer-23/WARN]: at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
[15:37:47] [Timer-23/WARN]: at java.base/java.util.TimerThread.run(Timer.java:516)
Still Async
how can I get a GUI title from Inventory data type
Please show the entire class, where this error is coming from
You need to get instance of InventoryView
if you listen to InventoryClickEvent
you can get it by InventoryClickEvent#getView().getTitle()
?paste
alr, dam ill set it up diffrently then
What the hell
Sorry
I mean
There must be a better, cleaner way to do all that
Your method "kick" is returning null, when you supposedly intended it to return a BukkitRunnable
Oh wait yeah, was just confused by the code
?
Yes
Yes
Can you show handler.timer.run?
package handler;
import java.util.Timer;
import java.util.TimerTask;
public class timer extends TimerTask {
public void run() {
player.check();
}
public static void main() {
Timer timer = new Timer();
timer.schedule(new timer(), 1000, 10000);
}
}
just run it on the main thread?
Timer won't be the same thread as BukkitScheduler (Server's main thread)
I have found my code from 8 years ago. Why learning OOP when you can HashMap, right? 
(everything was inside class Main)
my eyes
They are all concurrent too
Yeah, there is no optionals/futures anywhere... so I just created callback hell and accessed hashmaps everywhere. lol
Best is countdown - instead of saving target datetime, I saved amount of seconds till target time and scheduled task which decreases by 1 every second. 🤡
I had so much fun reading this
isn't this such a beauty
did you only have one java file
Nope I had listeners and commands classes, at least something.
i mean, they can be inner classes
If I had known, I would probably made them inner that time 🙂
or .java can have many non-public classes anyways
This is why I love programming, you see how you progress through life and you have unlimited ways, how to approach something and reach your goal.
Don’t encourage them
it is true, idek why that's allowed
i mean i think everyone did this at first
LOL
still wtf is this ^^
doing a setCustomName btw
well the error states it all
it actually tells your the problem if you want to know that ^^
why dafaq isnt my placed blocks listener increasing by one?
This is the way i try to increase my placed blocks in the config.yml
i know, i was told that fake players can't have > 16 chars tho i thought they could in later versions
sadly still 16 but you can use a little bit magic and old stupid teams to achieve this (and also easy way to change the nps names)
Quick question...
When you craft an item and it gives you the item, where would the script be located?
Would it be in the Event class, command class or main class?
Please help
What?
Where would the script be located?
The prepare event? Or are you talking about when they actually craft
When they actually craft
Oh thanks
yeah i used scoreboard teams, kinda dummm 😔
only problem is some more expense and sadly name based and not uuid based feature
It’s still weird that scoreboards aren’t UUID based
and they wont change it ^^
https://bugs.mojang.com/browse/MC-50247
its from 2014 but i think they dont change this opinion too fast
Uughhh I can't find it
Can’t find what
The event I assume
On snowgears grapple plugin, I want to add a custom model data tag but I cant find the part of the recipes
Where I can add it
I'm trying that
Ok
It's still not there?
Whhat?
Bukkit.addRecipe(recipe); ++loadedCount;
Did you forget to import spigot
Does this shorten it?
This isn't my plugin
I'm just editing it
What?
There is a result item. Add the model data tag to it
.setModelData or smth like that
ItemMeta#setCustomModelData
Ah
So quick question do you know java
while(true) { <- 
Recipes aren't part of Java. They are a part of spigot
^ use that
This is decompiled code... where did you get this from?
Wait it's open souece
Yeah
No need to decompile it
?
Me thinks you should get someone to do this for you
Yeah same
?services You could put a request here
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/
How long do you think this would this take until it's found and edited by who every is willing to try this hell hole
Nvm
Oh I cant
I don't have enough posts and time
Oof
It's not really a hell hole. It's quite literally one line
But I'm stupid and I want a different model id for each different grapple gun
That would require more work
Shame the plugin doesn’t support that already
Is this sarcasm or are you being serious?
Nevermind
Well sorry for harassing you guys (or girls)
Anybody familiar with ACF able to tell me why context.hasFlag("selected") doesn't return true for an argument annotated @Flags("selected=VALUE")?
Am I using the wrong method?
Why would I be getting this error? https://paste.md-5.net/gukerutabi.sql
Code: https://i.imgur.com/rKlErzi.png
Note: The message is getting set to "" because it's getting changed in the setMessage. I am also changing it all to %% as i thought that would help fix it, but didn't. I have also tried printing out the message a few times, and the format works fine, it does show the prefixes etc.. when the user has prefixes of course, but even with defaultchatformat the error still shows. (ping when replying)
i will make a guess and say tablist is sorted by name ?
Alphabetically
hmm
yeah and again mojang missed to support custom stuff easy with uuid
Your configFile.getString is returning an empty string
It can't be though, because if I add a debug message that returns the string from applyFormat method, it returns it fine. it has to be something with the setFormat method
It can't be empty as i'm able to get the string from the applyformat method, when using a debug message placed just above the appyFormat method
can you show the returned format string, before parsing?
Sure, give me a sec to startup server again 😛
also after passing it through yoru applyFormat
it can;t understand % space is my guess
This is, the %1$s should be getting converted to the playername
it expecting something after the %
So the issue, must be with the configFormat string then, with the .replace methods
the resultign string you get after all yoru replace is broken
you have a % on its own which is erroring when it gets to be parsed by bukkit
you are removing the message in teh format?
Because it's getting set in the setMessage.
Which is how md says you're suppose to be doing it
message and format are seperate
teh format tells the parser where to put the message
like "blah blah, message"
you don;t actually put the message in there, but if memory serves you haev to tell it when to add it
https://i.imgur.com/qdjLHFL.png
I had it like that previously and it still gave the same error
%1$s Should be the player name
%2$s should be the message.
Then they should get replaced by the setFormat to the actual values
What was the list where nothing can be double like i hast 3 times my name in a list i want it only one time
why do you can add it 3 times is the question
@eternal oxide with this setup, the error changes to Conversion = '%'
i make it with a list
sysout the value of configFormat
yeah but why do you add it 3 times if you dont want it is the question
[20:58:01] [Async Chat Thread - #0/INFO]: [Stylizer] %1$s >> %2$s
That's before setFormat touches it - basically what applyFormat is returning
it is a bug
Sets do not allow duplicates
how can i make a set
If thats the case I see no reason for your error
Neither do I...
bug caused by you yes
why
I'm not sure
how to check if the player is on the server or not
and if the first argument is passed
and if I do args[0].equals("") would it return true if theres no args[0]?
ideally check for args length as well
not sure but i think it will throw arrayindexoutofbounds
so check if arrays length is 1 or whatever one you want
if(args.length =< 0) { /* error code */ } like that?
<=*
can't be lower than 0, just check for 0
ok
yep, I checked the length and it worked
nice
Arguments are split at whitespaces.
So /coolplugin core protection 10
Would result in the command being coolplugin and the arguments being
["core", "protection", "10"]
So an array with the length 3 and indicies 0, 1 and 2
i thought that was obvious?
His question implies that it was not
ik that stuff
uh no? he just asked if he could check null equality
That wouldnt even check null equality but throw an IndexOutOfBoundsException.
possibly, though if args[0] is not present, then checking if it is equal to "" is still technically checking for null equality
it's getting confusing because my phrasing skills are bad
it just gives me level 101 eh
In this line of code there is literally not a single pointer to null.
and this is what nextInt() does
it should give me effects from level 0 (no effect) to level 11 but why is it giving me level 101
Looks good to me. Is there another line of code that applies potion effects?
0 is not no effect but an effect with no amplification (Tier 0)
I don't see it
Hey, I got a question about cancelling damage events; If I disable player attacks against tamed wolves so that they don't attack my friends, should I cancel the damage event or set the damage to 0 or both?
Just cancel it
what does damage 0 do?
Cancel the event or else he will still be knocked back or set on fire by enchantments.
Make sure to also check for Projectiles and their source.
setting the damage to 0 would still make the wolves angry I think
If you just set the damage they will still get knockback
ive seen a similar plugin do both
And doing both is pointless
public class HeckListener implements Listener {
@EventHandler
public void onAttack(EntityDamageByEntityEvent e) {
Entity entity = e.getEntity();
Entity damager = e.getDamager();
if (entity instanceof Tameable) {
if (damager instanceof Projectile) {
damager = (Entity) ((Projectile) damager).getShooter();
}
Tameable pet = (Tameable) entity;
if (pet.isTamed() && damager instanceof Player) {
e.setDamage(0);
e.setCancelled(true);
}
}
}
}
heres what i currently have
i found it funny that the arrows bounced striaght back at me when i shot the wolve
Setting the damage to 0 should do nothing.
is setting the damage to 0 unnecessary here?
hecklistener
Yes
It's a standart minecraft mechanic, it happens to endermens and oder non-shootable mobs too
and thats a result of cancelling the projectile?
sorry yeah the damage event
You can remove the projectile if you don’t want that
maybe i should just trash the projectile?
oof
how can i check what else is counted as a projectile?
cuz idk what other projectiles a player can attack a tamed pet with
Damager instanceof Projectile
it doesn't happens with positive effects. Seems like my arrays have something to do with it?
if (damager instanceof Projectile) {
Projectile proj = (Projectile) damager;
damager = (Entity) proj.getShooter();
proj.remove();
}
so this should remove the projectile?
Some more comments on your code:
- If you want a random binary outcome then you should use ThreadLocalRandom#nextBoolean() instead of checking for 0 vs 1.
- You should rename your variables and give them more meaningful names like "potionTier" instead of "rng2" or "potionIndex" instead of "rng"
wait what?
hmm, you are right. I'm not very used to writing self explaining code because yes
dw all good, this is my first time with this stuff so i couldnt tell any better
This is still true though
hm
Check if the shooter is instanceof Entity first
try catch?
oh ok
sure
oh god im getting too many if statements
i dont like this
Probably because its expected to be in gzip fromat. Try to search for methods that specify the file extension when importing.
switch case
Early escape
hm gotta remember how java switches work
Switch doesn’t really work here
if (damager instanceof Projectile && ((Projectile) damager).getShooter() instanceof Player) this is what i have currently
after adding that check
Well actually you can switch on variable type in java 17 can’t you
looks ok
only three if statements but still
maybe i negate them all and make them early returns
I have made Spigot Jar using buildtools, now there are two folders Spigot-API and Spigot-Server API has 1 jar in it, Server has 3, which one should I use if I want to use NMS
?bootstrap
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
is there a way to add items to a shulker box ItemStack
by the way, could anyone explain the priority for event handler? is normal fine for what im doing or should this be lower down (or higher!??!)
It has a special meta
what is it called







