#help-development

1 messages ยท Page 1457 of 1

wraith rapids
#

simple as

granite stirrup
#

on the server host

#

it is limited

wraith rapids
#

then restrict it to less than 1.5gb

shrewd totem
#

so how did it get to 1.9

granite stirrup
sage swift
#

"the host is really generous"

cyan bluff
#

How can I check if a player has permissions for a specific command?

wraith rapids
#

you can't restrict it but it is limited

cyan bluff
#

(If the command is a string)

wraith rapids
#

literally what

granite stirrup
#

its stuck on this command java -Xms128M -Xmx1500M -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar

sage swift
cyan bluff
#

ah

wraith rapids
#

yeah that limits the heap to 1.5gb

cyan bluff
#

but like does it work for the command, or does it have to be in permission format

sage swift
#

you can also put the permission under the command in plugin.yml if you want to directly define it

wraith rapids
#

an off-heap memory usage of about .5gb is fine

#

there is nothing to worry about there

cold tartan
#

is there a way to get the way a player is looking in vector form?

sage swift
#

Location#getDirection

wraith rapids
#

any issues you faced "because" of that are either the host being shit or you going crosseyed

granite stirrup
#

nah the host is fine

wraith rapids
#

it clearly isn't

shrewd totem
#

idk java

wraith rapids
#

if your server crashes with an oom after overallocating resources

shrewd totem
#

is # a pointer

paper viper
#

wot

granite stirrup
quartz anchor
#

you mean something like Player#sendMessage?

granite stirrup
#

so it stops

#

responding

wraith rapids
#

you aren't supposed to allocate all of your available memory to the heap with pterodactyl

#

your issues are caused by a misconfiguration

#

which is unsurprising

sage swift
#

just means you run the method on an instance of the object

wraith rapids
#

talk to the host about it

sage swift
#

vs . which usually references static methods

granite stirrup
#

and i think thats default

wraith rapids
#

get fucked then i guess

#

doesn't really matter to me

quartz anchor
#

just allocate below the maximum memory

paper viper
wraith rapids
#

your host has given you 1.5gb of memory

#

you have allocated 1.5gb of memory to the heap

granite stirrup
#

yeah but theres like a overhead bit

wraith rapids
#

your system memory footprint consists of more than just the heap

granite stirrup
#

so it can go over

wraith rapids
#

then the overhead given to you isn't sufficient

#

and needs to be increased

#

by lowering the heap allocation

granite stirrup
#

the overhead is like .5gb

wraith rapids
#

yes

quartz anchor
#

dude my jre uses more than 1.5gb even i only allocated 1gb

wraith rapids
#

it's generally recommended to have 1.5-2gb of room

#

you have .5

granite stirrup
#

lmao why

wraith rapids
#

because that's how native memory works

quartz anchor
#

get more memory then

granite stirrup
#

well yeah but this is just default settings in ptero

wraith rapids
#

that doesn't mean it's right

#

anyway, i'm done with this retarded argument

#

do what you will

granite stirrup
#

im not kidding tho its using more than 1gb

#

i dont even have alot of plugins

wraith rapids
#

that is completely irrelevant

granite stirrup
#

yeah but plugins use memory lmao

wraith rapids
#

not really

quaint mantle
#

why does mongo keep wanting to import from com.mongodb instead of org.mongodb

quartz anchor
#

it just only uses the amount of allocated memory after all

quaint mantle
#

i added the maven thingy

granite stirrup
#

also tps is low on 1.16.5

quartz anchor
#

no it doesn't

wraith rapids
#

1.16 performs significantly better than 1.14

granite stirrup
wraith rapids
#

you have just configured your server like ass

quartz anchor
#

at least it's better than 1.13

granite stirrup
#

for some reason spigot 1.16.5 uses less memory

wraith rapids
#

yes, paper uses somewhat more memory

granite stirrup
#

but its still quite alot 1.11 GB

wraith rapids
#

1.13 performs better than 1.14 mostly because of villagers and entity ai changes

cold tartan
#

i have never gotten it before so im confused

wraith rapids
#

1.15 performs better than 1.14 mostly because of villagers getting fixed

quartz anchor
wraith rapids
#

1.12 performs better than 1.14 because 1.13+ uses the shitty overengineered chunk system

quartz anchor
#

look at Bedwars.java:27

cold tartan
quartz anchor
#

the manager could be null

wraith rapids
#

1.16 has negligible performance degradations compared to 1.15 so it still performs better than 1.14

granite stirrup
#

idk how ptero calculates memory tho

quartz anchor
#

i need code to look at bruh

wraith rapids
#

it calculates it poorly

cold tartan
#

