#help-development
1 messages · Page 2127 of 1
you have to set the item in that slot to null then
in that case the amount would become 0 and the item would vanish I believe
Damn
it doesn’t like trying to set an item to 0
it doesn’t
it does for me
it works for non stackable items for sure
but usually i just set it to null if it’s 0 and it works
so how would I do that
will strikeLightningEffect create fire or sound?
check if amount -1 is 0 and if it is set to null
no
that doesn’t really work some of the time either
I had a problem with setting the item to air causing the server to crash
do i set the ItemStack object itself to null?
but that was the interactevent, not sure if that applies here
yes
what
that can cause a memory leak lol
?
what
don’t set the reference to null
this works like a charm for me. maybe try this if the setting to null doesn't work
set the item in the slot to null
that could be null though
no
you get the slot it’s in
then you set that spot in the players inventory to null
getEquipment and getHand() could be null, but they arent
admittedly using the inventory method doesn’t feel very efficient, but it worked for me when nothing else would
what version of minecraft are you developing for?
I just noticed it says getItemInHand() not main hand
ok
if (sender instanceof Player) {
Player player = (Player) sender;
}```
at me.kidneybean.generalutils.GeneralUtils.onEnable(GeneralUtils.java:54) ~[generalutils-1.0.2-SNAPSHOT-all.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:501) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:559) ~[purpur-1.18.2.jar:git-Purpur-1610]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:473) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:669) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:436) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:352) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1179) ~[purpur-1.18.2.jar:git-Purpur-1610]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:320) ~[purpur-1.18.2.jar:git-Purpur-1610]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
why do i get this
i have a value in the thing
owo
use patterns
oh yeah thanks
wdym patterns? instanceof Player player?
yeah
if I try to get an entity by name with a name that doesn't exist will I get null or some error?
and if so then what error will I get
wdym entity by name
the name of the entity. like zombie and wither_skeleton
oh
Error
i mean it depends what context you’re using it in
i presume EntityType.valueOd()
defining an Entity variable
whats that stacktrace lol
I have no clue what that is
idk bruh
Is it a schematic file?
something to do with this class https://github.com/OpticFusion1/WorldSchematics3/blob/master/src/main/java/worldschematics/WorldSchematics.java
ew no, fuck lombok
If I try to get an Entity variable and the name of the entity does not exist that will I get null or any error and if so then what error will I get?
will everyone on the server hear the lightning strike if i do strikeLightningEffect
hmmm
don’t know anyone who has actually used the val and var in lombok before
Are you using EntityType.valueOf()?
as in entity type?
read the docs
yes
Then error
so if I use try catch Exeption will it catch it?
yes
Yes
ok thanks
catch the illegalargument exception
if youre not sure whether the thing youre passing in is an empty string or null just catch the null aswell
check that in the command
[15:09:41 INFO]: [WorldSchematics3] [STDOUT] is directoryListing null: true
[15:09:41 ERROR]: Error occurred while enabling WorldSchematics3 v3.1 (Is it up to date?)
java.lang.NullPointerException: Cannot read the array length because "<local6>" is null
Something with the directoryListing ig @tardy delta
oh, okay so I figured it out lol
or at least I think I did
[15:12:07 INFO]: [WorldSchematics3] [STDOUT] WORLD PATH DOESN'T EXIST
[15:12:07 INFO]: [WorldSchematics3] [STDOUT] is worldPath null: false
[15:12:07 INFO]: [WorldSchematics3] [STDOUT] is directoryListing null: true
so, I'll try creating the thing lol
How Can I Open Inv?
You have to pass the inventory to openInventory
You also can't just do new Inventory()
That's not how it works, Inventory is an interface
does any one know why im getting this error??
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getItemMeta()" because the return value of "org.bukkit.event.player.PlayerInteractEvent.getItem()" is null
code error: java ItemStack item = event.getItem();
Then What Should I do
Clearly it is
It's likely the PlayerInteractEvent being fired for the off hand
Two events are fired every time you right click
One for the main hand, one for the off hand
Do you want it to work if the player has an item in each hand?
What would be the best way to find blocks in a certain area based on relative coords? Like when i use my item it does an interact event to the block coords and then i want it to scan a certain size for X block
Do you want it to run twice in that case?
just in the main hand
Then return if the hand is not the main hand
Can you connect a datapack to a plugin?
connect meaning?
Allow a plugin to access/use datapack material
EX: Custom blocks
Actually, might be easier to use a mod
Mostly now we use tags when making them
Can you connect a mod to a plugin?
how?
So a bad idea basically
i don’t know much about datapacks but don’t they use scoreboards to store variables and stuff
They do
couldn’t you access those scoreboards on the server
Most things are tags now but scoreboards can be used
ok now its working but i hava another problem i hava NO idea how to set an elemant in array YAML
i did config.get().set("lazerpos1.posx",blockLoc.getBlockX());
but i dont think its like that
sounds like an awful way to store data
Please don't ping me
yeah it’s definitely not great
But honestly if you are using a plugin then don't bother with datapacks
is that even valid yaml?
i think so
Yes
you could just set(location)
isnt it either
lazerpos1:
- something
- somethingelse
or with the key/ value things but without the -
Honestly just use a config serialization library
location is configuration serializable already
Yeah
But if you're doing anything other than saving primitives/things that are already ConfigurationSerializable just use a library
i have simple question
do you guys prefer syntactic sugar overloads
for example whenever you have method which can handle null values
do you overload that method with a method declaration which doesnt have that null type
what is the vanilla ban permission?
and forward the method to the nullable type method
It helps get the point that the argument is optional
I've used it but I don't know if this overloading preferred
pretty sure it’s just op
but like whats the node
dovidas preferably I avoid passing null as much as possible as I can see it as a magical value in most cases, that being said there are of course exceptions
?paste
hey guys
how can i get all args except 0 in a string? (/ban player i want this to be string)
string array?
Arrays.copyOfRange(arr, 1, arr.length)
params might not be in right order
eh i just have my own methods for that
same
great if statement of giza
?
thats quite a lot of indents 😄
dont care bout pls help me about maven
what do you wanna know
i can not run
cannot find what?
yea thats not alot of information
TNE API Instances
How would I prevent a player from replicating a spesific mushroom stem state?
AKA: An impossible one
guys How many seconds of 1 PotionEffect duration
what do you mean?
I want to build the plugin directly to a file
I mean duration. How many times do I write there will equal 1 second?
- 20
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>Your/Directory/Here</outputDirectory>
</configuration>
</plugin>
add this
oh thanks
yea the duration is in ticks
if the server is running on 20 tps, 1 second = 20 ticks
Thanks 🙂
yea, for example my commands look a little like this.
public class CobbleBenchmarkCommand extends CobbleCubeSubCommand {
protected CobbleBenchmarkCommand() {
super("benchmark", "used to benchmark generation speed for performance");
setUsage("<CubeID> <Size> <DistributionSize> <Period> <Seconds>");
setMinArguments(4);
}
// cc benchmark [cubeid] [amount] [distributions] [period]
@Override
protected void onCommand() {
int amount = findNumber(1, "Could not parse amount.");
int dist = findNumber(2, "Could not parse distributions.");
int period = findNumber(3, "Could not parse period.");
int seconds = findNumber(4, "Could not parse seconds.");
CobbleCubeSettings settings = findSettings(args[0]);
new BenchMark(getPlayer(), settings, amount, dist, period, seconds);
}
}
i think its much more clean than having 25 indents and making your code unreadable.
im pretty sure you can set the output directory in your intellij settings
pretty sure that will not apply when you build with maven.
how would i wait 1 tick?
with a scheduler
you could use the sceduler
?scheduling
how do i set objects as keys in yam
?scheduler
lovely.
idk what ur tryna do. but yaml doesnt rlly work that way.
mk
have not run config still
?paste
yea because your dependencies do not work.
you probably forgot to add a repository somewhere.
you are using code from a library that has not been added to your pom.xml
you probably added a library via intellij, and are now trying to build with maven
i really dont know what should i do
well. idk what libraries you use.
TNE and spigot 1.16.5
https://paste.md-5.net/atejawoqik.md I really don't know what else to try here so I'll see if any of you know whats happening here. recipe.setIngredient() is throwing an IllegalArgumentException even when both key and ingredient are not null
the new economy api
can someone donate me their internal organs
you trynna buy that 3090?
sure brb
okay thaknks
well you need to add that library inside your pom.xml then
close
what version is that
I assume the error is coming from recipe.setIngredient(matKey.key, matKey.material); because it's not printing
So i'm trying to mimic the MULTIPLY_SCALAR_1 operation within attribute modifiers, but I don't entirely know what this means
I assume it means you add 1 to whatever multiplicative you have, take that number, and multiply it by the either base value or regular value.
The only thing I'm confused about is do I multiply it by the base value or the regular value
it adds to the value, then multiplies the resulting value with whatever
Yea, but what is the "whatever" part
I assume it is x MULTIPLY_SCALAR_1 y -> (x+1)*y
I need more information, specifically where recipe is defined, can you DM me the entire method?
yeah sure, thanks for helping 🙂
I might be misunderstanding it.
So, if I have an attribute modifier with a value of 2, and I add it to a player with no attributes modifiers and it's editing the attribute ATTACK_DAMAGE, what occurs?
im using the scheduler to repeat a task every tick for 3 times but i dont see how to specify for 3 times
scheduler.runTaskTimer(plugin, () -> {
loopPlayer.playSound(loopPlayer.getLocation(), "entity.experience_orb.pickup", 1.0f, 1.0f);
}, 1L, 20L * 3L);```
I don't think you can run it only three times
You'll have to have an internal counter and exit after three iterations
yeah
ok
does it matter if I get this error Method invocation 'setExecutor' may produce 'NullPointerException' for this code getCommand("heal").setExecutor(new heal());?
Because it still works just fine but it gives me this error
yes I userstand but does it even matter if I make it un nullable?
because it cant be null. the computer just thinks that it can
ok
whats the task id
Does anyone have any idea on how this works? (https://streamable.com/pq6w9l)
I register when a hopper picks an item up using an InventoryPickupItemEvent. However, it is called three times every time it picks an item up, any idea why?
you can't do integer = integer.getAndAdd()
theres a 1 there
?
its integer.getAndAdd(1)
How do i get the obsidian/cobblestone block generated when lava and water get in contact?
would addAndGet work?
iirc
ok
wel theres no errors so if it works it never gets touched again
lol
You could also use the implementation of the BukkitRunnable class
^
how do I make an item look enchanted when it has no enchants?
aka
new BukkitRunnable() {
private int num = 0;
@Override
public void run() {
//code here
}
}```
how do i do that
ok
@coarse finch
and also when I enchant something it asks for a Boolean input after the enchant level. what does this Boolean value mean?
Whether or not you may override the default level restrictions
Aka whether or not to allow for like efficiency 100+ etc items
"Impossible items"
ok
Eh I got it
Any idea on how to get the block where the player is looking at since getTargetBlock won't work?
It says "the method getTargetBlock is ambiguous for the type Player"
getTargetBlock((Set<Material>) null, distance); right?
Yes
can you send a quick screenshot of the code where the error is formed?
if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
Block block = player.getTargetBlock(null, 50);
Location bl = block.getLocation();
player.getWorld().strikeLightning(player.getTargetBlock(null, 15).getLocation());
}```
like this
i know
Or else it doesn't know what method to use?
oh sorry
yea
(Set<Material>)null
it's fine
Block block = player.getTargetBlock((HashSet<Byte>) null, 50);```
yep
it tells me to cast it like this
uh
?
it doesn't 😦
how do i calculate blocked & critical hits
what's wrong?
What do you mean?
public void onInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (player.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("§6Fireball wand")) {
Fireball f = player.launchProjectile(Fireball.class);
f.setIsIncendiary(false);
} else if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
@SuppressWarnings("deprecation")
Block block = player.getTargetBlock((HashSet<Byte>) null, 50);
Location bl = block.getLocation();
player.getWorld().strikeLightning(bl);
}
}
}
}
```both wands don't shoot
Do you get errors?
no
@EventHandler present ?
Are you registering the event class?
Why is Eclipse so stupid some times
agreed
It just randomly stopped using reflections for my plugin
I did nothing to the pom
I changed like 2 lines of code
Then
pow
Gone
unlucky!
use ij
💢
Vim
hi babe
hello
I mean...no?
Why can't eclipse just be good
whats your issue
My reflections just stopped working
it's old, it's outdated, the interface is ugly D:
No reason
Like java.lang.reflection
Not imo
Huh...
Well
I just get java.lang.NoClassDefFoundError when I start my server now lol
Are you properly shading ?
can you share your pom ?
is the class your looking for existing?
Until like
?paste
pretty sure that that is not a proper includes set
you usually do something like groupID:artifactID
¯_(ツ)_/¯
e.g. see here
if yo uwant to match any artifact following, you use a :*
I would also suggest to reformat the pom.xml 🙂
just for good riddance
- Reformat? 2. You mean like
org.reflections:*?
I mean yeah, but how
Go to Source | Format Document or press Ctrl+Shift+F.
is what google says
idk I don't use eclipse
yea its ctrl shift f
also obviously make sure you compile properly through eclipse
I use eclipse hotkeys on vscode lol
e.g. you do use maven and not eclipse's inbuild compiler
Umm...Go to Source?
As in?
sigh
I just get Generic Windows NO sound when I do Ctrl+Shift+F lol
Oh
My
Fkin
God
I'm gonna kill someone
yes end my suffering pls
Hmm...well
you okay conclure 😢
well then
No reflections
that would do it
ye everything's fine, now when Sniskus got everything working and all :3
:3
😅 phew, thank god
yea my unsafe go code these days does ugly things
🙌
uh
I need help, anyone know how to disable JLine and the ">" character in bungeecord?
I've used -Djline.terminal=jline.UnsupportedTerminal when starting bungeecord as an argument, but it didn't work
and I ran out of ideas.
mye Ig
by adding -nojline
but that disabled jline entirely right?
dunno
😮
that looks like quite the hardcode
you're ..... kidding me..
Can you check if redstone is leading into a block?
(yeah quite pissed)
can't fork
...any block?
you cannot fork bungeecord ?
already using a premium fork
woopsie
of bungeecord.
i wish to check if cobblestone is powered :troll:
MY NITRO IS GONE
NO
nvm
outside emojis are just disabled
hm. alright
I'm pretty pissed about it, but oh well
I mean, if you are using a premium fork, ask then to implement it in a issue or something
it doesn't make sense tho..
⁉️
huh
this is really sad, and made me really upset.
it couldn't actually ruin day faster, to be really honest..
how do i run a command as console?
Bukkit.dispatchCommand(CommandSender, String);
ty
I'm trying to make an external library, but I must be doing something wrong because it won't recognize any of the methods I created, can someone please take a look and lmk if you figure it out?
I exported the library and added it as a module, and I can import it just fine, however I can't use any of its functions?
Library: https://imgur.com/sNvlanh
Plugin that it is being used in: https://imgur.com/xE0FmKU
Figured I'd mention that the fact that I'm not inputting parameters should not be the cause -- The error is "Cannot resolve Symbol 'Test'"
im using the WorldEdit API in an event call and some of the functions are asking for a "world" object as a parameter. I know how to get the current Bukkit world through event.getPlayer().getWorld() but it says that it needs the WorldEdit world object, not the bukkit one and I was wondering how I can get that?
How do you add multiverse as a dependency and as a repository with maven? my code
`<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>OnARandomBox</id>
<url>https://repo.onarandombox.com/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.onarandombox.multiversecore</groupId> <!-- Don't forget to replace this -->
<artifactId>Multiverse-Core</artifactId> <!-- Replace this as well -->
<version>4.3.1</version> <!-- This too -->
<scope>provided</scope>
</dependency>
</dependencies>`
If you’re using the API it should contain a method to get a world by the name or with the bukkit world. If not then just try creating a new world edit world object and then just pass in the needed parameters
Yah I tried that
But it just shows up red
Let me see, does it provide a reason?
nope
wait here: Dependency 'com.onarandombox.multiversecore:Multiverse-Core:4.3.1' not found
Why don’t you try using the jar as a dependency but the jar located somewhere in your files
can you access the repo via chrome? https://repo.onarandombox.com/content/groups/public/
How do you do that
Just add the SystemPath mark and specify the path that the jar is located in
Example
try to invalid cache and restart
<scope>system</scope>
<systemPath>C:/Desktop/Multiverse-Core.jar</systemPath>
That can also work
SystemPath can me anywhere you have it located it
and I ad that inside of dependencies?
That worked
But I still want to know how to phisicaly put the file on my computer, how?
Nevermind
this is the worst possible way to depend upon something
generally you want to put the dependency to your M2 file than depend off it that way
If the link is broken what would be an alt?
I just slap everything in my m2 maven provides tools to add a jar to the m2
that way you don't need to worry about a link ever breaking
Okay the guy needed help I just offered an option.
also this yet again makes your code more portable
new BukkitWorld(yourWorld)
Does anyone else know how to import an external library you've made yourself?
I exported mine as a jar file, and added it to the modules tab just like you would with spigot, however I cannot use any of the methods in the library
Error: Cannot resolve symbol "MethodName"
ty, i ended up using BukkitAdapter.adapt(myworld) which seems to work
How to suppress deprecated warnings?
you annotate the method
@SuppressWarnings("deprecated")
your IDE should already suggest that
Very novice Java issue but I'm really struggling to find anything on stack overflow for it
How can I copy a file from resources to a folder
In this case, it's a yml file that I'm trying to drop in the data folder if it isn't already present
look at the src for bukkit
?stash
list.clear bruh
umm
🤦🏿♂️
no
bro what the fuck is that
LIST.CLEAR
You can not clear a team like that what?
please for the love of god set the type of list
for loops exist for a reason
a ?learnJava moment
?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.
ye
getEntriesreturns you an immutable set
literally just iterate over it and call the removeEntry method for each
why not just use clear()?
the set is not backed by the team
thats what im saying
and is immutable anyway
oh I see

bro..
it is so dumb
that's not what is dumb...
[01:52] LynxPlay: literally just iterate over it and call the removeEntry method for each

dude why
that won't clear the list

or dont use streams and just do a normal for loop
It's not a stream
dude it looks like a damn stream i know its not
Yep. Implementation is just a for loop ;p
a normal look would save you from the method handles 🤔
this does look like critical and very hot code 
For future reference:
- Team#getEntries() returns a Set, which is not a List and cannot be cast to one
- Checking for
!= xin a loop is bound for issues. You should probably use >= or <= in a majority of situations when looping like that to avoid infinite loops - Collections can (and should - again in the majority of cases) be typed. This has been the case since like
Java 6(EDIT: 2004 lol. Way earlier)
putting this here in case anyone searches for this in the future: it's literally just saveResource(path, replace)
Is there a way to spawn an end crystal that heals the dragon just like in the fight?
any end crystal will heal the dragon
Hmm okay
My idea was to make the dragon shoot tnt at the towers, respawning the crystals on certain health marks
So yeah that seems fairly straightforward in that case
bruh i thought you werent using the spigot api
no I was lol
left_arm: [-17, -61, 0]
Quick question for my yaml nerds: could I yoink these individual valeus out with getStringList
why
yes you can
I almost never work with yaml but I have to make a config that's actually modifiable
sick
assuming spigot is faithful
we're about to find out
i just meant shouldnt you get the list of ints first to be safer
but i meant if it doesnt matter to you then it doesnt matter
I was going to make sure it was valid first
but does FileConfiguration even have a method for that
I barely touch this shit
oh shit getDoubleList is a thing
neat
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
using the multiverse api how do you load a world from a file?
I start a spigot server in a processbuilder
how do i write a command now tho
into the spigot server thats running in a process
well depends if your using Linux or windows if your using linux I actually reccomend using Screen to spawn a process completely detached from your screen
than you can send commands using screen vs processbuilder
It looks like you can use a BufferedWriter and write to the output Stream of the process started by ProcessBuilder
https://stackoverflow.com/questions/35255900/how-to-send-another-command-to-an-existing-process
per this thread on stackoverflow
if you want to make a server-panel I reccomend using a language other than java though
is it possible to make a player right click an item like a fishing rod in a spigot plugin?
i basically wanna make the player reel in the fishing rod
ive tried both PlayerInteractEvent and PlayerFishEvent, doesn't seem to be working.
honestly yeah, java might not be the best language for a daemon
How can i update a scoreboard? ( im using teams and this is in a different class aside from my main class. )
nvm i think i got it
is there a way you can use an itemstack as a HashMap key?
and if not instead. could i manually loop over it, and do entry.getKey().isSimilar(stack);?
so i think using itemstacks as keys is simply problematic. im gonna find another way
indeed
How can i set the blockdata for a wheat block to ripe? as crop is deprecatted and i cant see how to use cropstate
Ageable?
cast it to that
with the block data u have, you need to clone the block data iirc
so like
Ageable newdata = ((Ageable) wheatblock.getBlockData());
newdata.setAge(5);
wheatblock.setBlockData((BlockData) newdata);
ignore weird spacing idk why it pasted like that
it gave an error
it gives the error required type BlockData
given Ageable
org.bukkit.block.data.Ageable
ye there fixed ty
How
It's not
Why would that be a problem
Redempt
Hi
Do u know how to use maven
Im getting pain from maven
I have never used it
I have never used such worktypes
I dont know what should i do because all the time it gives error
Rıght there on ss
and show project structure
Use Java 17 for 1.18.2
Yea, seeing a non lts looks soo weird to me
what thee actual hell im getting this error Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.set(String, Object)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null the configuration section is "warns" and yes... it exists... i have it in my config file in my project and yes the config file loads with the plugin ive tried making a config section with .createSection("warns"); and still nothing
VWarns.getInstance().getConfig().getConfigurationSection("warns")
config is nothing now since i tried .createSection("warns"); just check if its null on plugin start but it was just
warns:
yes if (this.getConfig().getConfigurationSection("warns") == null) { this.getConfig().createSection("warns"); this.saveConfig(); }
Yea so you also gotta add data in it
i add data after i create it
tried adding something when creating the section still doesnt work same errors
Where did you calll the #set() method
this is where the errors are happening
VWarns.getInstance().getConfig().getConfigurationSection("warns." + of.getUniqueId()).set("warnings", 0);
}```
of is ```Player of = Bukkit.getPlayer(args[1]);```
and
``` if (this.getConfig().getConfigurationSection("warns") == null) {
this.getConfig().createSection("warns");
this.getConfig().getConfigurationSection("warns").set("demo", 1);
this.saveConfig();
}``` is the initial config section creating
Why am I not getting any enchantments when I summon this Item?
ItemStack item = new ItemStack(Material.STICK, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.DARK_RED + "Fire Wand");
meta.addEnchant(Enchantment.FIRE_ASPECT, 3, false);
List<String> lore = new ArrayList<>();
lore.add(ChatColor.RED + "This tool is bound to burn the entire world to ashes.");
lore.add(ChatColor.RED + "Right click to shoot fire balls.");
meta.setLore(lore);
item.setItemMeta(meta);
fireWand = item;
}```
yes
weird
does it have the lore and displayname?
anything in the console?
nothing but me executing the command
meta.addEnchant(Enchantment.FIRE_ASPECT, 3, false);
try unsafe
addUnsafeEnchantment
what is it
if you wanna add enchantments exceeding the limit of its own
It’s above the normal max so you have to add a "unsafe" enchantment
like sharpness 6
or fire aspect 3 like here
whats the max of fire aspect anyways
2
i was told that if I put false in the boolean value than it's ok
normally it should
this indicates the enchantment should be applied, ignoring the level limit
you could return the value of addEnchant to see if the meta changed by that call
ohhhhhh
Yeah it lasts longer
same for a sec
thank you
why isn't it shooting when I right click?
public static void OnPlayerInteract(PlayerInteractEvent event){
Player player = event.getPlayer();
if (player.getItemInHand()== ItemManager.fireWand && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)){
Fireball ball = player.launchProjectile(Fireball.class);
ball.setIsIncendiary(true);
ball.setDirection(player.getLocation().getDirection());
ball.setShooter(player);
}
}```
nothing happens when I right click and hold this item
are u sure the item in ur hand is equal to fireWand
do a check for it by sending the player a msg
if im holding this item why shouldn't it be?
- pls use getters
Do a check to be sure
what if smth is weirdly wrong?
[SOLVED] Getting advancment name
Used nms for this
got it by getting the NMS object of the advancement -> from AdvancementDisplay -> from AdvancementFrameType. See return types of method to find a method to get display and then type
I put this System.out.println(player.getItemInHand()); in the Event outside of the if statement and it outputs nothing
you need to use equals to compare itemstack
oh yea i forgot dat
do this
player.sendMessage(player.getItemInHand().equals(ItemManager.fireWand))
if it sends false, smth is wrong, if it sends true, smth is wrong
its probably not the exact same item. also dont compare objects with ==. this will only return true if the objects are the same and not equal
for itemstacks use the #isSimilar method
still nothing happens and I get no output
wha
@EventHandler
public static void OnPlayerInteract(PlayerInteractEvent event){
Player player = event.getPlayer();
player.sendMessage(String.valueOf(player.getItemInHand()));
player.sendMessage(String.valueOf(player.getItemInHand().equals(ItemManager.fireWand)));
if (player.getItemInHand().equals(ItemManager.fireWand) && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)){
Fireball ball = player.launchProjectile(Fireball.class);
ball.setIsIncendiary(true);
ball.setDirection(player.getLocation().getDirection());
ball.setShooter(player);
}
}
are u registering that eveent
yes
check console?
can someone help
Code blocks exist - I aint Killing my eyes
NMS?
Are you sure that that makes Sense to do?
Then you just want to delay the sending of packets. You might be able to do it via some netty pipe
but idk ¯\_(ツ)_/¯
10s is still under the timeout
Does anyone know what I'm doing wrong here? I'm trying to make a config file with this message player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("No-Permission")));
anyone?
check what is null
it may be player, plugin, or Config#getString
test it by doing debug
okay
What text do i need to find and paste
Hey i'm about to saw my nuts of with a rusty handsaw if I can't figure out NMS and Maven.
What's the problem
Well I can start with a stack trace from buildtools
To clarify, when I tried running maven it was giving me a parameter exception saying <srgIn> was invalid or missing
I'm trying to use mojang mapped API but special source is fucking me
Step 1 is BuildTools
Sure
So let's get that working
I'm going to delete the folder and rebuild from a clean build
Make sure to use the --remapped flag
What's remapped?
mojang remapped nms
Still don't know what remapped means
uhh like remapping the net minecraft server api to be more developer friendly I think?
they just change the names of variables and method for clarity
Basically undoing some of the obfuscation
so issue starts when maven build
heres the error:
Failed to execute goal net.md-5:specialsource-maven-plugin:1.2.3:remap (default-cli) on project CTC: The parameters 'srgIn' for goal net.md-5:specialsource-maven-plugin:1.2.3:remap are missing or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.md-5:specialsource-maven-plugin:1.2.3:remap (default-cli) on project CTC: The parameters 'srgIn' for goal net.md-5:specialsource-maven-plugin:1.2.3:remap are missing or invalid
I can paste the full stack trace if you want it
Also I checked .m2 for the txt remapping and csrg or whatever they're both there, maven just not detecting it?
btw thanks for helping this has been making me rip my hair out for the past two days
someone told me
that
public class X {
public static X it;
onEnable() { it = this; }
}
is not static abuse
Still
what makes it static abuse
?
You're telling it to compile with Java 10?
Yah but does the compiler version matter? I tried Java 15 same error
why is it a bad way?
You need Java 17
I just downloaded Java 17 but it only goes up to 15 for compiler on eclipse.
aaaaa, if I do java 17 you think it'll fix problem?
Maybe. Change the version to 17 in the pom and build without Eclipse
not familiar with maven, do u have a reference on how to build from cli?
if((e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) && e.getHand() == EquipmentSlot.HAND)
{
if(itemInMainHand == null) {return;}
if(itemInMainHand.getItemMeta() == null) {return;}
if(itemInMainHand.getItemMeta().getDisplayName() == null) {return;}
String ItemName = itemInMainHand.getItemMeta().getDisplayName();
//if there are enchants
if(ItemName == "Slimy Detector")
{
p.performCommand("slimechunkcheck");
}else{
return;
}
}```
this doesnt do anything when i rightclick slimeball
jup
Why?
Don't compare strings with ==
because static means global context, apart from the underlying object. in this case you let it bend down to the object and back up to the class
How is that bad
its an awful design
if(ItemName.equals("Slimy Detector"))
lost in an argument with a static abuser
that should work?
yes
in this case its bukkits fault
Yes, but you probably want to avoid detecting items by name
he knows what hes doing and he still static abuses
why
cause anyone can use the anvil and rename it
he says its not static abuse in this case since its a singleton anyways
i also do that but its still a bad pratice you should never do outside of bukkit
true
can i do it with enchants maybe?
he did it in forge
PDC
well, idk about forge. could be needed there too
PersisdantDataContainer
ok ill look into that
?pdc
well, so he's saying that every static variable that will be a singleton is not static abuse
^ Here you go
and singleton design bad
Same error with Java 17
Should I try again and delete my local maven repository? maybe run build tools again?
I also ran with jre 1.6
I think its time to switch to IntelliJ and see if that fixes the problem. Eclipse is giving me a massive headache.
did you try to force install?
JRE 1.6??????
But generally, this is probably an maven pom issue, I never recall eclipse having issues with it running on the wrong Java version with maven
You might try explicitly setting the jvm that eclipse uses, but I expect minimal changes
I advise to try whether you can compile your project manually via the CLI outside of the IDE
My workflow has always been to compile maven projects through CLI anyways
Lot more reliable
lmao I just gave up on eclipse. I think I had multiple versions that messed with local maven repository. JavaSE 17 was bugged, couldn't update properly without errors, moved to intelliJ, everything works fine now.
Exact same pom.xml, build path etc etc
IntelliJ supremacy
Multiple Versions of what?
I remain with my eclipse
hey, does anyone know how to prevent players from modifying the inventory/dropping items? i have worldguard
looks like a #help-server
Also, you may need to actually Install a JVM17 to use Java 17. The implicitly declared Versions are questionable
INTELLIJ GANG
unironically intellij supremacy, fuck eclipse single threaded marketplace literally crashes everytime i open it
xd yes
im lookin for script with cobble generator from 5 hours but there is still nothing
someone have thing like dat
Script or Skript?
i've Been an Eclipse user for all my Life but now i see IntelliJ is SO MUCH Better and i'm doing the Change, Best Decision of my Life
can't Help with that, i Code for Real
...
the other way around
Eclipse is difficult to navigate, Intellij is in my opinion a lot easier to use
i think Intellij is Eadier
what does that matter
Eclipse is Difficult to get the Code Working Fine
that's not true its just hard to work with
you Have to ReCompile it
there's settings for that
but this is a help channel so I'll ask an actual question
Happens to me Every time
i Reinstalled 20 Times
Deleting all Data
How to Gravel
I switched to Maven and changed some code now im getting a "Initializing Legacy support" error and the plugin fails to load.
I don't have any deprecated stuff in use anywhere. Paper 1.17.1 latest
?paste error
yup hold on
Did you forget to specify api version in your plugin.yml
oh now I get an actual useful one (lol) I need to specify modern version in my spigot yml
why did this not happen before
Maven
Then you were running a minecraft version lower than 1.13