#help-development
1 messages ยท Page 944 of 1
There are quite a few better approaches
any of them?
to be clear if you know to get a class by string then the class already existed
if that is the case there is no reason you can't get that via other means
like just having an enum that describes your different classes and checking if the input matches an enum
then just redirecting to that class
https://www.spigotmc.org/threads/how-to-handle-custom-items.593039/
This covers some of them.
Honestly this guide is a bit outdated and i should rewrite it.
I'd say you can go read my pseudo-scripting language for elitemobs but it may be too much
but basically it's a whole scripting language that does not use any kind of reflections, the only reflections I use are to initialize complex config file structures
(well, at least directly in that codebase)
i would actually love to look how you done that if u dont mind sharing ;d
ayy got the suggestions system working
hm I think I might be able to streamline it a bit more
but I'll do that later
is BSON a efficient way to save data?
I want to save a long list of Locations and I don't want it to take up a huge amount of space
no flat file storage is efficient data storage unless you encode it yourself.
How much are we speaking?
hundreds probably
explain what you are doing and we can probably suggest a better way
sure, I want to make like customs plants, so I want to save the locations
farming palnts
tells me nothing
Use the PersistentDataContainer of the chunk they are in.
Listen to ChunkLoadEvent and ChunkUnloadEvent to load/save the plants from PDC back into memory.
just storing plant locations is not the right way to do it
Soooo. Smoll question. Is there a way to know a food items value and saturation? There's no FoodMeta.
oh that's smart
I usually only think about persistent data with entities
Thank god there isn't given that is about to absolutely get rekt in 1.20.5 
Fair.
But so is most meta stuff
Fair too 
Tell me the ETA for 1.20.5 now. I want it.
Can't wait to recode everything. 
md will probably make sure to keep compatability back to 1.7
cannot wait for the item_name component to confuse the shit out of every one
might be a nice time to drop all old support
Not for any of my nms stuff
Oh yeah. With adventure it will be a treat. bungee components, nbt tag components, item components, text components.
what do you know we dont
has mojank been in contact with payper 
if(isBelow("1.20.5") {
exec("rm -rf /");
throw new UnsupportedRubbishException("Try again");
}
lol
no windows support? ๐ฆ
is chunk#getX in the center of the chunk or a corner
corner
Its an integer number. Its the x position of the chunk in the chunk grid. Neither a center, nor a corner.
kinda. If you use it for anythign it will translate to a corner
I think ElgarL is thinking about Locations? Maybe?
in relation to, yes
ohhh i think I understand it now
thanks, both
make smuch more sense, yeah
Relative block coords within a chunk (from the top)
Chunk coordinates in the chunk grid
hello i am using gpt to code some minigame with my friends. the code working except the sponge walking thing. the game is not reacting to the walking in the sponge can you guys help me
Pastebin.pl is a website where you can store code/text online for a set period of time and share to anybody on earth
yes/no
i dont know what need to do
pretty sure you are going to have to check for sponge 1 block under the getTo location
so what i need to do
Why
they made a fun minecraft video about block staff , I wanted to make a plugin from it
bro thank you so much it worked
Hello, what is the sound commonly used when there is an error?
It sounds like a teleportation sound I don't know how to name it
I searched on the minecraft wiki but didn't find him
villager no
Nop
Not a sound from a living thing
It's like a teleportation sound
there's also enderman teleport but low pitch
Hmmm
I think Hypixel use it when you don't have enough money to buy something in bedwars
No it's not that
how about you listen to this sound with subtitles on so you will get the written name
Humm but I don't know the sound
Should I start a bedwars game to listen to it? Lol
yah , if you dont know the name, You can use the subtitle feature as it gives the name of the noises near you
Okay thanks
it sounds dumb but it may work
yo can any1 help me i tried to make a item event and it messed up my commands and command event + the item its self,is there any1 who can help
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
No one can help you if you don't provide any information
personally i take a module based approach and i make sure everything is decoupled nicely. e.g most modules should work on itself so you can turn any module on / off on the fly
Modular approach + modular design on your utilities and stuff
So for example on my skyblock core my database stuff is de-coupled
Each "module" can make its own database off the common code
yo, how can I shade a jar into my own jar and add my own package prefix to avoid class loading conflict?
I don't use maven
well what do you use
IntelliJ artifacts
pretty sure its impossible with that
I heard better things about gradle
I use maven
u can do more with gradle. but its also quite a bit more difficult
Can I DM U some screen shots of the code?
so if you never used a build system before i recommend starting with maven.
I used maven like two times
literally
built a plugin 2 times with it
continue to use maven for abit longer
long ago
theres plenty of documentation on how to shade using maven so
Spigot is based around the Maven build system. If you use Spigot, use Maven
can't I use gradle?
you can use both
why make your life more complicated?
maven is much easier and gradle is much more flexible
heh?
What kind of logic is that?
I'll learn how to use gradle
and I'll be able to keep using it
rather than learning the slow-building maven
perfect logic?! Use the simplest system.
slow? xD
Maven is not slow.
u will still be waiting for gradle to index when im already done testing
Especially not when compiling plugins for Spigot.
yo can any1 help me out im coding a custom sword thats based material is a iron sword,theres currently no recipe but theres a command and a event but when i coded the item event it stopped me being able to spawn the sword with commmand and when i got it to work for like 5 min the item event(the event it to shoot fireballs on right click) wouldnt work im pretty sure its down to the registory of the item even,command and the item itself
people who claim that maven is slow haven't properly setup their multi-module project
I saw a screenshot where the guy waitied 18m and 40 seconds for a maven build
heres some code for the item event: public class ZorroEvents extends JavaPlugin implements Listener {
@EventHandler
public void interact(PlayerInteractEvent event) {
Action eventAction = event.getAction();
Player player = event.getPlayer();
if (eventAction == Action.RIGHT_CLICK_AIR || eventAction == Action.RIGHT_CLICK_BLOCK) {
if (player.getItemInHand().getType().equals(ItemManager.zorrosword.getItemMeta())) {
player.launchProjectile(SmallFireball.class).setVelocity(player.getLocation().getDirection().multiply(1));
}
}
}
yea "a guy"
my friend uses gradle and had to wait 54 minutes
cuz his codebase is massive
My "friend" can fly too.
yes and my maven builds usually only take up to 5 min
blud is building android
they have their entire network in the same code base or sometnhg i believe
can any1 help me with my code?
he works at jartex
;ddd
half of it is just public plugins too fym
This is Gradle. It can do anything if you plug in enough stuff, but it's pretty complicated to learn how to properly use it.
this is maven. if you just wanna play some music, it's straight forward
i currently have a project with about 18k lines source code with multiple modules & shading. & it builds in 10 seconds
good enough
25k lines, about 7 ish modules all shading into each other
????
6 second build
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
using maven?
gradle
you'll go far by knowing the basics
if I need to shade shit I just copy things across
but people that have more brain cells than room temperature unlike me might do it faster
how long do u spend indexing ;dd
few secs
whenever i fork a gradle project it always seems to take so long
The IDEA minecraft dev plugin will auto setup the only gradle things you need.
yes sure, but only once
it results in a bloated build file though where 50% is useless
not for multi module
[18:59:57 WARN]: java.lang.NoSuchFieldException: modifiers
[18:59:57 WARN]: at java.base/java.lang.Class.getDeclaredField(Class.java:2610)
[18:59:57 WARN]: at hApi 1.0.jar//net.hyperiongames.hapi.command.HyperionCommandHandler.swapCommandMap(HyperionCommandHandler.java:149)
[18:59:57 WARN]: at hApi 1.0.jar//net.hyperiongames.hapi.command.HyperionCommandHandler$1.run(HyperionCommandHandler.java:51)
[18:59:57 WARN]: at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101)
[18:59:57 WARN]: at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480)
[18:59:57 WARN]: at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1470)
[18:59:57 WARN]: at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:446)
[18:59:57 WARN]: at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1379)
[18:59:57 WARN]: at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1156)
[18:59:57 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315)
[18:59:57 WARN]: at java.base/java.lang.Thread.run(Thread.java:840)```anyone know why im getting an error for modifiers?
what's -17?
sup maxim
hi
as epic said, that can't be the right class
lmao
what's line 149 ?
field class get declared for sure
yeah, why would you need to use reflection on a Field class?
also, java won't allow it
which JDK?
17
trying to get around Reflection using "modifiers" no longer works
what do i do then
what are you tryign to access?
just teh command map?
its my owqn cmd map
err
i have a way to access the command map and it doesn't require any of this
are you sure you need it?
it looks liek he's tryign to replace the whole command map
Yeah ^^
Why are you trying to replace the entire command map though ๐
custom
._.
you will remove every single other command
ok
just remove all the map's entries
if you do that you are also wiping out all bukkit/other plugin commands
it wont
^
ive used it b4
it will
Ok, explain WHY you are trying to remove all commands
okay so, a command map is a map
if you change the variable of a map everything in that old map no longer exists
you need to add to the existing command map
public final class ZorroSMP extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("plugin has been enabled");
ItemManager.init();
Objects.requireNonNull(getCommand("zorrosword")).setExecutor(new Zorrocommands());
Bukkit.getPluginManager().registerEvents(new ZorroEvents(), this);
}
@Override
public void onDisable() {
getLogger().info("plugin has been enabled");
}
}
public class Zorrocommands implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender,@NotNull Command cmd,@NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("only players can use that commmand");
return true;
}
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("zorrosword")) {
player.getInventory().addItem(ItemManager.zorrosword);
}
return true;
}
}
public class ItemManager {
public static ItemStack zorrosword;
public static void init() {
createzorrosword();
}
private static void createzorrosword() {
ItemStack item = new ItemStack(Material.IRON_SWORD, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("ยง6Zorro's lost sword");
List<String> lore = new ArrayList<>();
lore.add("ยง7This sword is a relic of");
lore.add("ยง7A ancient beast");
meta.setLore(lore);
meta.addEnchant(Enchantment.LUCK, 1, true);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(meta);
zorrosword = item;
}
}
any1 able to help?
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
plez
public class ZorroEvents extends JavaPlugin implements Listener {
@EventHandler
public void interact(PlayerInteractEvent event) {
Action eventAction = event.getAction();
Player player = event.getPlayer();
if (eventAction == Action.RIGHT_CLICK_AIR || eventAction == Action.RIGHT_CLICK_BLOCK) {
if (player.getItemInHand().getType().equals(ItemManager.zorrosword.getItemMeta())) {
player.launchProjectile(SmallFireball.class).setVelocity(player.getLocation().getDirection().multiply(1));
}
}
}
Just use the paste if it's a large class
code blocks are useful for small snippets
im not. this is a custom cmd map for my cmd api
yeah you should be appending to the bukkit one
not making ur own
ok
You cannot extend JavaPlugin like that
Your plugin should only contain one JavaPlugin class
ohhhhh
which is the "main" class
okay so what do i put instead
this kid doesnt code at all i can tell
what is the best way to store variables
That's quite common here
im new ik a bit of the basics
fr
Store how?
Got to start somewhere
keep them from being reset at restart
Pass a reference of your plugin instance through the constructor
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
save to file
What data are you storing?
should i make a json file?
answer Olivo as there are other ways depending on what data
for now just variables for my turrets
like ammo or on/off state
then pdc
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
ok @tender shard i was told that it doesnt delete all the cmds
ty
Omfg it works thanks ๐
public class ZorroEvents implements Listener {
@EventHandler
public void interact(PlayerInteractEvent event) {
Action eventAction = event.getAction();
Player player = event.getPlayer();
if (eventAction == Action.RIGHT_CLICK_AIR || eventAction == Action.RIGHT_CLICK_BLOCK) {
if (player.getItemInHand().getType().equals(ItemManager.zorrosword)) {
player.launchProjectile(SmallFireball.class).setVelocity(player.getLocation().getDirection().multiply(1));
}
}
}
}
public final class ZorroSMP extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("plugin has been enabled");
ItemManager.init();
Objects.requireNonNull(getCommand("zorrosword")).setExecutor(new Zorrocommands());
Bukkit.getPluginManager().registerEvents(new ZorroEvents(), this);
}
item event isnt working any1 know how to fix?
any1?
?paste
^^ put your code in a paste so you don't flood the chat
though looking at the earlier code a Material isn't an ItemStack so it won't work
Your IDE should be warning you about this
also follow naming conventions
?conventions
man i just spent 90 minutes trying to figure out why you need to save it to an itemstack just to figure out i didnt read correctly and its way easier for entites
Hey guys, I try to extend from the Zombie class and the IDE tells me I should implement it. But all the tutorials online tells me to extend. What is the right way to make a custom zombie?
cool name
Hello, I want to cover 1.9-1.20.4, but in 1.13, Sound.ENTITY_ENDERMAN_TELEPORT is Sound.ENTITY_ENDERM -> E <- N_TELEPORT, how can I support both? I already have a method to detect if it's below 1.13
valueOf and try-catch
try catch ?
why?
I've done that:java Versioning.isPost13() ? Sound.valueOf(Sound.class, "ENTITY_ENDERMAN_TELEPORT") : Sound.valueOf(Sound.class, "ENTITY_ENDERMEN_TELEPORT")
my code is good?
yes
okay thanks
idk your isPost13 method but if it works, it works
I asked because I didn't made something before that
why am i seeing the same thing twice
And I thought there was a better solution
MEN/MAN
exactly
you should cache it
they changed the name?
yeah for sure
in 1.13
smh
from men to man
Hello , i don't know how to setup the server , can someone help me?
sounds like a question for #help-server
so im using a sign to get player input, im sending the player fake packets of a fake sign block near them, and then making them open it and then getting what they wrote, however, this doesnt work when players are above build height and under bedrock, is it possible to make something similar while making it work everywhere ?
[18:44:20] [Server thread/WARN]: at java.base/java.lang.Class.getDeclaredField(Unknown Source)
[18:44:20] [Server thread/WARN]: at hApi-1.0.jar//net.hyperiongames.hapi.command.HyperionCommandHandler.swapCommandMap(HyperionCommandHandler.java:153)
[18:44:20] [Server thread/WARN]: at hApi-1.0.jar//net.hyperiongames.hapi.command.HyperionCommandHandler$1.run(HyperionCommandHandler.java:51)
[18:44:20] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftTask.run(CraftTask.java:101)
[18:44:20] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_20_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480)
[18:44:20] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1470)
[18:44:20] [Server thread/WARN]: at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:446)
[18:44:20] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1379)
[18:44:20] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1156)
[18:44:20] [Server thread/WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315)
[18:44:20] [Server thread/WARN]: at java.base/java.lang.Thread.run(Unknown Source)```still getting this from my plugin that I was talking abt earlier
explain why you need to access the Field class
Field commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
commandMapField.setAccessible(true);
Object oldCommandMap = commandMapField.get(Bukkit.getServer());
HyperionCommandMap newCommandMap = new HyperionCommandMap(Bukkit.getServer());
Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");
knownCommandsField.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(knownCommandsField, knownCommandsField.getModifiers() & -17);
knownCommandsField.set(newCommandMap, knownCommandsField.get(oldCommandMap));
commandMapField.set(Bukkit.getServer(), newCommandMap);
}```
explain why
read?
be nice?
amk what do you mean โreadโ you send a code snipped
instead of this modifier manipulation
it's just the easiest way, i'm doing it
can u show how?
i mean it's a little different to what you're doing but alright
and as you can see i have the internal map
thatsd what im trying to do
then you don't need the modifiers
i actually have it
i feel like you're struggling with reflections a bit
ye
knownCommands = knownCommandsField.get(commandMap = (CommandMap) server.getClass().getMethod("getCommandMap").invoke(server));
and you can cast
my cached field allows me to hide the cast
?xy
:D
ye
cast?
yup
so this is it, now you have access to the map
from here you can operate on the map as you please
from what i remember you said you wanted to remove all commands and add yours
no
you can do so by knownCommands.clear();
int requiredAmount = 50 if i = 10; how do I make this work I want to set requiredAmount to a certain number depending on the number of i
i can do it in two lines
but how do i do it in one line?
i == 10 ? itIs10: itIsntTen
oh then you can just do
knownCommands.put("command", command); for (String alias : aliases) { knownCommands.putIfAbsent(alias, command); }
@deep herald
uH yeah that's how I do aliases
oh and also command.register(commandMap)
ty
all im doing is swapping the cmd map with mine?
:)
well, we did these before where we extracted the commandmap and the knowncommands map
so there's no need to swap anything
you can just use what we extracted
fancy ๐
yea
It is but it's hidden
how do i un hidden the hidden of hiddens
it's a little ugly but
good luck with that
how bro
but are you trying to use the modifier to change the final?
unsafe o_o
Bro wants to replace the entire command map
Last time I did that I did use unsafe
it works on 1.8 and 1.7 fine so why cant i here
but it sounds like you'd break some plugin somewhere
It's a java 12 thing
oh
you can extract some of that as methods
Well yeah but they're specific to this command
This is acceptable imo
gamer
it is a different system, it is cool ๐
bro imma legit set my project to java 8 just to do this ๐ญ
why are you so set on 100% replacing command map
Only reason to inject in a custom command map is to listen to forced commands through dispatchCommand
everything else is achievable through the API
You are crazy if youโre still on java 7 language features
idk what to do with this tho
i need it like that
even then, i think it's much easier to just wrap every command and listen that way
int requiredAmount = 0;
var o = i == 10 ? requiredAmount : 50;
o = i == 11 ? requiredAmount : 100;
o = i == 12 ? requiredAmount : 250;
o = i == 13 ? requiredAmount : 500;
o = i == 14 ? requiredAmount : 750;
o = i == 15 ? requiredAmount : 1000;
o = i == 16 ? requiredAmount : 2500;```
I have this but requiredAmount keeps getting set to 0
Legit just go to project settings
Java language version
is this kotlin?
java
I would kill myzelf if thst was kotlin
That is disgraceful
you can prob make that shorter with an array
how also it doesn't even work so idk
I see a pattern hereโฆ
assert(i >= 10)
o = (i - 9) * 50
Wait nvm
int min = 9; // 9 = 0, 10 = 50
int[] array = {0, 50, 100, 250, 500, 750, 1000, 2500};
// clamp i between [0, arraylength]
int index = Math.max(i - min);
index = Math.min(index, array.length);
int value = array[index]
god old lookup table
hell yeah
too much work for him prob ๐ฅฑ
Or you can use a map
okay ty
Problem with a map is that if your entry is above the max bound it returns null
Unless you use a navigablemap
just so you can appreciate Kotlin; hereโs a Kotlin implementation of your code:
val o = when (i) {
10 -> 50
11 -> 100
12 -> 250
13 -> 500
14 -> 750
15 -> 1000
16 -> 2500
else -> throw IllegalArgumentException()
}
The else can early return from the method, provide a default value or throw an exception
alr
Once you get comfortable with Java I would recommend trying Kotlin honestly it really is the swiss army knife of the JVM
I mean technically thatโs achievable now in Java w switch expression pattern matching, but its a bit more verbose
return switch(value) {
case 10: 50
case 11: 100
case 12: 250
default: -1
}
sumn like this
not as bad as I remember it haha
Back in java 8 days you had to allocate the return on the stack, modify it, break from the case & return at the end
essentially you end up with (3 * cases) + 2 lines
does that need yield or is that only braces
yield p sure
or if youโre a monster you can brace the break and setting return value and narrow it down to cases + 2
is only for braces
Hey is it possible to get instance of entity projectile like arrow or xpbottle which is lanuched with BlockDispenseEvent
hey guys, need help here
What you need help with
i dont know why
eclipse dont recognize spigot lib
i already imported it
Are U using inteliji idea
eclipse
?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
Show me what the plugin.yml looks like
I need to import spigot API into ur folder
This shud show U how to do it
i need to put the spigot.jar into my project folder?
Nope emm I can't show U rn but in like 30 min I can
The main spigot-1.18**.jar** is now a bootstrap jar which contains all libraries.
You cannot directly depend on this jar.
but im using the 1.8.8 version
?1.8
Too old! (Click the link to get the exact time)
Can't help so there's good vids in yt
should work just depending the jar, shouldn't it?
i already tried ๐ฆ
For anything older than 1.18, yes
@echo basalt yo help him out ur good at coding
1.8 oh god
Ikkkkโ ๏ธโ ๏ธโ ๏ธโ ๏ธ
Sounds like I have fans
when I use the shortcut
Yes
it auto create
I'd like to start by saying I drank a couple hours ago so I might write some spaghetto code
But what's up?
pls make me huiuipicle skyblock for 9 cent
check my github and do a pr
Put the code
@Override
Public static void OnEnable
no static
@slow granite
didn't work
Given you're using eclipse gradle is icky uh
Let's start by making a new, maven project
You're missing the spigot dependency and the bootstrap jar doesn't let you import it directly
@young knoll ur gradle eclipse nerd
get yo ass in here
Hhahhahah lol
I just make the gradle project outside eclipse
๐ญ๐ญ๐ญ
Then import > existing gradle project
Oof indeed .gradel = confusion
Ideally
ok, gonna do this and try
Yes and when ur in go to the plugins tab and install Minecraft development plugin
Make sure to install the plugin Minecraft development it's really helpful
Eh
I use it
but it's not great
and triples your ram usage
Really?
I find it very useful tho
Like it has everything U need in 1 plugin it allows code alot quicker
the plugin doesnt add any plugin coding speed addition, it make sit quicker in mods for mixins
Exactly for new coders that's helpful BC we do what we're really doing,I'm new and I've been learning java for about 4-5 days and I've coded a custom mod while working on my plugin
The mod works completely fine it's the fing plugin that's confusing me I'll figure it out eventually
Meh, I copy and paste a template gradle project anyway
and you fuck up the formatting everywher
Thatโs just me not installing a Kotlin extension
no it happened on groovy too
no it happens when i read it in ij
Well then notepad++ must render them differently
@wraith dragon BTW I added code to the minigame demo wiki
hm where is my simple scoreboard thing
the goat pinged me ๐ฅ๐ฅ๐ฅ
wait ill go check it out rn
yo there are a lot of changes for the phase side but no changes for player states and tasks
good stuff dude
I kinda nuked the player state stuff
I really can't bother
I just use kits for it now :)
And have each game do its own state tracking
There's also map code on the demo
And I did make the split between "map templates" (have access to the config and expose it) and "instanced maps" (have access to their map template, as well as positional context)
any idea on why this triggers when i put on armor using right click?
@EventHandler
public void onClick(PlayerInteractEvent event){
if(event.getHand() == EquipmentSlot.OFF_HAND) return;
if (event.getAction() == Action.LEFT_CLICK_AIR){
System.out.println("This somehow triggers when I equip a helmet??");
}
}
what
Basically the event fires for each hand
If that's your exact code add more debug
Print out every variable in the event, along with the player's inventory
That's the only way to come up with conclusive evidence
hmmm, I still use the player states because they're quite easy to apply and revert
Well yeah but they're error prone
How so?
System.out.println(event.getAction().toString());
prints LEFT_CLICK_AIR
when i RIGHT CLICK a helmet to put it on
i mean it makes no sense
Applying multiple states can cause problems
I sure hope those quotes aren't there
I usually just have a "spectator kit"
As I said, every variable
Print out the hand, item in the hand, all of it
What player did it
Look for patterns
Which are just items in the kit right? Or do they do other stuff like set game modes?
Items, potion effects
You could still use a player state system but they'd need to be game-specific
I see I see
For example I have 2 game modes at this network
Pretty sure equipping armor with right click causes the swing hand animation
One's a skywars clone
Which then fires a left click event
And the other is like a fall guys type of thing
The spectator state is completely different
As one has to disable movement checks
And the other has to disable combat
Oh I see, so like if they would NOT be game-specific, and there were two spectator states
conflict
Well if they were not game specific let's say you had a spectator state
And like a uh
"hunter" state
One wipes your inventory and gives you a sword
One wipes your inventory and gives you a compass
Then you'd need a system to only be in one state at a time
But some games require multiple states
Like being a hunter but also a wizard or something
it seems just to be bugged
https://www.spigotmc.org/threads/right-click-to-equip-armor-calls-leftclick.573877/
so ill have to work around it somehow
ohhh okok I get it
But arent kits similar? They give you items and potioneffects, but you can give multiple kits to someone
The difference is that the custom logic isn't bound to the kit
And kits are configurable
They're a lot more raw
And it gives you, the developer, all the power to handle custom logic
For example
public void makeBomber(Player player) {
giveKit(player, TNTTagConstants.BOMBER_KIT);
makeGlowing(player);
registerTeam(player, bomberTeam);
}
public void makeGlowing(Player player) {
// Some other thing
}
I try to implement a Custom Zombie like this: ```java
public class CustomZombie extends Zombie {
public CustomZombie() {
super(EntityType.ZOMBIE, Bukkit.getWorld("roguelike"));
}
}
But my ide wants me to implement instead of extend. But all tutorials online are using extend
It's basically a structure that prevents wonky state behavior by reworking everything and removing states
You need to extend the nms zombie class
Not the bukkit Zombie interface
is it default or do I need to download it?
?nms
thx!
Hi, I need help making it so players canโt shift click from an inventory menu. I already have a setCancelled event but players can still shift click. Can anyone help?
Which event have you cancelled?
The inventory click event
Oh ok I get it now, instead of everything in one state you have the kit and other configurable options for the player
Interesting, I will test it later, thanks for the W minigame strucutr
i have in my config a section that is ```yaml
punishments:
triggers:
TOXICITY: ">=0.9"
SEVERE_TOXICITY: ">=0.9"
# Do we require all triggers to be met, or just one?
required_triggers: 1
# Actions to take when the triggers are met
# Placeholders:
# %player% - the player who sent the message
# %message% - the message that was sent
# %score% - the scoring of the message
actions:
remove_message: true
send: "&cYour message was removed because it was toxic."
notify: "&cMessage by %player% was removed because it was toxic. Score: %score% - Message: %message%"
- triggers:
SPAM: ">=0.9"
required_triggers: all
actions:
remove_message: true
send: "&cYour message was removed because it was spam."
notify: "&cMessage by %player% was removed because it was spam. Score: %score% - Message: %message%"
command: "mute {player} 1h"```and i cant figure out how i would iterate over every node
?nocode
Itโs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
im trying to do plugin.getConfig().getConfigurationSection("punishments"); but its null
I fixed it but Iโll keep that in mind for the future
hello, im trying to do a command which causes the minerals to cook instantly, so idk why my code burn only the coal and not the minerals, anyone can help me?
@EventHandler
public void onFurnaceBurn(FurnaceBurnEvent event) {
if (autoSmeltEnabled && event.getBlock().getState() instanceof Furnace) {
Furnace furnace = (Furnace) event.getBlock().getState();
ItemStack input = furnace.getInventory().getSmelting();
if (input != null) {
event.setBurnTime(1);
}
}
}
@EventHandler
public void onFurnaceSmelt(FurnaceSmeltEvent event) {
if (autoSmeltEnabled && event.getBlock().getState() instanceof Furnace) {
Furnace furnace = (Furnace) event.getBlock().getState();
ItemStack input = furnace.getInventory().getSmelting();
ItemStack result = event.getResult();
if (input != null && result != null && result.getType() != Material.AIR) {
Material inputType = input.getType();
if (inputType == Material.IRON_ORE) {
result.setType(Material.IRON_INGOT);
} else if (inputType == Material.GOLD_ORE) {
result.setType(Material.GOLD_INGOT);
} else if (inputType == Material.ANCIENT_DEBRIS) {
result.setType(Material.NETHERITE_INGOT);
}
furnace.getInventory().setResult(result);
}
}
}
}
have you tried to delay it by a tick?
Yo any know how to help,trying to create a namespace key = new namespace key(),idk what to put in the brackets
(pluginInstance, "keyname")
When I do that it comes up red
show code
Can I DM U
pluginInstance has to be YOUR plugin instance
is this method in your main plugin class?
Nope
you need to pass a plugin instance to it, or create yoru keys elsewhere that has access to your plugin instance
I'm new to this elaborate ๐
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Shud I change it to public
or you could use teh String, String constructor
not as safe, but useable
like new NamespacedKey("MyPluginName", "key")
all lower case
I have that and there's a red line underneath
Keeps coming up as a red line underneath
hover over and see what the error is
You should really pass in the plugin instance
Tf is the plugin instance
you have no instance for ZorroSMP
plugin instance is the instance of your plugin.
just use "zorrosmp" instead of ZorroSMP
tried that it comes up red
""
Oh
you are just typing words. it's a String so needs " "
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingโgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! ๐
You really should know some Java basics.
Thanks
such as objects
Learnign takes time. just keep going steady
Yes ik I've been doing yt tutorials and getting nowhere
zorrosword is not a material
does this look right for me to be able to shoot a fireball out og my custom item with right click
how do i make it a material
bc thats y i added namespacekey
yeah, but you never did anythign with the key
you created it but didn;t put it anywhere
oh...
You should have put it in the PDC
?pdc
mat.PI
Math. not math. but you don;t need that
thats one problem i believe i solved the rest
PI is just an example
you could put an INTEGER, 1
when i add the integer 1 it turns red
it really doesn't matter what you put as you only need to check the key exists in the PDC later
you don;t actually need to check its value
you deleted the .set(...
You should really learn what you're doing
yeah
'it goes red' you should understand why
yeah sound like a better idea than relying on ya;;
.set(key, PersistentDataType.INTEGER, 1);
Scroll up
?learniava
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingโgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! ๐
how would I go about doing this as it isn't working
String uuid = event.getPlayer().getUniqueId();```
I want to set the uuid var to the player's uuid when they join
```js
public class PlayerJoinListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
String uuid = event.getPlayer().getUniqueId();
}
}```
uh idk
What does your IDE tell you
tbh I don't think im even doing it right
delete the String keyword and see what your IDE says
UUID uuid = event.getPlayer().getUniqueId();
ah so this would get their uuid?
yes
alright I'm having trouble and I'm really trying but I can't seem to figure out how to create a yml file in my plugin folder in a playerdata folder which I'm aware probably isn't efficient I'm just learning right now so I'm trying to learn how to create them
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
ohh tysm
When i cancel PlayerDropItemEvent and when I use PlayerInteractEvent and I click Q (drop item attempt) is calling action LEFT_CLICK_AIR.
because the event fires when the left hand swings on air, which is what happens when you drop an item
FileConfiguration data = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "player_data" + File.separator + "data.yml"));
how would I make get data folder work it's not working rn what do I need to return in the metohd?
what's the issue you're facing
plugin.getDataFolder(), where plugin is a variable with your main plugin class
How to fix?
oh okay ty
whats the issue you are having
I dont think there is a way to fix it because the client is swinging the hand
I want to disallow Q from left click items.
So I want to trigger only with left click not with Q.
I think I can cache the item on drop.
what
Yeah that fixed it.
How do you get an enchantment by a string?
Because Enchantment.getByName and .getByKey are both deprecated and I'm not sure what it means by getting it via the Registry
thank you
FileConfiguration data = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "player_data.yml"));
should this be creating a file
cuz it isn't do I need to somehow generate my plugin folder if it doesn't exist and then do this?
plugin.getDataFolder().mkdirs() before maybe
can I format string to textComponent and back while maintaining color integrity (I need it for holograms)?
plugin.getDataFolder().mkdirs();
FileConfiguration data = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "player_data.yml"));```
like this?
yeah
Okay so it generated the folder tysm but it still isn't creating the file
well it wont generate anything, that code loads the file
what are you trying to do
right now I'm just trying to create a yml file for everyone who joins the server so I can save data to it later
ik its not the best idea if they join and never play again
but it's just learning right now
the file will be created when its saved with .save
were do I add that too
Can I use packages to make the item look different on F5?
This is completely dependent on the items model.
So through a resource pack you can.
Do you mean that for example you hold stick in Hand but everyone else see it as diamond?
i think i encountered a bug or something. setting the PublicBukkitValues.<whatever that is> to empty list ([]) and then trying to get the list of data containers from plugin throws The found tag instance (NBTTagList) cannot store List
use texturs
setting empty list from plugin and then read it doesn't cause issues until i restart the server
The F5 key will show you the view other players have of you.
So if you want to change the items model for this, it will be changed for everyone.
other players see a crossbow, if I send a package to the player himself, saying that he has a different item, then what will happen?
That works. But its not changing your own view in 3rd person. Only the perceptions other have of you.
i wrote a small plugin demonstrating this bug here: https://github.com/nahkd123/spigot-persistent-container-bug
Open a bug report and tag @eternal night
?jira
i got bad gateway when opening jira
Rip
gonna up the ram, newer versions are heavier it seems
is it possible to completely remove the displayname of an item so it doesn't show up when you hover over it?
"" or null just give it its normal name and "ยงr" shows a small text box when hovering over the item
unreleased 1.9.X is fire though
not that i know of
What is this?
What is the problem?
when i am opped i can place blocks in all areas but when i am not opped i can not
Is this your plugin or are you administrating?
my plugin
Itโs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
no no
my block place event is this```java
@EventHandler()
public void onBlockPlace(BlockPlaceEvent event)
{
if (event.getBlockPlaced().getLocation().getY() > 100 && !(event.getPlayer().getGameMode() == GameMode.CREATIVE))
{
event.setCancelled(true);
event.getPlayer().sendMessage("You are only allowed to placed blocks as high as 100 on Y axis!");
return;
}
if (event.getBlockPlaced().getType() == Material.TNT)
{
event.getBlockPlaced().setType(Material.AIR); // Remove the TNT block
event.getBlockPlaced().getWorld().spawn(event.getBlockPlaced().getLocation(), TNTPrimed.class); // Spawn ignited TNT
return;
}
if (event.getPlayer().getGameMode() == GameMode.SURVIVAL)
{
Location location = event.getBlock().getLocation();
gameSession.addPlacedBlocks(location);
}
}```
and i dont have any plugin like world edit or world guard
Are you sure you don't have any other BlockPlaceEvent in your plugin?
Also if there are any other plugins on the server that your plugin can work without, remove them and try again.
If the problem persists, go through every BlockPlaceEvent you have, find every event.setCancelled(true) and place some debug statement before it and see which one gets called
nope i do have a interact event? will that interfear with it?
Also it'd be good for readability to cache these variables
@EventHandler()
public void onBlockPlace(BlockPlaceEvent event)
{
Block block = event.getBlockPlaced();
Player player = event.getPlayer();
if (block.getLocation().getY() > 100 && !(player.getGameMode() == GameMode.CREATIVE))
{
event.setCancelled(true);
player.sendMessage("You are only allowed to placed blocks as high as 100 on Y axis!");
return;
}
if (block.getType() == Material.TNT)
{
block.setType(Material.AIR); // Remove the TNT block
block.getWorld().spawn(block.getLocation(), TNTPrimed.class); // Spawn ignited TNT
return;
}
if (player.getGameMode() == GameMode.SURVIVAL)
{
Location location = event.getBlock().getLocation();
gameSession.addPlacedBlocks(location);
}
}
And maybe even cache block.getLocation
I don't know, try removing it
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (event.getAction().toString().contains("RIGHT_CLICK") && event.getItem() != null)
{
if (isFireball(event.getItem()))
{
Vector direction = player.getLocation().getDirection();
player.launchProjectile(Fireball.class, direction);
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
{
return;
}
event.setCancelled(true);
ItemStack fireballItem = event.getItem();
int amount = fireballItem.getAmount();
if (amount > 1)
{
fireballItem.setAmount(amount - 1);
} else
{
player.getInventory().remove(fireballItem);
}
}
}
}
private boolean isFireball(ItemStack item)
{
if (item == null || item.getType() != Material.FIREBALL)
{
return false;
}
Material material = item.getType();
return material == Material.FIREBALL;
}```
removing it also didnt work
Do you have any other plugins on the server?
It also could be spawn protection actually, what are the coordinates of the place you were at?
If spawn-protection in your server.properties is not 0, try setting it to 0
1.8 -_-
nope
lol i am blond
Happens
GG
also how to use Location to set a block as bed?
since it has two parts
follow something like this: https://pastebin.com/A09P825q
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.
@slate surge
to get the block of the location do
Block block = location.getBlock();
umm
Is there a way to prevent feeding/sitting animals? This simply doesn't work (rmbing sits/feeds the animal)
Yes, the listener is registered and the debug message is printed
@EventHandler
fun onInteract(event: PlayerInteractAtEntityEvent) {
// Disallow sitting & feeding wolves
if (event.rightClicked !is Wolf) return
println("YOU INTERACTED WITH WOLF!?!?!?!")
event.isCancelled = true
}
u using kotlin? @icy beacon
Yes
after setting canceled to false, you can just unsit them:
if (!(w.isSitting())) {
w.setSitting(false);
}```
@icy beacon
Sitting is fine, I'm more concerned about feeding
I'd have to fetch the player's hand and give it back a tick later
This feels hacky
wouldn't cancelling the event auto matically stop it?
Surely there's a way
This simply doesn't work (rmbing sits/feeds the animal)
chatgpt wouldn't hurt
Dude please
a bed in minecraft is two blocks
I've scoured some forums
People have struggled with this same problem and did some hacky shit
pls
I'm not gonna be consulting gpt about this lmao
YamlConfiguration playerData = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "player_data.yml"));
playerData.save("player_data.yml");
why isn't this generating the file?
which api? spigot or bungee?
//Converts the location to a block as you asked for
Block bedFoot = location.getBlock();
//Accesses the second part block, since a bed is two blocks.
Block bedHead = bedFoot.getBlock().getRelative(BlockFace.SOUTH);
//Set both to material block
bedFoot.setType(Material.BED_BLOCK);
bedHead.setType(Material.BED_BLOCK);```
Try running plugin.getDataFolder().mkdirs() beforehand
so u're basically loading the file into memory and then saving it back from memory to file directly?
and this is why ai won't replace programmers
this is a bit hardcoded
because the bed can be facing any of the main cardinals
yes, but he said he wants to do this based on a location
but yes its better to work with an event
PR is open ๐
@acoustic shuttle the way i create config shit
public void loadConfig()
{
// Load the configuration file
File configFile = new File(getDataFolder(), "config.yml");
if (!configFile.exists())
{
saveResource("config.yml", false);
getLogger().info("config.yml not found, creating new one.");
}
}```
ty
how some tab plugins bypass the maximum length of 16 characters along with color encoding
and what are the best pockets to use for tab
theres a limit to tab text?
there sure as hell isnt one for me
limit has for player name but prefix and sufix this all displayName right?
or are they edited separately
oh...
yeah i just use Player.setPlayerListName()
Is it possible to somehow edit the player name tab without affecting his head in the tab?
this work in tab???
works for me
setPlayerName worked only in chat as long as I remember
the blue thing next to my head is just cuz off a mod
theres a difference between setPlayerName and setPlayerListName
setPlayerListName is for tab
lool
I've already struggled with the packages...
my entire tab name changing is this ```java
public void updatePlayerListName(Player p) {
Rank playerRank = CrystalCore.getInstance().rankManager.getPlayerRank(p);
String playerName = p.getName();
if (nicknames.containsKey(p)) {
playerName = nicknames.get(p);
}
String newPlayerName = playerRank.getPrefix() + " " + playerName;
if (CrystalCore.getInstance().vanishManager.isVanished(p)) {
newPlayerName = newPlayerName + " &6[Vanished]";
}
p.setPlayerListName(Core.color(newPlayerName));
}```
and 99% of that code is to work with the rest of my plugin
thank you you saved so much time
only relevant part of that code is p.setPlayerListName(Core.color(newPlayerName));
why this works for one player and not the other?
for (Player player : Bukkit.getServer().getOnlinePlayers())
{
sendPlayerToServer(player, "practice_lobby");
}
Bukkit.getServer().shutdown();
public static void sendPlayerToServer(Player player, String server)
{
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try
{
out.writeUTF("Connect");
out.writeUTF(server);
} catch (IOException e)
{
e.printStackTrace();
}
player.sendPluginMessage(getPlugin(), "BungeeCord", b.toByteArray());
}
if it works first try it probablt doesnt work in production
is it for me?
Did you defined a public static method inside a method ?

Is there a method that will only play the sound to one player?
Player#playSound
and what are the arguments?
declaration: package: org.bukkit.entity, interface: Player
but I need to give entity or location
I feel like an AI assistant searching for data in javadocs...
Same ;/
how do I send a particle to a player
Use Protocollib and send packets. Its faster, trust me bro.
7smile7GPT pls generate code examples that work 100%
Maybe we just need spigot GPT
Actually, isn't discord working on like, user installed apps?
how can i export my codes to another project with intellij? if this is the right channel
Honestly, with the new LLMs that have a 2M input vector and context size, you could literally give it the entirety of Spigot, Craftbukkit and SpigotAPI + javadocs
and it would be able to write code for you.
Select classes/packages -> ctrl + C -> go to other project -> ctrl + V
If thatโs what you want and not learn anything
*Or do you want to use one project as a library for your other projects?
no no
this
ty
?paste
think this would come true once lynx decides to pr spigot rewritten in bash ๐
@eternal night ETA?
What is warn manager line 44
int id = (Objects.requireNonNull(config.getConfigurationSection("warnings")).getKeys(false).size()) + 1; this
1 sec
https://paste.md-5.net/soroxukixo.java
the whole Warn manager
config.getConfigurationSection is probably null
Check that
it worked thx
but
i have a return false if args length != required args
and `usage: '/warn [player] [reason]'
in plugin.yml
but it sends error if i don't set args instead of usage
the error is https://paste.md-5.net/pafepucugi.bash
i tried to make another test cmd with usage and required args and it worked
ty
Hey sorry if this is a bit of a newbie question here but how do I check what the Language level of the project default is in intelliJ if anyone can assist?
click the 3 dashes in the up left corner and project structure
you'll see there the language level
however i'm not sure if it'll show the same as with maven, so you might wanna consider relying on the maven one instead
oh no I know how to change it n allat its just that "Project default" as an option doesn't exactly tell you which one is actually selected
ah alright appriecate the help
help how i can get Component from MinMessage string text https://paste.md-5.net/ibamakomuc.java
i see something about Component.text();
guys im trying to make a system where i have custom items that i can acces from every class but i dont know how to do that, do i make a class and a getter for every item?
have a common class offer you access
what is a common class
you can put it in a manager and that manager be used to inject into your classes that need it
is there a youtube tutorial on this cause im confused
Quite a few possible approaches for this.
I would probably not allocate any ItemStack fields, but rather create methods which create those custom ItemStacks for you.
Do they need to be configurable?
Yes like every item meta different and name and material
With configurable i meant through a config file by the plugin user
no
with a itemstack builder
so i creathe a method which makes an itemstack then where do i store the itemstack
a manager
You dont store the ItemStack. Every time you want to create an ItemStack, you simply call the method and create a new one.
or a factory
Yes but i need to reuse the itemstack somewhere else in the plugin
i need to store it somewhere
like for a recipe or when i right click
Why do you need to "resuse" it?