this is the code:

ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getMainScoreboard();```
wraith rapids
#

the numbers it shows are irrelevant

cold tartan
#

it was working before

#

now its not

granite stirrup
#

yeah but cuz its a free server on this host the tps and ram usage is high on 1.16.5

#

thats why i was on 1.14.4

quartz anchor
#

huh manager can't be null

#

are you looking at line 27?

cold tartan
#

yep

quartz anchor
#

recompile it and restart your server

cold tartan
#

wdym recompile?

#

like rebuild?

quartz anchor
#

yes

quaint mantle
#

why does mongodb want to import from com.mongodb and org.mongodb doesnt exist?

        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>4.0.1</version>
            <scope>compile</scope>
        </dependency>
past glen
#

is there a way to make something the player is wearing invis? like I want to add armor that turns the player invis but I dont want the armor to show

cold tartan
#

still doesnt work

quartz anchor
#

wth it's working for me tho

#

the final approach is to use /rl

cold tartan
quartz anchor
#

yo it must be some magic with /rl

#

or maybe your plugin load before scoreboard actually loaded

cold tartan
#

ok

#

so now, im getting a different issue

#

but its ez to fix i think

#

if i wanted to check all the teams and see if a team already exists how would i do that?

quartz anchor
#

try forEach on getTeams()

cold tartan
#

wdym

quartz anchor
#

actually just use getTeam()

cold tartan
#

oh i see

quartz anchor
#

it will returns null if it does not exists

weak berry
#

What event gets fired when a player leaves the server?

warm galleon
#

PlayerQuitEvent

weak berry
#

oh yeah i just found it in the javadocs, thanks!

quaint mantle
#

?paste

queen dragonBOT
cold tartan
#

how would you make a fireball/tnt not do block damage, but only for that fireball/tnt

#

nvm

#

any clue why this didn't work?

@EventHandler
public static void onBlockExplode(BlockExplodeEvent event) {
  event.setCancelled(true);
}
quaint mantle
#

should i use players usernames or uuid to store in an arraylist

cold tartan
cyan bluff
#
if(e.getPlayer().hasPermission(e.getMessage().replace("/", "")) && ((Bukkit.getServer().getPluginCommand(maincmd)!=null))){

Currently I have this, I want to make it so that it responds with true if the player has access to the command and false if the player doesnt have access to the command/the command is invalid. So far it works, but it for some reason doesn't work with official minecraft commands. It only responds properly to plugin commands. Also, if the player isn't OP, then it returns false for all commands, even the ones they can do.

So I just need to figure out how to make it work for minecraft commands, and how to make it work for non-op players.

quaint mantle
#

How can I make world border for only one person? another players cannot see it (Btw, I googled it. and I found only 1 thread. and person that replyed said "Google it. packet done." lol)

#

What packet should I use

#

and etc

granite stirrup
#

Ur using getPluginCommand which gets plugin commands I think XD

cyan bluff
#

yeah I mean it wouldnt show for any others

#

like I didnt see another method to do it

granite stirrup
#

There is I think but yeah its not in the Server api

cyan bluff
#

Oh

#

Well, I think this would do the same thing. Do you know how I can check if a command runs successfully or not?

granite stirrup
#

^ this was it

cold tartan
#

for some reason this event isn't called when a block is exploded:

    @EventHandler
    public static void onBlockExplode(BlockExplodeEvent event) {
        System.out.println(event.getBlock().getLocation());
        event.setCancelled(true);
    }
cyan bluff
cold tartan
#

yep

granite stirrup
#

Bruh

cold tartan
#

i think a bot is deleting your ur sure

granite stirrup
#

Yep

cold tartan
#

your sure

#

hmmm

granite stirrup
#

I said u sure

cold tartan
#

u sure

#

hmmmmm

#

idk

granite stirrup
#

It's cuz I tagged u

cold tartan
#

nope

#

the bot just doesn't like you lmao

granite stirrup
#

Nah it's cuz I tagged a person before u

cold tartan
#

ok

#

its weird, it doesn't even do the print

granite stirrup
#

?

sullen marlin
#

?xy

queen dragonBOT
sullen marlin
#

@cyan bluff ^

cold tartan
#

wdym

granite stirrup
cold tartan
#

im testing it with tnt

granite stirrup
#

Oh then idk

granite stirrup
#

So uuid

cold tartan
#

this is so weird

#

the event isn't being called at all

#

event with large changes to the code within it

granite stirrup
#

Maybe the name of the method is wrong

cyan bluff
# sullen marlin <@!561574117136924707> ^

Basically, I'm trying to make a commandspy plugin. I have that part done, but I also want to make it so that the command appears green when the player has permission to run it, and the command appears red when the player doesn't have said permission. Also, if it isn't a command, then it's red.

#

I suppose checking if the command had run successfully would also work, but I don't know how to do that either.

sullen marlin
#

some bad plugins will check their permissions via code, so that will cause false negatives

#

but the vanilla commands should work

#

one problem with your code is it uses getmessage which includes all arguments

cyan bluff
#

Yep, I already fixed that by splitting it up

sullen marlin
#

you need to split on space and check only the first part

cyan bluff
#
ChatColor cmdc;
String maincmd = e.getMessage().replace("/", "").split(" ")[0];
if(e.getPlayer().hasPermission(e.getMessage()) && ((Bukkit.getPluginCommand(maincmd)!=null))){
    cmdc = ChatColor.GREEN;
}else {
    cmdc = ChatColor.RED;
}
cold tartan
#

ok this is very strange, this code:

    @EventHandler
    public static void onBlockExplode(BlockExplodeEvent event) {
        System.out.println(event.blockList());
    }
```doesn't work, but this code:
```java
    @EventHandler
    public static void onPlayerChat(AsyncPlayerChatEvent event) {
        event.setMessage("Hi!");
    }
``` does??????
#

is BlockExplodeEvent broken?

granite stirrup
#

Nah it's probs not called onBlockExplode

cold tartan
#

u mean BlockExplodeEvent right?

granite stirrup
#

?

cold tartan
#

the event name that im trying to call is this:
BlockExplodeEvent

#

which u can see inside the parenthesis

granite stirrup
#

Oh do entityexplode event

quaint mantle
#

How can I make world border for only one person? another players cannot see it (Btw, I googled it. and I found only 1 thread. and person that replyed said "Google it. packet done." lol)

dusk flicker
#

It's packet based

sinful kelp
#
public void onDisable() {

        MongoCursor<Document> cursor = dbHandler.getDocuments("minecraft_ranks");
        while(cursor.hasNext()) {

            BasicDBObject filter = new BasicDBObject();
            filter.put("id", cursor.next().getInteger("id"));
            dbHandler.getCollection("minecraft_ranks").deleteOne(filter);

        }

        rankHandler.getRanks().sort(new IDSorter());

        for(Rank rank : rankHandler.getRanks()) {

            Document newRank = new Document("_id", new ObjectId());
            //....
            dbHandler.getCollection("minecraft_ranks").insertOne(newRank);

        }

    }```

I have this onDisable method (I removed some lines bc it's unnecessary)
It doesn't work because the plugins already disabled so none of the Mongo shit works.
Any work arounds?
wispy flume
#

I can't seem to find an answer for this anywhere;
Does anyone know how I can download things from the SpigotMC website automatically?

Spiget is able to get the resource information, but isn't downloading files for whatever reason
Is there any way to interact with the SpigotMC website without Spiget?
Any other APIs or anything?

eternal oxide
eternal oxide
#

For example, you can not schedule any events.

solemn shoal
#

lmao what is this

#

if(has permssion) send plugin list
else send plugin list

#

surely thats not intentional right?

eternal oxide
#

looks like two different methods to me

solemn shoal
#

well yeah, but both produce the same result

eternal oxide
#

How do you know? I don;t see the contents of those methods

solemn shoal
#

you can check the code yourself if you wish

#

org.bukkit.command.defaults.PluginsCommand

#

wait, do players have bukkit.command.version by default?!

eternal oxide
#

I don;t see that code in teh class you mentioned

solemn shoal
eternal oxide
#
    @Override
    public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
        if (!testPermission(sender)) return true;

        sender.sendMessage("Plugins " + getPluginList());
        return true;
    }```
solemn shoal
#

