#help-development
1 messages · Page 1927 of 1
send it in text
Drop:
AXOLOTL: true
Chance: 100
ok. thanks
thats basically against the yaml syntax
mine?]
I dont even know yaml I just got used to it
Down
A yaml validator complete with syntax highlighting and easy to understand error messages.
he forgot an er
oh that
hello
loooooo
Okay so I've tried to change a player's display name above their head using packets PLAYER_INFO,
but it seems to limit me to 16 characters at most. Is there any other way that I can use to do the same thing ?
do you know holographic displays and other hologram plugins?
just do the same thing but move them on the players head
iirc they used invisible armor stand name
Theres no way to offset the armorstand.
Or put it on the side.
Such as this.
that is iirc
i just changed
so maybe you can just look at their codes, or hook at them
iirc?
if i reminisce correctly, if i remember correctly, if i recall correctly
public static ItemStack Magicpowder;
public static void init(){
createPowder();
}
private static void createPowder(){
ItemStack powder = new ItemStack(Material.BLAZE_POWDER,1);
ItemMeta powder_meta = powder.getItemMeta();
powder_meta.setDisplayName(ChatColor.GOLD+"Magical Powder");
ArrayList<String> powder_lore = new ArrayList<>();
powder_lore.add(ChatColor.BLUE+"A part of the Magical Wand");
powder_meta.setLore(powder_lore);
powder_meta.addEnchant(Enchantment.DURABILITY,1,false);
powder_meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
powder.setItemMeta(powder_meta);
Magicpowder = powder;
ShapedRecipe powder_recipe = new ShapedRecipe(NamespacedKey.minecraft("Magic_Powder"),powder);
powder_recipe.shape("DDD",
"TBT"
,"GGG");
powder_recipe.setIngredient('D',Material.DIAMOND_BLOCK);
powder_recipe.setIngredient('G',Material.GOLD_BLOCK);
powder_recipe.setIngredient('T',Material.TOTEM_OF_UNDYING);
powder_recipe.setIngredient('B',Material.BLAZE_POWDER);
Bukkit.getServer().addRecipe(powder_recipe);
}
}```
I wrote this code but it does not shows any error and does not even work so i need help in it
?
if (!Bukkit.getPlayer("Sammu212").isUsingJavaTag()) {
Bukkit.sendMessages("Should use java tag");
}```
in that case static is normal
i dont see anything wrong with it
yah but there is no output expected
I don't think so?
Oooo
Nice
If yes, please point out what I'm wrong
where do you use the init() method
by using the creafting recipe
in the main onEnable() function
or more specific, where do you call it
but it does not show anything
why would you need the init() method instead of public that createpowder method
initialize
public final class HarryPotterWand extends JavaPlugin {
@Override
public void onEnable() {
MagicPowder.init();
}
}
This is the main class
- why dont you just remove the static magicpowder? it does literally nothing bruh, remove dead codes
ok
?learnjava alert
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.
it shows error
and i dont think i should remove it
static in create powder function
I watched a youtuber to how to create a custom recipe
and he used static there
should never do something if you dont know what does it do
?learnjava is still the best way for you to start
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.
instead of some random youtube videos
You need to call it when the plugin starts onEnable() at the mail class
but without static it shows error
?paste
?stacktraces
call what?
?stacktrace
the init method
i did
yep
i call the init method in the main class
why dont just call the createpowder since the start
?learnjava is the best option for you right now
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.
Just add stuff at the createRecipe(Material material, String name)
its for method?
So you can just pass stuff to it and not have to create new methods.
Static method can't call non-static, I do know it, but vice versa is okay
he should learn java, but you should start learning english 😂 (just a joke, dont take it seriously)
Bruh I can't remove the static if i do it will show errors
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.
?learnjava
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.
ok
is decompiling a plugins
is illegal ?
no
No
but decompiling and redistributing as your own is illegal
Is there an event that listens only for block interactions (Similar to PlayerInteractEvent but doesn't fire on player dropping items)
just check if getClickedBlock() is null
ok ty
Why I am getting thos?
meanwhile
You're not implementing/extending the class?
I am in my main class
Show the whole code
?paste
Or screenshot the top one
I don’t think getJavaPlugin is a method anywhere
So you can’t override it
getjavaplugin is not a member of javaplugin ig
I am using this to get Axolotl but how to get color?
Cast the entity to axolotl
ok then how to get BLUE_AXOLOTL ?
Check if its an instance of an axolotle and cast it
Hey folks, I am currently trying to make RandomUHC, but some of the items that are chosen to be the item to be dropped are null
Apparently this is because some materials are blocks and not items. Is there anyway I can check if its not null? I was gonna do a while(item == null) but that didnt seem to work
whenever the item is null, it sends "Item entity 4820 has no item?!" in the console
this was removed in version 1.11, however I am using 1.8
I am using 1.8 there's the issue
oh does 1.11 make it so its only materials?
Isn’t there Material#isItem and isBlock
isBlock exists, but not isItem
oh yea
Is there a way to have all the players in different Team 1 rank 1 team and make it so all the players see eachothers teams ?
What are you trying to do
Make custom names above player's head.
I mean its for nugget
not in 1.8
Ooooh, sorry.
But its answered so nvm
I mean I've tried using Packets PLAYER_INFO to make custom player names, but it doesn't seem to be working.
@sharp flare im making randomuhc for a server, but some of the items that are random return null
for some reason
I just told you to use isBlock
i know @young knoll I was just explaining the situation
Whats a random uhc
UHC but blocks drop random items
Oh
@young knoll thanks for the quick help, but how would I loop it until I get something that isn't null?
Skip if its null
How to get entity from EntityDeathEvent?
Entity not EntityType
Do an if condition
What will be the code?
Use a do while loop
if(event.getEntity instanceof Player or what entity) then cast
oh thanks
i forgot those existed
You can do a for loop if you can acess the size of the array, just an option
if using a recent java version, you can immediately cast:
if (event.getEntity() instanceof Player player) {}
Java 14 and above
If he is using language level 14 above then yes
I still need help.
(event.getEntity() == Axolotl.Variant.BLUE) not working
I just want to check if event entity is blue Axolot
No
Check if it’s an axolotl
Then cast the entity to an axolotl and check the variant
Wtf
spam
Somehow many got summoned again
well this decided to make an infinite loop
Yeah, you never re-assign material
am I supposed to do it with item and newItem?
Well, given your current condition, it will never be false
Material material;
do {
assign material
while (material.isBlock)
while (!material.isBlock()), but you never change material
I don't really know what you're trying to do, but yeah, infinite loop inevitable there
Ugly pseudo code but you get the idea
I sorta realize what im supposed to do. item and newItem are itemStacks, which dont have isBlock, so do I assign item and newItem to ItemStack inside the do {}?
Well, if you want your loop to terminate, either material has to be re-assigned so that the condition can eventually become false and break your loop, you have to write a break statement, or you have to change your condition
thats what im trying to do rn xd
code pls😶
I can't get it
Welp more ugly pseudo code time
While loops are an incredibly dangerous game.
if (entitytype == axolotl) {
Axolotl axolotl = event.getEntity
if (axolotl.check color or whatever) {
Do stuff
}
}
well it isnt null
oh
but the error I get is "Item entity 1428 has no item?!"
oh I just realized an easy fix
I tried everything i could and came into a conclusion that my code is working but for some reason it shows my plugin as disabled
Check startup logs
var containsJS = false
val manager = ScriptEngineManager()
manager.engineFactories.forEach {
if(it.engineName == "js") {
containsJS = true
}
}
if(containsJS) {
val en = try {
manager.getEngineByExtension("js")
} catch (e: Exception) {
null
}
if(en == null) {
Main.INSTANCE.logger.severe("JS Engine is null, some features will not work!")
} else {
val factory = en.factory
Assert.assertNotNull("ScriptEngineManager failed to find JavaScript engine", factory)
engine = factory.scriptEngine
}
}
```So um.... it appears as if `en` is null (error is at `val factory = en.factory`), how is it null exactly?
👀
Like, did kotlin just forget what if statements are?
how to hide player bossbar using packets?
older version
ohk, well i guess you'd need either protocollib or attach to the packet pipeline using netty (idk if netty is the lib)
and you'd need access to the various packets, so you need to include the server jar rather than the API
Placeholder api?
and then if you just wanna perma hide it just block the packet
You mean protocollib?
https://wiki.vg/Protocol#Boss_Bar i found something like this
you need NMS classes
include the jar of the server you are targeting as the API
then catch the packet
then loop it until it reaches the last index
if(material != null){
//statement
}
Hello, I had a problem while coding a simple plugin
First picture : main class
Second picture : Stores x, y, z value when player runs a command "/asetlocation [x] [y] [z]"
Third picture : Prints out x, y ,z values (Just to test the code, this will be replaced with a code that spawns anvil randomly later on)
The problem : When I store x, y, z value with "/setlocation" command and run the "/xyz" command to print out the value of x, y, z , the value is always 0 (no matter what value I set before)
Can anyone help me?
okay
so
lemme tell you
all classes start with an uppercase
the values should be stored in static variables in main
and not the command
creating a new instance of command won't have the same values
and encapsulation pls
public class Main extends JavaPlugin {
public static double x, y, z;
@Override
public void onEnable() {
getCommand("xyz").setExecutor(new XYZTest());
getCommand("setlocation").setExecutor(new SetLocation());
}
}
thats main
?main
why are u making 2 different objects and accessing the instance variable on the other commandexecutor class
they don't need to be static
public class SetLocation implements CommandExecutor {
@Override
public void onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
if(sender instanceof Player && args.length >= 3) {
Main.x = Double.parseDouble(args[0]);
Main.y = Double.parseDouble(args[1]);
Main.z = Double.parseDouble(args[2]);
}
return true;
}
}
i prefer static imo
goodluck with that
static isn't great to always use
oh so do I have to create variables in the main class?
public class XYZTest implements CommandExecutor {
@Override
public void onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(Main.x + "");
player.sendMessage(Main.y + "");
player.sendMessage(Main.z + "");
}
return true;
}
}
maybe learn java first
you can create them in any class, however using the new Class() will reset those values as you create a new instance and not use the old instance
it won't reset
it will just not point to those, it will point to the ones in the new class
I started like a week ago still a long way though
which are 0 0 0
i worded it to make sense for them
fair
makurman
k
who's asking the question ?
makurman
however based on this i tought you where talking to me
yeah cuz static is not a better approach on that
well i mean in this case its better than making 6 new methods
then you're not doing OOP
what's the other method other than using static?
ig
private variables with static methods, or private variables, public methods accessed trough static instance
whats wrong with doing 6 methods if it can be reused?
Because its just extra code that's not needed
and properly encapsulated
well ig you'd do it if you want to manage when you can get/set variables and have events for that or smt
you an always do local variables on a single command executor class
i use methods when i gotta do some calculations before getting
like
getRemainingXP(Player player), that's a method
however if i want like
playerCount that's static
so the reason that the values of variables reset is because I created a new instance right?
Yeah don't know their plugin's name so i named it main
yes
yes and its blank one
well they don't reset, in the old instance they are still there
in the new one they are reset
then use 1 class
ah I got it thanks
really, 1 class?
or getter or setters if you prefer to access the instance variables
I use INSTANCE to pass in methods that require a plugin instance, otherwise everything's static
👀
that's just how i prefer to work, not saying getters/setters are bad
static abuse is bad though, like it is purely bad practice to do
what's so bad about static abuse?
there nothing bad about static abuse but if there is a better approach in an OOP way better use it in your own advantage
I mean stuffs can be static if it belong to that class only
Yeah generally i go
Shared? Static
Instance? private with getters and setters
Tho say a class that can be instanced has a value that never changes i'll generally change it to public static final
1 more question, do I have to use static if I use getter method?
and leave the other variables with getters/setters
if you are accessing trough instance, no, otherwise yes
if your variable is static your getter/setters have to be, vice versa
well, there's an exception, a static variable can be accessed by non static methods
yeah but i don't see a usecase where that would really be applicable
setting instance of the main class
public class YourPluginName extends JavaPlugin {
public static YourPluginName INSTANCE;
@Override
public void onEnable() {
INSTANCE = this;
}
}
thats for passing plugin instance, command executor is a different thing
well yeah
https://pastebin.com/DrxdssjF
I did the coding but it shows the plugin for disabled IDK why
thats not a getter setter thats just declaring the variable
also, generally variables aint stored in the command unless they are really specific
im talking about getter setters
and it doesn't mean your gonna use static everywhere
the whole plugin is disabled?
it should give you an error message on startup
yes when i type /pl it shows this plugin in red color
man use getters and setters
show us the console error
i did not edited it is the same at default
just show us the error
there is no error
there will be if it is red
impossible
Send the log in pastebin
?paste
thats not the console error
no your server log
its the compile log
not the maven log
send the one when your server starts up
please format your code
bad namespaced key
ShapedRecipe powder_recipe = new ShapedRecipe(NamespacedKey.minecraft("Magic_Powder"),powder);
i dont think you can use underscores
ohh
namespaced keys are always lowercase
pastebin error
?
^
your own api?
just from my plugin
I ditched making shaped recipe, made a different one and crafting them through a multiblock
ohh
having a bad time with prepareCraftItem event and craftitemevent (buggy), so I made my own crafting one
thats a unique way of making shaped recipes
yes specially custom recipes, made mine support stacked item recipes
thats very awesome
any news sammu
@dark arrow
yes?
nope still not working
show code
I will create a new project and do everything as i was told and try it if it did'nt work then I will become sad
i named is "magicpowder"
wait i am trying it for one last tile then i will show the code cuz i think its a version error
ok
this is a plugin instance
I already sent you an screenshot, did u even check it xD
the class which extends javaplugin*
its smol
I mean he can click it
¯\_(ツ)_/¯
yah i did and i tried it also
he just needs to pass his plugins instance, assign a key
I'm not familiar in the way he is making his namespaced keys
@dark arrow can you show a screenshot or paste your whoke code here?
ok
when pasting do it like java CODE
ok
whenever i need to check if an user is able to create a home (he hasnt reached the max amount of homes he can have) do i need to get the count of all homes he has in the database and compare it or is there a better way?
you can try pdc
Pdc
bruh thats stupid im doing db stuff i need to get the amount of homes he already has
config file would be an option, but I don't think that it is as effective tho
so which are saved on db
mySql?
smh whats going on here
wdym
aare u saving them to mySQL or SQLite?
i asked do i need to get the count of all homes he has in the database and compare it or is there a better way?
h2
its just SQL that doesnt matter
public class MagicalPowder {
HarryPotterWand2 plugin;
public MagicalPowder(HarryPotterWand2 plugin) {
this.plugin = plugin;
}
public static ItemStack Magicpowder;
public static void createPowder(){
ItemStack powder = new ItemStack(Material.BLAZE_POWDER,1);
ItemMeta powder_meta = powder.getItemMeta();
powder_meta.setDisplayName(ChatColor.GOLD+"Magical Powder");
ArrayList<String> powder_lore = new ArrayList<>();
powder_lore.add(ChatColor.BLUE+"A part of the Magical Wand");
powder_meta.setLore(powder_lore);
powder_meta.addEnchant(Enchantment.DURABILITY,1,false);
powder_meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
powder.setItemMeta(powder_meta);
Magicpowder = powder;
ShapedRecipe powder_recipe = new ShapedRecipe(NamespacedKey.minecraft("magicpowder"),powder);
powder_recipe.shape("DDD",
"TBT"
,"GGG");
powder_recipe.setIngredient('D',Material.DIAMOND_BLOCK);
powder_recipe.setIngredient('G',Material.GOLD_BLOCK);
powder_recipe.setIngredient('T',Material.TOTEM_OF_UNDYING);
powder_recipe.setIngredient('B',Material.BLAZE_POWDER);
Bukkit.getServer().addRecipe(powder_recipe);
System.out.println(powder_recipe);
}
}
i thinking loading all player homes whenever that player joins is the best idea as they dont have many (~5 max)
sorry for the delay
or at #onEnable()
make a runnable
there wouldnt be players online in onEnable
public void onEnable() {
// Plugin startup logic
MagicalPowder.createPowder();
}```main class
you can get the values to a hashmap
retrieve data from SQL then to a hashmap
Map<UUID, Integer>
you can go for events but if I were to do it, a runnnable would do it
why would you do events?
you mentioned when the player joins?
ah that way
you can save it to a yml file if u want, there are a lot of options
or do it json, still learning json btw so can't elaborate that
Thanks To All of you who helped me FN and rock
My Code finally worked After few hours of finding error it worked
and i am about to cry
great news
after fixing the version error and the namespaced key error it worked
goodluck with your plugin 🙂
thx 🙂
please format them and avoid using statics when possible 🙂
?paste the error
yeah no i just wanted to say it because i am pullin my hair out
i put some code behind roughly 3 if statements that check for null/possible exceptions, commented out the code, rebuilt and its still, throwing a NPE at the same line
then its something else, show your code
var containsJS = false
val manager = ScriptEngineManager()
manager.engineFactories.forEach {
if(it.engineName == "js") {
containsJS = true
}
}
if(containsJS) {
val en = try {
manager.getEngineByExtension("js")
} catch (e: Exception) {
null
}
if(en == null) {
LSSMP.INSTANCE.logger.severe("JS Engine is null, IF statements will not work!")
} else {
val factory = en.factory
Assert.assertNotNull("ScriptEngineManager failed to find JavaScript engine", factory)
engine = factory.scriptEngine
}
}
Tada
Tada, javascript
tada kotlin
haven't tried kotlin but it feels like lighter than java
its compiled to java bytecode
and you need the kt runtime
*jvm
yeah
what does that code even do in terms of a spigot plugin? 👀
Its used for some event handling
If statements inside an event
so like
I mean you can do plugins with kotlin
I think i know why kotlin was hated… javascript momento
just if statements?
if (%player uuid% == "someuuid") "/runsomething" else if (%player uuid% == "some other") "/dosomething" else "eeeeeeeee"
example
wth tho
or you can use world stuff
syntax is kinda beginner friendly inside kotlin
get the fucking player id from the event i'd say?
this is the whole thing
no
lol
this on elimination lets you run commands
if you want to do conditional stuff you can
its pretty neat
a custom language for config would be better tho- wait i am already making one :D
i would write code that accepts certain standards but yea..
Honestly if I was the point of writing a custom lang for configs I'd use a database
def calcViewDist() => server.playerCount > 20 ? 4 : 8;
config = [
maxViewDist = calcViewDist()
}
smt like that
i got alot of the syntax parsing already
xD
please do not use a custom config lang
Yeah
ill still make it a scripting lang
You don’t need anything fancy for mere configurations
or well its your decision but uhm i think it will be pain
i mean i have the AST for it already
well most of it, couple features are misisn
misisn*
alsooooo question
for the interpreter do i just use a VM (with custom instructions?)
Depends on what you’re doing
but like the fact remains, accessibility and simplicity is something to aim for when it comes to a configuration I’d argue for
yeah however its not constrained to configuration
it can be used for smt like skript where you have events etc
or as a standalone lang
or use the right api for it instead
I mean
There are already ton of languages
Unless this is another learning purpose project I’m to some extent against it
I mean I'd just learn how VM's work but other than that I'd say its mostly to be used for more advanced stuff than skript but less than java (if used on a server)
Believe certain plugins take advantage of JavaScript for instance
Yeah thats what it would do
Where they then use graal or quick
Thing is, if you have your own language, a lot of things become a lot harder all of a sudden
skript is not a good thing to use in a live server
I'd have a JS part where I handle souce code -> bytecode and then a custom VM to handle it
or in any Server
agreed
To some extent Skript can be fine
its broken af
I mean skript gives joy to other server owners out there trying out stuffs
Kotlin scripts 👉 👉
did i just read skript?
yep
sounds like you need a record
in database its a record so i guess yea
I meant java record class
iirc sadly 16+
:C
But it’s very nice having sophisticated hashCode, equals and toString methods
its 14
Also iirc they use some sort of lambda meta factory alike thing to make it fast as fuck
Oh
14 and non preview?
idk it just says with the release of java 14 we can now use the record keyword
Oh ok
im considering to use java 16 💀
🥰
but i still dont know
16 is pretty hard to live without
why are 90% of the plugins made in java 8
Because 50% of people don't care or don't know about the QoL. The rest code 1.8 plugins
the what
Quality of life
Or they are 1.16-
oh yea
:C
Made my life so much easier
hehe makes my life much easier
def main(args) {
if(args) {
log("There are args!")
}
}
has a pretty big ast
idk how to send it
pasta bin
Because the most of servers was on java 8..?
unfortunately
How do I change the version of a minecraft plugin?
how do i set the motd?
hello, what is the event for equiping armour
motd file in the server directory
wait that was image, i mean in server.properties
use motd generator on google
k
i mean if its permanent use the server properties
whats the easiest way to check if someone has full iron armour
check the type of all of them
In Javascript we use var foo = args[0] || 100; to assign different value if not available
How do i do the same in Java
Javascript is to java as car is to carpet
Help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
It is very easy question but i dont know how to search google
If you know js just learn java
.
I learnt
I believe your looking for int
Nah
well it makes sense. java 8 will still be supported when java 17 is already dead
var foo;
if (args.length > 0) {
foo = args[0];
} else {
foo = 100;
}```
O
is it already ded 👀
Use an if statement
Or a ternary
js tho blehh
java 17 has extended support until sep 2029, java 8 has extended support until dec 2030 😄
i only used it for a bot and it was a pain to do other stuff than the tutorial
var foo = args.length > 0 ? args[0] : 100;
Anyone want to be a test dummy in a few days?
rn yes
Sorry my fault one sec
Making a randomevent plugin to simulate RS like events 😢
I meant the easiest way to find out when they get full iron
so when they get full iron, I do something
..
its a pain for me
ok
stupid drag and drop events
?
i dont understand lol
whats the easiest way
Use a listener on armorslots to look for iron
Look on spigot under inventoryGUI for codes
No newclass ironarmor or whatever
okay
no i was talking to okay
its ok
it will be fine
are you asking me?
Oh ok
Bruh
Gets all itemstacks from armor slots
Idk but you can do it specifically to just boots ect.
Idk what an array is
is there an event for equip armour
no
Whats an array
?learnjava
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.
there is a library for that
I'm basically trying to add something to a HashMap when someone gets full armour
you can use the event I've sent
what about dispenser equipping?
what about equipping armor by dragging?
what about equipping armor using right-click?
just use the event I've sent
what's this github
you have to add it yourself
you basically only have to copy those files into your projet except Main https://github.com/Arnuh/ArmorEquipEvent/tree/master/src/com/codingforcookies/armorequip
there's no repo information
and also it includes a "Main" class so I wouldn't really want to use it lol
actually I'll fork it now and make it a proper maven dependency
Oh okay
i use maven
am I stupid? the button to edit the markdown file is gone lol
resourcepack
action bar
I thought the action bar was higher
it looks lower i think because the hud on the bottom reaches to it
because u have extra health
but i think its an action bar
aaah the "editor | preview" thing is now a floating button
https://www.baeldung.com/hikaricp i dont understand where to put the private static
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("444/444 561 Defense 118/118 Mana))
like that?
alright
dont make it static
lol i did something stupid
accidentely clicked rebase
intellij isnt recognising anything
Try invalidating caches
Also you could hard revert
and/or then restore from local file cache history
easiest way is to click up the git window
and then right click the commit you wanna revert back to
then choose hard revert
you just have to correctly mark your directories
right click on src/main/java -> mark directory as -> sources root
it suggested me to use a maven build script and it kinda works again
scary
my whole project structure was gone
Kinda working = working good enough
i got two
did u copy pasta
nah
public int maxr = plugin.getConfig().getInt("max delays.value");
public static int maxe = maxr;
how do i make this static
?xy
Asking about your attempted solution rather than your actual problem
it wont work cuz plugin isnt startic
🤔
sending a code and say something is not static but you dont say the exact problem ... how do you think we will know what the problem is
so maxr cant be static because plugin isnt static
just sounds like a Zero-Java-Knowledge Problem
?static
[19:49:11 ERROR]: Error occurred while enabling VoteRestart v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "com.orang3i.voterestart.getConfig()" because "this.plugin" is null```
?staticabuse
i get this error
?abuse
owh
send your code
ok
?paste I suppose
?tas
?tryit
Maybe one day Wyvern will have a command work
?tryandsee

Oh yeddddd
Today is not that day
lmao
since when does this exist 😄
I added it a month ago or sth
?tas
you added it ? .... so your coding this bot ?
ands
oh
?askgoodquestion
x)
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
I wonder if they will work if i use md syntax
wrong
But it looks like it isn’t
pretty sure it parses the raw content wyvern
?tryandsee
HE DID IT 

?tryandsee
:pog:
intelij
ok
then resend
okk
oh god i've never seen something like that
We need /commands
ye
Prefixes are so last year
Agreed
well I'd certainly have implemented this if md5 would allow a new bot to enter the stage
Did ya ask him
i dont even know how to implements slash command in jda 🤷
upsertCommand
I've done it in node
?paste
?dmca
An unofficial explanation of the DMCA can be found here: https://www.spigotmc.org/wiki/unofficial-explanation-about-the-dmca/
reformatted
dmca is a fucked up thing i guess
Hi, i wanna send a message to a player. I wanna use Components for Compatibility and the option to create Keybinds, etc. The problem is, i wanna use the JSOn used by the Tellraw Command, like /tellraw @p ["",{"text":"[","color":"#F5A300"},{"text":"MVP","color":"gold"},{"text":"++","color":"red"},{"text":"]","color":"gold"}]. Thats possible through ComponentSerializer.parse(param); seemingly. But some, lets call him idiot, decided to name The md_5.bungee.chat.api.thing the EXACT same as the net.kyori.adventure.thing. Now, the parser uses the Bungee thing wich is deprecated. Is there any way using the RIGHT component? The Internet cant help, because you CANT TELL THEM APART
Import the right one?
Bruh thanks, i was to stupid to try.
That doesnt work!
It's abstract
why would it not be an event?
You can't listen to it
It should given how java works
is there a general event for it
InventoryClickEvent
The Kyori has no Parser
yeah but that does not have inventorydragevent
It does not have the handlelist, at least they should be if bukkit made it an abstract
Is the issue that you can't import the right one?
Click event covers all clicks
But it still extends event, so it is an event by my books - whether you can listen to it is another story
I have never needed to use the drag event
i need to update the inventory whenever any interaction is made
Use without importing net.kyori.adventure.thing.ComponentSerializer.parse(param);
Why would you need to use the kyori one anyways?
Ill try again, thanks
If it wont work i can suggest hard coded way with reflection
or like you can just.. not use paper
hm?
Well, paper is kinda good, but i think you should write plugin that Spigot core will support it
Well with adventure-plattform-bukkit you can use adventure + craftbukkit
Be careful! There is an imposter among us!
Something with Player Skin modifying, i dont remember exactly, has been some months prior
There is nothing wrong with using paper to be honest
no yeah the server should run thge server on paper or smth else not spigot it takes a lot of time for spigot servers to start but making the plugin part you should use spigot
if you're making a plugin spigot is probably the safest way to go since it will support paper servers aswell
e.getPlayer().giveExp(int);
And then multiply that by 100 or so. There is a diff
But given the fact that they are asking a paper-exclusive feature in spigot, imposter right there
Again, adventure-plattform-bukkit
anyways not the point
that does not apply mending :)
But i dont think hes gonna shade it
@fierce quail is it fixed?
But you absolutely can, so not paper-exclusive
No
paper-related
I just need /tellraw @p ["",{"text":"[","color":"#F5A300"},{"text":"MVP","color":"gold"},{"text":"++","color":"red"},{"text":"]","color":"gold"}] as a component
well, adventure wasn't in paper until revently, so not really paper-related
uh Component.text()
It is more sponge related than paper related iirc
maybe just guessing
TextComponent component = new TextComponent(message);
net.md_5.bungee.api.chat.ClickEvent nextPageClickEvent = new net.md_5.bungee.api.chat.ClickEvent(net.md_5.bungee.api.chat.ClickEvent.Action.RUN_COMMAND, "/tellraw @p ["",{"text":"[","color":"#F5A300"},{"text":"MVP","color":"gold"},{"text":"++","color":"red"},{"text":"]","color":"gold"}]"));
idk what type of component you need so
still kinda doesnt justify the pain it gives
can you just explain what you are trying to do
not making a component
but what is the goal of yours
I want a Function that turns this Json ["",{"text":"[","color":"#F5A300"},{"text":"MVP","color":"gold"},{"text":"++","color":"red"},{"text":"]","color":"gold"}] into a net.kyori.adventure.Component
but why?
Not painfull at all
MethodHandle handle = this.givePlayerExperienceApplyMendingHandle;
if (handle == null) {
// Spigot
p.getWorld().spawn(p.getLocation(), ExperienceOrb.class).setExperience(amount);
} else {
// Paper
try {
handle.bindTo(p).invoke(amount, true);
} catch (Throwable t) {
throw new IllegalStateException("Unable to invoke method", t);
}
}
why do you need that component
Because reasons
I want my compemnnt to be readable and storable in a datavbase
can you convert a component.text to a string
this is completely unrelated mind you
cant you just like store it as a string
How?
How are components and keybinds related at all
I really need to learn method handles
Are those the things that make Reflection not be terribly slow
MiniMessage, https://wiki.phoenix616.dev/library:minedown:syntax and co are the easy answers for that
I think so at least
Solved
How did you do it?
orange
not inherently
but for instance when you use lambda meta factory to wrap the method handle to a callsite you can get a sam instance which translates to that the bytecode instruction is gonna be invokedynamic which is fast
Dear god that sentence hurts

😶🤌🤌
yeah, well anyhow iirc reflection was particularly slow, not due to simply invocation but it had to go through a lot before the actual invocation
(which ofc cannot be cached manageably )
dont make a private field public thats what i think 
hm
ye
well reflection is quite interesting in that aspect, I believe it simply has some boolean flag it overrides if you use setAccessible (given some other criteria also such as security with modules for instance)
I turned this into a proper maven artifact now https://github.com/JEFF-Media-GbR/ArmorEquipEvent
Is there a way I can get the goal / path of an entity?
Is there a event that's fired if a such thing exists?
I dont think so
there's EntityTargetevent
and EntityTargetLivingEntityEvent
e.g. when a zombie decides to kill you, both get called
an EntityGoalChangeEvent would be called just so often (thus its non existence)
i wanted to create an user on the database in the PlayerAsyncPreLoadEvent but it seems that it doesnt have a getPlayer method
there's no player object yet
all you have is the ip address, a login result, a name and UUID
someone told me to do player stuff on prelogin but i think that they meant i should do stuff with the uuid instead
you can ALWAYS get an offlineplayer from an UUID but getName will return null if the player has never joined before
well yea i just realised that i only need an uuid
but i was checking Player#hasPlayerBefore which doesnt work now
whats the difference? ie a pig targetting grass to consume?
but in the PlayerLoginEvent there is a getPlayer, is that the stage that the player gets the "loggin in and loading world" on its screen?
I have no idea 😛
probably yes
here's a list of target reasons
im wondering how big servers do stuff
what stuff lol
I worked for a server with 300-500 consecutive players
well how did you do stuff
handling the first join of a player cant be done in the AsyncPlayerPreLoginEvent bcs there is no getPlayer but in the playerjoin event there is so im wondering when to create a new user
mostly I just coded something and then the owner became upset I didn't tell the other devs about it
I mean
Sounds fun... 
You can check firstjoin yourself
If the user is already in the database it isn't a first join
why would you ever need a player object? you should always refer to players only, any opnly by UUID in databases etc
to check if Player#hasPlayedBefore but yea maybe checking on the db itself is a better idea
the other devs were a joke. one of them was a genius but he always needed 6 months for a plugin because he always structured everything like a real enterprise project. then some other devs were total jokes and needed 2 months+ for a simple minigame. So I just minded my own business there until I got banned lmao

you will probably have some statistics table anyway. just check if COUNT(uuid) == 1 WHERE uuid = ?
I've always kinda wondered why it took Hypixel's devs so long to make minigames
well they have to use 1.8 lol. I wouldn't be very motivated too
True...
just grab the offline player from the UUID and see if they exist
so checking in the async pre login event is the best?
also hypixel sucks. only spam and annoying children
if you need information that early, yes
if not, I'd just do it in playerjoinevent
I play bedwars to win against the annoying children, it's great.
Out of curiosity, what host do you use for your stuff? Looking to setup a Maven repo of my own but I just can't find any decent host lol
i just want to load the player quickly so he isnt ingame and not fully loaded
I've so many projects I want to setup a Maven for but just haven't been able to
I hijacked md's Jenkins and Maven for one of my plugins 
its loading the kingdom profile of the player and after that, chatchannels where the player is in so i dunno when to do that
The lazy way of doing it is to use maven-ftp-wagon (I think it is called like that) to deploy to a webserver via ftp that's how I do it at least
Okay, it's just ftp-wagon, so close enough
I got a dedicated server running proxmox. the repository itself is just nexus in a docker container in my docker VM 🙂
Ah just your own server in your own residence or whatever?
nexus is by far the best if you wanna host a repository. it also supports a ton of repos, maven, apt, ...
nope it's a server from Hetzner
Ah oki
Find your reliable dream server, optimized for high capacity use, ever-growing storage needs or rapid and parallel processing.
I need to find something that isn't DigitalOcean because their shit's expensive for very basic hardware
where are you from?
Canada
oh okay I have no idea about hosting companies in NA 😄
OVH?
well Hetzner also has servers in NA, but only virtual servers
If you have the patience for their panel to load anyways.
Never really looked at OVH tbh, probably fine
Oh yeah they're not bad at all
Iirc they also have Canada options
Yeah OVH is Canadian aren't they?
🤷♂️ could be
I think they're french
They are french iirc
Oh, yeah, DigitalOcean is Québec based I believe
but canada is just the weird uncle of france, soooo
But eh, same thing
I'll take that as a no
Just google it lol
this are Hetzner's prices (for virtual servers ofc). 1€ = 1.43 canada money
That looks similar to what OVH is offering