huh

#

guess youre checking CB

eternal oxide
#

Bukkit

solemn shoal
#

yeah

#

check spigot

eternal oxide
#

You didn;t say spigot

eternal oxide
solemn shoal
#

fair

#

spigot patches it

eternal oxide
#

I'm not seeing the same code you are

sage swift
#

what could stop an EntityDamageEvent from being called at all?

eternal oxide
#

No annotation or not registered

sage swift
#

trying to debug why the hell i'm not taking damage from natural sources, been at this for a few days

#

nah, it's definitely being called in general

eternal oxide
#

or another plugin is cancelling it before you get to see it.

sage swift
#

can't reproduce it on my test server, ignoreCancelled is false in my listener

eternal oxide
#

Then you should be seeing it

sage swift
#

all i can think of is god mode

#

but the player is not in god mode...

#

normal mobs take damage

#

only in a certain world as well

eternal oxide
#

is there a gamerule?

sage swift
#

oh. my god.

#

holy mother of god

#

fireDamage

#

jesus christ

#

that was it

#

thank you

eternal oxide
#

๐Ÿ™‚

sinful kelp
eternal oxide
#

You havn;t shown any error, just said its not working

sinful kelp
#
        at com.orecraft.core.util.DBHandler.getCollection(DBHandler.java:23) ~[?:?]
        at com.orecraft.core.util.DBHandler.getDocuments(DBHandler.java:46) ~[?:?]
        at com.orecraft.core.Core.onDisable(Core.java:90) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
        at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:361) [spigot.jar:git-Spigot-596221b-9a1fc1e]```
#
return core.database.getCollection(name);``` Line 23
sage swift
#

is it set as a depend in plugin yml?

eternal oxide
#

either core or database is null

sinful kelp
#

why would it be null tho? cuz the plugins disabling?

eternal oxide
#

no

#

You can;t have initialized it

sinful kelp
#

what

#
System.out.println(core.toString());``` this is throwing a NPE
#
private final Core core = Core.getInstance();```
eternal oxide
#

You either havn't initialized it, or you are setting it to null before trying to access it in your onDisable

sage swift
#

does it work other places than onDisable?

sinful kelp
#

I initalise it in onEnable()

sage swift
#

is it in your plugin.yml as a depend?

sinful kelp
#

Core is just the name of my Main file

eternal oxide
#

if you are in onDisable just use this

sinful kelp
#

Really weird, just accessing database directly worked fine

tranquil viper
#

question

#

how do I reload a yml

#

that is not a config

eternal oxide
#

have you loaded it once?

tranquil viper
#

yes

eternal oxide
#

then otherConfig.load()

tranquil viper
#

what do I put in the load parameter

vagrant stratus
#

What?
FileConfiguration.load(file) or FileConfiguration.loadConfiguration(file) or something to load it

tranquil viper
#

not reload

#

im stupid

#

i meant save

eternal oxide
#

you use exactly the same as you did you load it in teh first place

vagrant stratus
#

FileConfiguration#save(File) @tranquil viper

#

Javadocs exist for a reason m8

tranquil viper
#

sorry i just havent worked on a spigot plugin in 5 years

#

lol

#

or with java

vagrant stratus
#

Give them a read once in a while?

tranquil viper
#

and im just getting back into it

eternal oxide
#

The Spigot JD is great, the search box is yoru friend

vagrant stratus
#

a decent IDE will give you java docs too in some way, shape or form :p

eternal oxide
#

I just wish they added it to the Bungee JD

solemn shoal
#

intellij doesnt give me javadocs

eternal oxide
#

you can add them in yoru pom

#
<!-- Spigot Javadocs -->
<dependency>
    <groupId>org.spigotmc</groupId>
    <artifactId>spigot-api</artifactId>
    <version>1.16.4-R0.1-SNAPSHOT</version>
    <type>javadoc</type>
    <scope>provided</scope>
</dependency>```
tranquil viper
#

I literally changed nothign in my plugin

#

and i get this error

eternal oxide
#

Don;t use new Main

tranquil viper
#

I dont know where I wouldve done that

#

lol

eternal oxide
#

Main.java:125 perhaps

tranquil viper
#

nope

#

registering my command there

eternal oxide
#

actually BlacklistCommand.java:25

tranquil viper
#

so the issue would be in the command class mayb?

#

but why would that cause an issue

#

ive done that before

#

lol

eternal oxide
#

show yoru registering the command

tranquil viper
#

getCommand("blacklist").setExecutor((CommandExecutor) new BlacklistCommand(this));

solemn shoal
#

why are you casting it to CommandExecutor

tranquil viper
#

same format as literally every other command

eternal oxide
#

You shoudl not cast to a CommandExecutor, it shoudl implement it

tranquil viper
#

oh yea it does

#

lets go

#

thats unrelated tho

eternal oxide
#

yep

#

did you forget to delete an old jar and you haev two copies on your server?

#

?paste your main else

queen dragonBOT
tranquil viper
#

hm

#

lemme try something

#

the name of the folder with the config n stuff got all messed up

#

idk why

#

so imma try resetting it

#

i bet thats the issue

eternal oxide
#

I also recommend you rename your class from Main

tranquil viper
#

to what

#

the name of the plugin?

eternal oxide
#

Something relevant to your plugin. Usually the plugin name

tranquil viper
#

ok

#

why not main though?

#

I feel like it almost helps me keep track lol

eternal oxide
#

Main is for stand alone programs where their entry point is main

tranquil viper
#

ahh

#

ok

#

I can always do that in the fututre

#

i just need to get this fixed xd

eternal oxide
#

Plugins are simply extensions of Spigot so have no Main

tranquil viper
#

cause literally 99% of my plugin dont work now lol

eternal oxide
#

lol

tranquil viper
#

hm

#

still getting the same error

eternal oxide
#

?paste your main

queen dragonBOT
eternal oxide
#

k

#

everything there is fine. It has to be in your BlackListCommand

#

paste that

tranquil viper
#

OH

#

LOL

eternal oxide
#

ah ok

tranquil viper
#

I EXTEND JAVAPLUGIN

#

LOL

#

im actually stupid

#

i dont wanna talk about it

eternal oxide
#

also, line 29 is accessing main before its been intialized

tranquil viper
#

is it?

#

yea

eternal oxide
#

other than that and it should be BlackListCommand implements CommandExecutor ๐Ÿ™‚

tranquil viper
#

i got an error doing that

#

yea i realized that too

eternal oxide
#

and fix your getConfig() ๐Ÿ˜‰

tranquil viper
eternal oxide
#

in your BlackListCommand

#

config comes from Main

#

so you need to set it in your constructor

#
FileConfiguration message;
FileConfiguration config;

public BlacklistCommand(Main main) {
    this.main = main;
    this.config = main.getConfig();
    this.message = main.getMessages();
}```
tranquil viper
#

ok

#

so ive been doing it the way i have it in there for the message

#

should I change it for all my classes?

eternal oxide
#

yes

tranquil viper
#

ok

#

whats the difference?

eternal oxide
#

main is only initialized when your constructor is called, however the fields are initialized on class access, before the constructor runs

tranquil viper
#

ah ok

#

that makes sense

eternal oxide
#

so trying to access main in a field will result in main being null

tranquil viper
#

then im done for the day

#

cause ive been at this for a long time

#

what should I make FileConfiguration as

#

to save the file

#

because its null rn so im getting an error

#

and I cant save directly with FileConfiguration because its a static reference

eternal oxide
#
FileConfiguration fc = new FileConfiguration();
File file = new File( main.getDataFolder(), "data.yml");
fc.load(file);```
tranquil viper
#

ok thanks

#

appreciate the help

eternal oxide
#

np

lyric briar
#

Hey folks, I am trying to replace the items in player's hand/hotbar for a few minutes, then put them back in the same position they were before. To do so, I am trying to use the "extra slots" defined by Spigot, but it is not working as expected. Could someone please explain to me if this idea makes sense? I mean, what exactly are these extra slots? Can I use them as a "backup" inventory for items that I want to save?

vagrant stratus
#

Couldn't you store the UUID & item in a list and use Bukkit's scheduler or something similar?

worldly ingot
#

extra slots aren't additional slots

#

the "extra slots" are just what aren't armour slots or inventory slots

#

i.e. a player's crafting slots

lyric briar
#

Oh, okay, that makes sense now

#

thanks!

lyric briar
#

I mean, I don't want to lose what items the player had in hands if the server, for example, crashes.

lyric briar
vagrant stratus
#

I'm not really sure ๐Ÿค”
A hacky solution would be using a .yml file or similar... but that would end up with a lot of reading/writing..

#

If you wanna be 100% sure it'll survive a crash or something, you'd have to save it to a file of sorts

lyric briar
#

I see

#

I am writing a plugin about magic, they will use a wand (i.e. a stick) to switch between the magic mode (where the hotbar is full of spells) and the normal mode (minecraft items)

#

I don't to lose information about the normal mode

#

otherwise they would kill me

#

but thanks anyway

vagrant stratus
#

I'm sure I'd have something better, sadly I haven't had a reason to do that myself ๐Ÿ˜…

eternal oxide
vagrant stratus
#

There's the better answer ๐Ÿ˜‚

lyric briar
#

Hahaha, thank you Elgar!

eternal oxide
#

you could even strip it down to not bother with Base64 and just store the Bytes

lyric briar
#

Thats perfect!

#

Thank you so much

#

just one question

#

when I convert it to base64

#

does it save the lore

#

or just the item?

eternal oxide
#

Just be sure you call Player.save when you add or remove data to the PDC.

lyric briar
#

I mean, the metadata

eternal oxide
#

it saves everything

lyric briar
#

perfect, thank you!

blazing scarab
#

Why wouldnt store bytes directly in pdc

eternal oxide
#

as I already said

blazing scarab
#

Oh sorry

quaint mantle
#

hey guys

#

how could i remove the mob spawn and the creeper destruction radius

#

for my lobby

#

i dont want to get mob/creeper explosion in my lobby

#

how could i do that

eternal oxide
#

is your lobby a world?

quaint mantle
#

its not a bungeecord server

#

my lobby is technically 5 chunks in my world

#

its the same world

eternal oxide
#

then you'd have to monitor spawns and explosions and cancel them if they are in yoru defined area

quaint mantle
#

whats the even when a creeper "makes" an explosion

#

event*

quaint mantle
#

thanks

#

and how can i monitor spawns in certain chunks?

eternal oxide
tulip lodge
#

?paste

queen dragonBOT
tulip lodge
#

how to a fix this?

#

pls help

torn oyster
#
World world = Bukkit.getWorld("world_active");
        if (world != null) {
            File folder = world.getWorldFolder();
            Bukkit.unloadWorld(world, false);
            deleteWorld(folder);
        }
    
        WorldCreator wc2 = new WorldCreator("world_active");
        this.world = Objects.requireNonNull(wc2.createWorld());
        activeLoc = new Location(this.world, 0.5, this.world.getHighestBlockYAt(0, 0), 0.5);```
#

why isnt this regenerating the world

#

it doesnt throw any errors

eternal oxide
#

unloadWorld is not instant

eternal oxide
marble granite
#

what package do i need to import to access the BungeeCord class? i have net.md-5:bungeecord-api:1.16-R0.4 but i cant access the BungeeCord class with that

eternal oxide
#

What do you mean "access Bungeecord"?

keen kelp
#

how do I get more than 1 config file?

#

getConfig() doesn't take arguments

#

I mean like have more than 1 config files

keen kelp
#

thanks

#

the quick start thing or whatever didn't provide a way out

marble granite
torn oyster
eternal oxide
#

a Future or a repeating task

torn oyster
#

how do i get a future from the unload world

eternal oxide
keen kelp
#

getCustomConfig is public in main

torn oyster
#

is a World object still valid after it has been unloaded?

eternal oxide
#

no

torn oyster
#

why does worldunloadevent have the world object then

eternal oxide
#

because the event fires before the world is unloaded.

#

and its cancellable

keen kelp
#

hey ElgarL I can't access get config from other classes, ideas?

eternal oxide
#

You didn;t follow the tutorial properly.

keen kelp
#

breh

#

all I get are these when I reference to main

torn oyster
#

is /restart better than /reload

#

please give ur opinions

keen kelp
eternal oxide
#

yes

keen kelp
#

yes

#

reload breaks everything

torn oyster
#

in the scenarios:

  • only ur plugin in the server, and you are testing it
  • big server with like 20 plugins
keen kelp
#
  • reload is ok ig
  • just restart man
eternal oxide
#

It depends on how competent you are with OOP. Wether you designed your plugin to handle a reload

torn oyster
#

i used to use static in everything lmao

#

idk y

#

now i only use it in small amounts for being able to get a class' instance

#

and like util methods

keen kelp
#

am I dumb or is ```java
public void PublicMethodInMain()
{

}
#

cause if yes then I have no idea why I can't refrence it

eternal oxide
#

no

#

It all depends on how you are obtaining yoru reference to main

#

if you are using a static reference Main then no.

#

if you are using an instance, then yes

keen kelp
#

ok so what am I suppose to do if I want to call this method

eternal oxide
#

you pass a reference of your Main to whatever class needs it

keen kelp
#

like
package.name.main.PublicMethodInMain()
?

eternal oxide
#

no

#

Its called Dependency Injection. You often use it for command classes and event listeners.

keen kelp
#

main main = new main();//?

eternal oxide
#

Non DI listener = new MyEventClass(); With DI listener = new MyEventClass(this);

#

That is using DI to pass a reference of the current class to your listener

#

via its constructor

keen kelp
#

would that not create a new instance of main?

eternal oxide
#

using this? no

#

if you did new Main() it would, and your plugin woudl fail to load.

keen kelp
#

ok

#

so what do I do

#

Im so confused

eternal oxide
#

Read more tutorials and Learn Java

torn oyster
#
        World world = Bukkit.getWorld("world_active");
        if (world != null) {
            world.setMetadata("regenerating", new FixedMetadataValue(SpeedrunRace.getInstance(), true));
            Bukkit.unloadWorld(world, false);
        } else {
            WorldCreator wc = new WorldCreator("world_active");
            wc.environment(World.Environment.NORMAL);
            this.world = Objects.requireNonNull(wc.createWorld());
        }```
#

why

#

does that not work

eternal oxide
#

How does it not work?

torn oyster
#

this.world

#

is null

#

this is the unload event

#

it is registered

#

?paste

queen dragonBOT
torn oyster
eternal oxide
# torn oyster `this.world`

Thats null because its not a loaded world and you'd not set it as you are in teh else section of your code.

torn oyster
#

how do i load a world

#

doesnt worldcreator.createworld() load it

eternal oxide
#

yes

torn oyster
#

ok so

#

whats up with it

#

in the unload event

#

shouldn't it immediately load it back in

eternal oxide
#

First things first. Does your unload and delete work?

torn oyster
#

i think it deletes it yes

#

how would i test

eternal oxide
#

see if the folder is deleted

torn oyster
#

comment out the world creator stuff?

#

oh

#

it doesnt delete it

#

on unload it only deletes it

#

and it doesnt work

#

the deleting doesnt work

keen kelp
#

JavaPlugin.getPlugin(package.name.main.class).getRegenEnabledConfig()
is this how?

eternal oxide
#

The world is not going to have the regenerating meta as you never save it

eternal oxide
keen kelp
#

:(

eternal oxide
#

Its really simple and I already explained it to you

#

its something you REALLY need to understand to work with Java

keen kelp
#

ok

eternal oxide
#

Do you know what a class constructor is?

torn oyster
#

@eternal oxide how do i see world metadata

#

in the world folder

eternal oxide
#

You don;t

summer scroll
#

How can I spawn CLOUD particle without the particle being "explode"?

keen kelp
#

for some reason I feel like DI isn't what Im looking for

eternal oxide
#

You are trying to access a method that exists in your Main from inside another class. DI is what you need

keen kelp
#

ok cool

eternal oxide
opal juniper
#

Can i set the contents of an inventory whilst some1 is using it?

keen kelp
#

I dont think?

eternal oxide
#

set contents, then inventory.update()

keen kelp
#

is it really that complicated to have more then 1 config file?

eternal oxide
keen kelp
#

ok

#

so I just need to grasp the idea/

#

and it wouldn't be complicated?

eternal oxide
#

yes

#

once you understand its extremely simple

keen kelp
#

can you provide an article, I can't find any good ones

graceful turret
#

guys how to get text from the wall sign? i mean clicking at that and if text is "abc" do something

eternal oxide
#

I'll talk you through it...

eternal oxide
queen dragonBOT
opal juniper
#

How do inventories work with crafting tables

#

they aren't linked to the block are they

summer scroll
#

I'm trying to spawn a particle that stays in place, but when I spawn it the particle "explodes"

player.spawnParticle(Particle.CLOUD, location, 1);
opal juniper
#

they are just random inventories

eternal oxide
opal juniper
eternal oxide
keen kelp
summer scroll
#

Alright, I'll try it.

eternal oxide
keen kelp
eternal oxide
#

and you would instance it like so new AntiNaturalRegen(this)

summer scroll
eternal oxide
#

The spawn events are odd. Sometimes the values are locations, sometimes areas

maiden briar
#
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(reflectedField, reflectedField.getModifiers() & ~Modifier.FINAL);

In java 16 I get java.lang.NoSuchFieldException: modifiers

eternal oxide
# keen kelp yes

Adding the constructor like that and passing it a reference to your Main is called Dependency Injection. Passing references between classes

summer scroll
#

I want it to spawn exactly like this

keen kelp
#

ohh I've seen this before so that's what it's for

#

and the thing has to be same name?

eternal oxide
maiden briar
#

Yes, I have to find another way. I didn't know where the exception came from but now I know

eternal oxide
keen kelp
#

I know since main is just the "variable" name

#

I meant public "AntiNaturalRegen"

eternal oxide
keen kelp
#

main screw wine it keep trying to open links instead of firefox

eternal oxide
#

What you pass to the constructor is DI. You can even have multiple Constructors which accept multiple references.

keen kelp
#

I saw this when I was trying to do the custom damage thing in the bukkit sauce code

#

I was confused as to what it was doing

#

this cleared up a lot thanks

eternal oxide
#

If a Class has no constructor you create an instance by new YourClass(). When it has a Constructor you can only instance it by matching the constructor signature.

#

So in your example you will only be able to create an instance of that Class by passing Main.

keen kelp
#

so when I registerEvents it

#

I have to pass in Main

eternal oxide
#

it will expect you to put this inside its constructor

#

registerEvents(new AntiNaturalRegen(this), this)

#

or the other way around, I forget if the register takes plugin first or second

#

Second I think

keen kelp
#

it's the other way round

eternal oxide
#

fixed

keen kelp
#

also what's the difference between Main and main

#

cause when I pass in this

eternal oxide
#

Main is your class name. main is a Field name

keen kelp
#

it says "this" is main but it expects Main

eternal oxide
#

this is a keyword that simply means this class instance

#

You are registering your events in your Main class?

keen kelp
#

yes?

eternal oxide
#

then this is correct

keen kelp
#

but it says required type is Main but provided is main

eternal oxide
#

Show me what you mean

keen kelp
#

public AntiNaturalRegen(Main main)
{
this.main = main;
}

#

this in the AntiNaturalRegen class

eternal oxide
#

Have you imported Main?

keen kelp
#

this is in main
getServer().getPluginManager().registerEvents(new AntiNaturalRegen(this),this);

#

and here

#

the "this" in (new AntiNaturalRegen(this)

#

is underlined

eternal oxide
#

Import Main to your Anti class

keen kelp
#

I see the problem

#

the code you gave me had the variable main as type "Main"

#

but since my main is "main" no capitcal M

#

it imported some other class

#

so the type was different

eternal oxide
#

oh, rename that. ALL class should be capitolized

keen kelp
#

oh

eternal oxide
#

only package names, methods and fields should be camel case

keen kelp
#

Is it like an organization thing?

eternal oxide
#

Yep, coding standards

opaque mango
#

it's basically part of the java language specification's strategy to minimize name hiding

keen kelp
#

Intresting

opaque mango
#

*obscuring, not hiding

keen kelp
#

I have capitalized all my classes but for some reason past me just thought all lower case main is how it's suppose to be

eternal oxide
#

Standards vary by language

keen kelp
#

I learned java as my first language but since I didn't know what to do, i abandoned it for like 3 years and was pushed to learn C++

#

and recently came back because I want to make plugins

#

so a lot of basic knowledge was lost

#

I really should re-read all the books

summer scroll
eternal oxide
#

Practice and time.

eternal oxide
summer scroll
#
player.spawnParticle(Particle.CLOUD, finalLocation, 5);
opal juniper
#

Is there a generic Event for a player moving an item between or in an inventory

eternal oxide
summer scroll
#

And get the location from the block.

eternal oxide
#

The "cloud" particle is normally After jumping into water while on fire in Bedrock Edition or an entity dies in Java Edition.

#

I bleieve it has a random trajectory set in teh particle

opal juniper
#

no

#

That is like a hopper

#

Just found that out the hard way

summer scroll
#

So I need somehow set the trajectory?

eternal oxide
#

You probably need to use a different particle

opal juniper
#

well.... its not what i asked ๐Ÿคท

eternal oxide
summer scroll
#

So there is no way to make the cloud particle stays in place?

quaint mantle
#

set the velocity to a very low number?

#

Ah

#

nvm then

eternal oxide
#

I guess poof no longer exists., probably renamed

#

EXPLOSION_NORMAL

#

I guess

lofty junco
#

does anyknow how to teleport a target player to a specific plot in the plotsquared api?

summer scroll
#

feelsbadman

opal juniper
summer scroll
eternal oxide
#

zero

summer scroll
#

I already tried that.

#

And same thing.

#
player.spawnParticle(Particle.CLOUD, finalLocation, 5, 0, 0, 0);
eternal oxide
#

did you try the method where you can supply the speed?

#

add one more zero

summer scroll
#

it works lmao

#

by adding one more 0

#

thanks Elgar

eternal oxide
#

the first three zeros you can increase to add a little randomness to the location

summer scroll
#

and the last is the data, idk what that is

eternal oxide
#

extra - the extra data for this particle, depends on the particle used (normally speed)

high gulch
#

is there any worldedit plugin

summer scroll
#

randomness means like the particle would spread?

eternal oxide
#

yes

#

well, it would spawn slightly off your set location

#

so not all in once place

summer scroll
#

alright, thanks y'all

burnt tundra
#

Hey, I want to cancel a VehicleExitEvent, but it doesn't work. I found it was a bug of spigot (https://hub.spigotmc.org/jira/browse/SPIGOT-1588) but it is marked as fixed. Do you know if it was really fixed, or if the last comment is considered as being the fix ?

eternal oxide
#

its a double so upto 0.5 would all be in one block space

summer scroll
#

in delayed time

#

yeah, that'd fixed my issues.

wraith rapids
#

@high gulch no worldedit was taken down and deleted

pastel carbon
#

Do u guys know a good example plugin that would use the eventhandlers and stuff. Idk how to register them or where to put them so they would get called

eternal night
pastel carbon
#

thanks

charred vigil
#

i have a problem: i want a command that is for example called /hello and i want to have 5 possible ways the server responds : hello/ how are you / hope you have fun playing minecraft/need any help/have fun. but i want the server to chose one of them randomly and then only wrote one of them: can someone help me

summer scroll
charred vigil
#

like what

summer scroll
#

wdym?

charred vigil
#

how do i do this

eternal night
#

that is java basics o.O

#

you can just google it

charred vigil
#

but just because it is a basic it does not mean i know how to do it

eternal night
#

Yeah but it means the information is easily accessible online

charred vigil
#

oh ok then i misunderstood you

#

my fault

eternal night
#

yeah, pretty much what NNY posted should be enough to solve this

charred vigil
#

ty

tribal holly
#

Is there a thing inside spigot to remove the spawn protection ?(i wanna do it inside my plugin)

eternal night
#

Nothing official I am afraid, you would have to use reflection to modify the value

tribal holly
#

huuu

eternal night
#

Yes but that isn't inside the plugin code

tribal holly
#

i don't wanna the user to change it by it self

#

i wanna pre-configur the server with the plugin

eternal night
#

it is not tho xD

tribal holly
#

what ??

eternal night
#

while not changing the file, they could very much modify the value in the nms.DedicatedServer

#

what prevents them from just modifying the variable the value is stored in once their plugin starts ?

#

am I missing something

#

smart

tribal holly
#

this is not an event from spigot

eternal night
#

no, no it isn't. There is nothing in the official spigot-api that allows you to do this

quaint mantle
#

hi guys, so I'm using Eclipse and I'm not able to implement ParticleLib with Maven into my project. Idk why when I try to compile it doesn't compile the ParticleLib into it...

eternal night
#

you will either have to a) modify the server.properties file and ask the server owner to restart or b) modify the variable the spawn-protection value is loaded into

tribal holly
#

okay i see

#

but where did i need to apply this boolean ?

eternal night
#

what boolean xD

tribal holly
#

canBuild

eternal night
#

oh, that value is calculated. Have you ever worked with reflection and the net.minecraft.server code ?

tribal holly
#

never

#

huu

eternal night
#

oooof

tribal holly
#

yes a litle bit sry

#

but not a lot

eternal night
#

Ah

#

I think you are better off modifying the server.properties file from your plugin then

tribal holly
#

okay thx

quaint mantle
#

can someone help me with this then please?

eternal night
#

did you configure the maven-shade-plugin ?

quaint mantle
#

idk, what's that?

eternal night
#

the maven plugin you need to actually compile/shade your dependencies into your jar

quaint mantle
#

I think I will send you screenshots about my problem ๐Ÿ˜‚

eternal night
#

yes

#

you need the maven shade plugin

#

as I said

quaint mantle
wraith rapids
#

yes

quaint mantle
wraith rapids
#

you need the maven shade plugin

eternal night
#

๐Ÿ˜ฆ

#

I feel robbed

#

you seem to also be missing your spigot-api ? xD

opal juniper
#

I have a Custom Inventory that i make when a player opens a crafting table. I am using this:

    private Inventory inventoryMaker(InventoryHolder holder, Location location){
        Inventory inventory = Bukkit.createInventory( holder, InventoryType.WORKBENCH,"G");
        ItemStack[] contents = new ItemStack[10];
        contents[0] = null;
        for(int i = 1; i <= 9; i++) contents[i] = this.plugin.getItemFromTag(Objects.requireNonNull(location).getBlock(), "Slot"+i);
        // ^^ Using RedLib to get contents from persistant block data

        inventory.setContents(contents);

        return inventory;
    }

Which works, however i feel there is a problem with the holder as when i then try to get the block from the inventory it hucks a nullPointerError.

#

I am calling it like this:

event.getPlayer().openInventory(this.inventoryMaker(inventory.getHolder(), inventory.getLocation()));
#

But if i was to do this:

    @EventHandler
    public void onClose(InventoryCloseEvent event) {

        event.getInventory().getLocation().getBlock();
    }

It throws the null pointer on the getBlock()

wraith rapids
#

are you sure it throws it on the getBlock specifically

sleek dragon
#

how would I detect if a player clicked on one of the 4 crafting slots in their inventory? SlotType.CRAFTING seems to be for a crafting table only, and I don't know think InventoryClickEvent is called.

opal juniper
#

i removed it and it worked fine

wraith rapids
#

i suppose the inventory returns null as its location then

opal juniper
#

however i am now having problems starting my server ><

sleek dragon
#

couldn't you save the location/block when they first access it?

opal juniper
#

And then what would i use as an identifier

sleek dragon
#

you're trying to get the crafting table block they right clicked right

opal juniper
#

Not really

wraith rapids
#

what are you even doing anyway

quaint mantle
#

....

opal juniper
#

So i am making a crafting table that has persistent item storage, however now i need it to work for multiple people at the same time. Because the crafting table inv is not a common one i am making a new inv and showing it to the player when they interact instead of the default one

#

This is the working example

wraith rapids
#

and the issue is

sleek dragon
#

meaning if I leave an item in the crafting table someone will be able to see it in the grid when they open it?

opal juniper
#

yeah

#

but if two players open the same one, it dupes the items

#

because i am just adding them to the inv

wraith rapids
#

instantiate a single inventory per block

opal juniper
#

Yeah, thats the idea

wraith rapids
#

and let the inventory handle maintaining its state over multiple viewers

#

Block -> Inventory map

#

populate the inventories on chunk load or whatever

opal juniper
#

oh, hmm

wraith rapids
#

or alternatively when the blocks are first clicked

eternal oxide
#

populate the inventory on access

sleek dragon
#

or just whenver a player opens it

#

yea

#

probably better

wraith rapids
#

depends on how you're populating them

opal juniper
#

anyone know what this means tho

wraith rapids
#

doing it on chunk load may be more performant

sleek dragon
#

world gen issue?

sleek pond
opal juniper
#

yeah

sleek pond
#

i would guess either world or server jar

opal juniper
#

i just re-ran bt and it works

#

ok

eternal oxide
#

even if you load the inventory from file (individually) the momentary lag of it populating will not be noticeable to the player.

opal juniper
#

its the server jar

wraith rapids
#

yeah, but having to check said file on every right click of every crafting table is noticeable to the server admin

eternal oxide
#

cached

opal juniper
#

Is it doing that tho, i thought it was cached

#

yeah

wraith rapids
#

again depends on how you're populating it

opal juniper
#

I am using RedLib for it

wraith rapids
#

i don't know how performant red's txt lib is

opal juniper
#

It seems pretty amazing tbh but i haven't done any testing

wraith rapids
#

assuming it's just a Block -> data map too, it should be fine to do it on access

#

if it's slower, you'd want to load it in bulk on chunk load

opal juniper
#

what idk tho is why i am getting this error

wraith rapids
#

your jar is missing a class or the classloader is fucked

opal juniper
#

noonn

#

i fixed that

wraith rapids
#

what error are you talking about then

opal juniper
#
Caused by: java.lang.NullPointerException
    at com.jeff.workbenchplus.listeners.SaveItems.onClose(SaveItems.java:37) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:315) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
    ... 19 more

wraith rapids
#

something is null

opal juniper
#

why the block is null

wraith rapids
#

the block isn't null

#

the location is null

#

the inventory you created doesn't have a location associated with it

opal juniper
#

Wait, you right

#

im dumb

wraith rapids
#

location.getblock never returns null

#

even if the block would be outside of the world

sleek dragon
#

lol thats why i was confused

opal juniper
#

But i thought that if you gave the inv the InventoryHolder it transferred data like that

sleek dragon
#

just store it when you first open it

wraith rapids
#

depends on the inventory; the workbench inventory probably doesn't

eternal oxide
#

Don;t create an Inventory, get it from teh Block. If you create a WORK_BENCH it will not work correctly as a crafting table.

wraith rapids
#

get the information directly from the holder I suppose

keen kelp
#

Guys so here is my config.yml, I've got all the create file and stuff done, but how do I load it in as a string array?

#
excluded-worlds:
  - exampleWorld1
  - exampleWorld2
  - exampleWorld3
opal juniper
#

Its just idk how to deal with people accessing it simultaneously

wraith rapids
#

yeah that won't work then

keen kelp
#

oh

wraith rapids
#

pretty sure the workbench inventory works even if you simply create it

eternal oxide
#

config.getStringList("excluded-worlds")

wraith rapids
#

it's not a furnace

#

it doesn't get ticked

#

the whole process is clientside

keen kelp
#

ok thanks

opal juniper
#

i just tried it

wraith rapids
#

well then you're kind of fucked

eternal oxide
tribal holly
#

i just add to the tutorial of installing my plugin "set spawn-protection to 0"

eternal night
#

valid

eternal oxide
#

I know furnaces won;t work like that, but I'm suspicious of crafting too

wraith rapids
#

does it create a new instance of the inventory for each player in under the hood then

eternal oxide
#

It might

wraith rapids
#

well, persist one of those instances

#

and use it

keen kelp
wraith rapids
#

next thing to be uncertain of is how the clearing slots mechanic works

eternal oxide
#

No it returns a List<String>

wraith rapids
#

since normally, when a player closes the inventory, the slots are cleared

tribal holly
#

i take the spoon feed thx

opal juniper
wraith rapids
#

the question is whether that happens when the last player viewing it has closed the inventory

#

or whather it happens when any player closes it

eternal oxide
#

Items shoudl drop to teh floor

eternal night
#

actually, wouldn't recommend xD

#

that field is final

#

jigsaw is gonna come for you

keen kelp
eternal oxide
#

?paste

queen dragonBOT
wraith rapids
#

if it happens when any player closes it, you're kind of fucked, I don't see a reliable way of maintaining inventory state without flicker or jitter if that is the case

#

if it happens only once the last viewer closes it, you should be fine

opal juniper
#

the problem is that when a player closes the inventory i have it to clear the inv

wraith rapids
#

y

opal juniper
#

cause if not the items ended in the players inv

wraith rapids
#

in that case you're extra fucked

opal juniper
#

i guess i could just do a getViewers()

#

and check it isn't == null

wraith rapids
#

it'll never be null

#

but it may be empty

opal juniper
#

thats what i mean, sorry

eternal oxide
wraith rapids
#

i suppose the best you could do, then, is to have a separate inventory for each viewing player, and when any player mutates the contents of their inventory, reflect the changes in all of the other currently open inventories

#

kind of expensive, and going to result in some jitter, but based on what you've said I don't see any other way around it

opal juniper
#

but i couldn't find a good event for the moving items

wraith rapids
#

click/drag event

#

you'll have to do some of the calculations of where stuff ends up at yourself for shift clicks

#

and collect to cursor

#

and a few others

opal juniper
#

yeah

#

ok, lemme try this again then

sleek dragon
#

on the subject of crafting

#

how would I detect if a player clicked on one of the 4 crafting slots in their inventory? SlotType.CRAFTING seems to be for a crafting table only, and I don't know think InventoryClickEvent is called.

wraith rapids
#

i don't remember how the inventory crafting table works

#

a lot of stuff about the player's inventory is clientside

#

but going by common sense clicking those slots should still fire events

keen kelp
#

is there an event for player disconnecting

keen kelp
#

found it right after I sent that

#

PlayerQuitEvent

eternal oxide
#

I just tested and a WORK_BENCH inventory thats not backed by an actual crafting table knows no recipes.

sleek dragon
#

wym

#

it doesnt detect it when i tried that

opal juniper
#

does the InventoryClickEvent fire late enough that i can do inventory.getContents() ?

wraith rapids
#

it fires before anything is actually modified iirc

lusty cipher
#

What are some good items I could use for a back/forward in a paged inventory? I currently just use different shades of blue glass planes.

sleek dragon
#

people usually use arrows

#

but you can use player heads

wraith rapids
#

glass panes are generally fine

#

can always texture them to be actual arrows with a resourcepack

sleek dragon
#

yea if ur using a resourcepack there a lot more possibilities

tribal holly
#

huuu my player has regenration but don't regen (i don't have event listening regenEvent)

keen kelp
#

how do I store yml files in a folder within the plugin's folder if that makes any sense

lusty cipher
#

JavaPlugin#saveResouce and JavaPlugin#getResource @keen kelp

keen kelp
#

no I mean like a

eternal oxide
#

The File you create points to teh location

keen kelp
#

subfolder

wraith rapids
#

create a folder

lusty cipher
#

well just put the files into src/main/resources/subfolder

wraith rapids
#

then put the files in it

eternal oxide
#

just be sure to save your config using plugin.saveDefaultConfig() in your onEnable to be certain your plugin directory has been created

wraith rapids
#

there is no good way to extract an entire directory out of the jar though I don't think

eternal oxide
#

He's not on about resource files

wraith rapids
#

whot

keen kelp
#

No Im trying to do a player storage thing

wraith rapids
#

just create a directory

eternal oxide
#

Do as I just said

wraith rapids
#

and then you have a directory

#

and then you can put files in it

lusty cipher
#

he wants to store into plugins/YourPlugin/subfolder (for example)?

wraith rapids
#

it's not rocket science

keen kelp
#

yes

eternal oxide
#

when you followed that Tutorial earlier it would have had you create a File. new File( plugin.getDataFolder(), "filename.yml")

keen kelp
#

yeah?

opal juniper
#

How can you compare two ItemStack[]

eternal oxide
#

That defines where the file goes and what its name is

#

so when you have your fc you can fc.save(file)

keen kelp
#

how do I tell it to go into a subdirectory though

eternal oxide
#

you want it in a folder under your plugin folder?

keen kelp
#

yes

lusty cipher
keen kelp
#

I was thinking each player has their own storage with the file name being their UUID

eternal oxide
#
File file = new File( plugin.getDataFolder() + SystemProperty("File.separator") + "subfolder", "filename.yml");
file.mkdir();```
wraith rapids
#

Arrays.equals

sleek dragon
#

cant seem to cancel a player putting an item into their crafting grid but I can cancel them taking something out of it

eternal oxide
#

however you will then have to call file.mkdir()

wraith rapids
#

File.separator btw :fingerguns:

eternal oxide
#

yeah, he can google that part ๐Ÿ™‚

keen kelp
#

how do I create a directory?

opal juniper
#

mkdir()

keen kelp
#

thanks

#

does it break anything if the directory already exisits?

eternal oxide
#

no

opal juniper
#

How to create an itemStack of Material Air amount 0 ?

keen kelp
#

so I dont need to check if it already exisits or things like that correct?

eternal oxide
#

correct

eternal oxide
opal juniper
#

mc uses

eternal oxide
#

new ItemStack(Material.AIR)

opal juniper
#

Yeah, but that creates

#

And i cannot reliably compare them

#

well, maybe actually

#

but it is more of a pain

eternal oxide
#

isSimilar