#help-archived

1 messages · Page 83 of 1

tiny dagger
#

check the nether/region

#

folder

velvet scaffold
#

okay there are some files in there

#

but they are all very small file sizes

tiny dagger
#

it doesn't matter

#

look if there are random ones

#

like further from 0,0

velvet scaffold
#

there are random ones that arent 0 0

#

some are 0 1

#

and some go to 2 -1

tiny dagger
#

that's not that far tho

#

that's most likely the spawn loaded chunks or however is called

velvet scaffold
#

yeah

#

it seems my backup may have failed

#

but in my not backup they go up to 7 5

#

but only as far as 2 -1

#

r.0.0.mca
r.0.-1.mca
r.0.1.mca
r.-1.0.mca
r.1.0.mca
r.-1.-1.mca
r.-1.1.mca
r.1.1.mca
r.1.-1.mca
r.-2.0.mca
r.-2.-1.mca
r.-2.1.mca
r.6.4.mca
r.6.5.mca
r.7.4.mca
r.7.5.mca

tiny dagger
#

it seems fine

velvet scaffold
#

ok thanks for the help i will see if this backup works

#

@tiny dagger this hasnt changed anything, the region files are there but it seems like all edits to the nether are gone

#

could this be to do with switching from fabric to spigot? the only plugin i have installed is core protect

vocal solstice
#

Question, is maven important or just a preference?

magic escarp
#

is there a way to monitor all currently loaded chunks?

stark salmon
#

Caused by: java.lang.IllegalArgumentException: Parameters not allowed in this parameter set: [<parameter minecraft:damage_source>, <parameter minecraft:killer_entity>, <parameter minecraft:last_damage_player>]
anyone know what that means

wet bronze
#

Can anybody help me with dynmap? I made a world border then did /wb fill, then I added dynmap and did /dynmap fullrender, and there's still huge chunks of black on the dynmap. The fullrender isn't finished yet but the black chunks haven't gone anywhere after almost 24 hours of fullrendering.

#

It's also not that big of a map inside the world border, only 5k x 4k

hollow temple
#

Hi, is anyone else having trouble searching for spigot plugins? Whenever I go to search for the the only way it will search is by Last Update, even when I have any other option selected

wanton vine
#

anybody know why lava and water dont flow on my server?

frigid ember
#

Quick question what would getItemInHand be now?

torn robin
#

@wanton vine if you have worldedit installed try /stoplag-c

wanton vine
#

it says all intensive server activity is now allowed

torn robin
#

@frigid ember getItemInMainHand and getItemInOffHand respectively

#

That’s should’ve fixed it

#

That should’ve *

wanton vine
#

nope

#

still wont flow

frigid ember
#

@torn robin getItemInMainHand isnt a thing.

torn robin
#

Any other plugins?

wanton vine
#

a lot

torn robin
#

@frigid ember Player#getInventory#getItemInMainHand ?

frigid ember
#

ah

#

didnt try that thanks

torn robin
#

👍

#

@wanton vine when did it start happening?

latent rock
#

If I have a 4K custom world that I want players to explore apart from survival, shud I use Multiverese or Bungeecord for it?

wanton vine
#

literally right now haha

torn robin
#

Did you install anything new?

#

Changed any config setting, etc?

wet bronze
#

@torn robin could you help me with my problem?

torn robin
#

Put it in here and anyone can give advice Janny

#

@latent rock do you just mean a big world? What version is it?

latent rock
#

1.15.2

torn robin
#

I wouldn’t use either, I’d probably pre generate it so it isn’t too laggy

#

Look at world border, it should do what you’re looking for

latent rock
#

i have it

storm vessel
#

is there a way to pm everyone on the server?

brisk mango
#

with a command?

torn robin
#

You mean your MC server @storm vessel ?

brisk mango
#

Bukkit.getOnlinePlayers().parallelStream().forEach(p -> {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pm " + p.getName() + " " + message);
}

storm vessel
#

@torn robin Yes

#

I mean with a command

torn robin
#

What temedy said

storm vessel
#

Is that possible

torn robin
#

Idk why you would want to but yes it’s possible

storm vessel
#

I don't want to have to write a whole new plugin

torn robin
#

Uhhh

brisk mango
#

Bukkit.getOnlinePlayers().parallelStream().forEach(p -> {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pm " + p.getName() + " " + message);
}
@storm vessel

torn robin
#

A plugin would be much easier

#

You could also just /say

upbeat linden
#

Can I ask for a little development help here?

brisk mango
#

yeah

upbeat linden
#

Ok awesome

#

So I've spent the past day or so trying to write a plugin

storm vessel
#

I don't want players to know that other players received the message

brisk mango
#

They wont?

upbeat linden
#

and I'm currently trying to have my plugin generate Essentials Shop signs

#

like Buy/Sell

#

I have signs creating with the proper formatted text on them

brisk mango
#

uhh essentials

upbeat linden
#

I'm already hooking into essentials to get prices from worth.yml

#

EssentialsX

#

yeah sorry this is kinda a specific question

brisk mango
#

Im not familiar with essentials, that is some real shit code

torn robin
#

Idk If essentials works that way

upbeat linden
#

yeah I'm lost as hell in it

#

I'm just tryin to figure out if theres a good way for me to do this

#

I looked

#

it seems like they check for new signs onSignChangeEvent

brisk mango
#

eh

upbeat linden
#

So I'm not sure how I should handle that

brisk mango
#

just use PlayerInteractEvent

torn robin
#

There’s probably an api method in essentials

upbeat linden
#

can I call that event?

brisk mango
#

and check the state

upbeat linden
#

I looked, and I can't really find it

#

What do you mean check the state?

brisk mango
#

if(event.getClickedBlock().getState() instanceof Sign) {
//Do stuff
}
torn robin
#

You could call sign change event, shouldn’t be too hard

upbeat linden
#

I'm using playerinteractevent to generate the signs

#

So how do I call an event?

torn robin
#

Temedy are you saying to recreate how essentials handles buy/sell signs

upbeat linden
#

I'm lost with that

torn robin
#

Bukkit.callEvent

brisk mango
#

why do you need to call event

torn robin
#

You can create a event with
new SignChangeEvent(Params)

#

So essentials registers the sign temedy

brisk mango
#

Creating ur own event isnt really good but ye

upbeat linden
#

Yeah I wanted to see if there was a way I didn't have to create my own event

torn robin
#

Agreed but I can’t think of a better solution unless there’s an api specifically for that

upbeat linden
#

Like I feel like there has to be a better way

brisk mango
#

but I still do not know exactly, what are you trying to accomplish

upbeat linden
#

I mean like I was looking in their API

#

Right click, shop sign generates

brisk mango
#

then just use PlayerInteractEvent

upbeat linden
#

Yeah okay that's what I've done so far

#

And I'm generating signs

#

they're just not registering as essentials shop signs

brisk mango
#

public final class Main extends JavaPlugin {
@Override
public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(new Listener() {
@EventHandler
void onInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();

if(event.getClickedBlock() != null) {
if(event.getClickBlock().getState() instanceof Sign) {
event.getClickedBlock().setType(Material.SIGN);
}
}
}
}, this);
}
}
upbeat linden
#

Yeah So I have a whole thing for generating signs already

#

and thats working

fathom shard
#
prices:
  stone: 1.0
  cobblestone: 1.0``` I have this config section and i try looping over it but it throws an NPE ```java
        config.getConfigurationSection(rootKey).getKeys(false).forEach(sKey -> {``` so i logged `rootKey` and it prints null but it shouldn't, any ideas?
brisk mango
#

I have no idea how to make it work with essentials, as I said its some real shit code

upbeat linden
#

But unfortunately the generated signs won't register

#

ah okay

#

thats fair

brisk mango
#

what is rootKey mason

fathom shard
#

in this instance

#

its prices

upbeat linden
#

Lemme find one more thing and ask

brisk mango
#

yeah but where do you create the variable

#

show me

upbeat linden
#

I'm not fantastic at Java lol

fathom shard
#
    public void loadPrices() {
        final File essentials = new File("plugins/Essentials/worth.yml");
        final File config = new File("plugins/ChestSellV2/config.yml");
        if (essentials.exists()) {
            Bukkit.getLogger().log(Level.INFO,
                    "Essentials has been found. If you wish to use this enable it in your config.yml by setting essentials-price to TRUE.");
            if (getConfig().getBoolean("use-essentials-worth-yml")) {
                Bukkit.getLogger().log(Level.INFO,
                        "This plugin is configured to use Essentials worth.yml");

                parseConfigFile(essentials, "worth");
                return;
            }
        }
        parseConfigFile(config, "prices");
    }``` a bit ugly but its a rough work up parseConfigFile is just a call method for the looping
upbeat linden
#

Wait how do you send code in this?

torn robin
#

Markdown

upbeat linden
#

Ah okay

brisk mango
#

and isnt something else null @fathom shard

#

oh wait cant

fathom shard
#

Nope logging rootKey prints null

brisk mango
#

show me the code in .forEach(key ->

#

or maybe the method parseConfigFile

upbeat linden
#

[CODE=java]public class SignCreateEvent extends SignEvent {
public SignCreateEvent(EssentialsSign.ISign sign, EssentialsSign essSign, IUser user) {
super(sign, essSign, user);
}
}[/CODE]

#

I just 100% thought that was markdown

#

ah that bbcode lol

torn robin
#

Discord markdown

#

Quick google

fathom shard
#

@brisk mango its commented out because i had to log so without looping it still prints null just logging rootKey

upbeat linden
#

yeah just did

#

public class SignCreateEvent extends SignEvent { public SignCreateEvent(EssentialsSign.ISign sign, EssentialsSign essSign, IUser user) { super(sign, essSign, user); } }

fathom shard
#

so the issue lies with rootKey

brisk mango
#

well if prices is an section

#

it cant be null

#

yeah but how about the parseConfigFile

fathom shard
#

apparently it is

brisk mango
#

what are you doing there

fathom shard
#
    public void parseConfigFile(File file, String rootKey) {
        final YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
        System.out.println(config.get(rootKey));
  }```
#

Is where i log rootKey

#

And thats where it prints null

brisk mango
#

im not sure what .get does

torn robin
#

Print rootKey

fathom shard
#

null

upbeat linden
#

So if that's the API code for essentials SignCreateEvent,

torn robin
#

Not get(rootKey)

fathom shard
#

oh i see

brisk mango
#

if you print out only rootKey its not null

fathom shard
#

one sec

brisk mango
#

lol

#

its because youre doing config#get

#

because get gets an object in a path not a section

upbeat linden
#

Could I try to use that maybe?

#

I'm honestly not sure

brisk mango
#

im not sure too

fathom shard
#

@brisk mango prints prices

#

which is right

brisk mango
#

so just do

upbeat linden
#

good call

brisk mango
#

config.getConfigurationSection(section).getKes(false).forEach(key -> {

}

torn robin
#

getCondiguration(rootKey)

#

and then getKeys() from that

upbeat linden
#

You guys have any ideas for where I could look or places to ask about the Essentials Signs?

brisk mango
#

Why are you asking in spigot discord lol @fathom shard

fathom shard
#

no one is alive in TSC :P

brisk mango
#

ah, there is some big noobs in this discord

upbeat linden
#

Nowhere I should ask?

brisk mango
#

ask someone that knows how to work with essentials

#

im not familiar with it @upbeat linden

upbeat linden
#

Yeah I know no one

#

do you know anyone?

torn robin
#

?

upbeat linden
#

I'm so new to plugin development I have no idea where to ask about stuff

torn robin
#

You still talking about the Signs?

worldly heathBOT
#

Edit this to change the output of the command!

upbeat linden
#

yeah I am

fathom shard
#

@brisk mango i love this shit lol i just printed getConfigSection(rootKey) and printed the rootKey right now i go to for Each and its erroring again love it

torn robin
#

Did you try recreating a SignChangeEvent?

upbeat linden
#

I didn't is that worth a try?

#

I just felt like that was too hacky-feeling

torn robin
#

id try it

#

It’s very hacky yes

upbeat linden
#

Alright fair

torn robin
#

4eh you getConfigSection(rootKey).getKeys()

upbeat linden
#

well I appreciate this a lot

brisk mango
#

I mean if thats in a different class and the null pointer errors on that line, the config could be null, anything, but I havent seen all of the code so i cant really tell, with the code you sent, there cant be nothing wrong with it @fathom shard

upbeat linden
#

thanks so much @brisk mango @torn robin

torn robin
#

Then you loop through each key and add rootKey + “.” + key to get the value

fathom shard
#

nope same class config is not null, its just being an ass as usual

torn robin
#

👍

brisk mango
#

can you send me full class

fathom shard
#

im not proud of it to send it so let me clean test if it doesnt work ill come back

brisk mango
#

it doesnt matter that the code isnt that good

#

i make shit codes sometime too

fathom shard
#
    public void parseConfigFile(File file, String rootKey) {
        final YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
        config.getConfigurationSection(rootKey).getKeys(false).forEach(sKey -> {
            final Double price = config.getDouble(rootKey + "." + sKey);
            this.prices.put(sKey, price);
        });
        System.out.println("[ChestSellV2] A total of " + this.prices.size() + " items have been registered.");
    }``` I removed a bulk of code that really was worthless
#

wait now that doesnt make sense really hm

brisk mango
#

you know that you dont have to make the Double non-primitive

fathom shard
#

tbfh

#

i forgot

brisk mango
#

i mean that makes no sense to me why would it be null

fathom shard
#
config.getConfigurationSection(rootKey).getKeys(false).forEach(sKey -> { } ``` is line 97
#

where its throwing the error

torn robin
#

The forEaches are much harder to read than regular fors

brisk mango
#

bruh this fucking java shit is killing me

#

no they arent

#

its just easier and faster to use a consumer

torn robin
#

It’s an opinion

#

Print out they keys of the base file

#

config.getKeys

#

Print that out please

brisk mango
#

only hard to read if you dont know lambda @torn robin

torn robin
#

I’m on mobile

brisk mango
#

well you said in general its much harder to read, w/e

torn robin
#

In general fors are easier to read for me

#

Again, it’s an option, you don’t need to correct or dictate peoples options

brisk mango
#

isnt the file null @fathom shard

fathom shard
#

nope

brisk mango
#

like

#

does the YAML exists

#

if so, why are you reloading it

velvet scaffold
#

I'm looking for a plugin that can make edits to the mob cap, can anyone reccomend anything?

fathom shard
torn robin
#

@velvet scaffold spigot.yml probably

#

Can you print out the keys of config?

#

config.getKeys()

velvet scaffold
#

me?

brisk mango
#

bruh

#

he is doing a forEach method which means its already null

#

why should that help that

fathom shard
#

[] empty but it shouldnt be 🤔

brisk mango
#

the only thing i could think that is null is config but no idea

#

show screenshot of config.yml

fathom shard
#

this is server one

#

not resources

#

both same

torn robin
#

Where are you calling parseConfig?

brisk mango
#

look above

torn robin
#

I don’t see it

fathom shard
#

i call it on loadPrices method that will read the section to be used on a vent later

#

event*

brisk mango
#

well, but YamlConfiguration is not null then

#

if it prints an empty array

fathom shard
#

its the section

#

which is strange

#

it exists

brisk mango
#

I mean alot of weird shit happens to me too and it doesnt make any sense

#

like java not being to able access an public class

#

I have no idea honestly, this code should work

#

maybe try restarting intellij and check if the code is there

#

lol

fathom shard
#

System.out.println(config.getConfigurationSection(rootKey)); is null

#

nothing with intellij

#

i already tried

#

only guess is my config is messed up?

velvet scaffold
#

i dont see anything in the spigot config file for mob cap

brisk mango
#

I think its spigot and java that is messed up lmao @fathom shard

torn robin
#

maybe bukkit.yml?

brisk mango
#

same shit happen to me with BukkitRunnable

#

when i used it

torn robin
#

@fathom shard last time can you output config.getKeys

velvet scaffold
#

im looking for something that is able to increase the mob cap based on number of players online (essentially to increase the efficiency of farms when many players are afking farms)

fathom shard
#

i did

#

it printed []

torn robin
#

Wack

fathom shard
#

as i said above

torn robin
#

I misunderstood

#

and you’re defining the file where?

brisk mango
#

bruh it has nothing to do with the file its just the keys that are null @torn robin

torn robin
#

Yes and the keys get it from the file

#

I’m just trying to figure out why they’re null

brisk mango
#

no, they get it from the YamlConfiguration

#

which is not null

torn robin
#

Which is from the file

fathom shard
#
    public void loadPrices() {
        final File essentials = new File("plugins/Essentials/worth.yml");
        final File config = new File("plugins/ChestSellV2/config.yml");
        if (essentials.exists()) {
            Bukkit.getLogger().log(Level.INFO,
                    "Essentials has been found. If you wish to use this enable it in your config.yml by setting essentials-price to TRUE.");
            if (getConfig().getBoolean("use-essentials-worth-yml")) {
                Bukkit.getLogger().log(Level.INFO,
                        "This plugin is configured to use Essentials worth.yml");

                parseConfigFile(essentials, "worth");
                return;
            }
        }
        parseConfigFile(config, "prices");
    }```
brisk mango
#

Logically, when a YamlConfiguration is not null, then File cant be because YamlConfiguration uses file as an parameter @torn robin

fathom shard
#

i have to use File to use essentials worth

brisk mango
#

are you using essentials

fathom shard
#

otherwise id just default to FileConfiguration

#

in this instance no but i cant limit that

#

want me to try using FileConfiguration?

brisk mango
#

shouldnt be any difference

fathom shard
#

there is

#

MemorySection[path='prices', root='YamlConfiguration']

#

is printd now

brisk mango
#

ah

#

then use FileConfiguration

#

idk this shit is weird

fathom shard
#

but i cant

#

lol if i need to access essentials

#

unless i can load a File to FileConfiguration

brisk mango
#

maybe, just dont use essentials

#

and it will work LOL

fathom shard
#

okay nailed it down

#

YamlConfiguration.loadConfiguration(file);

#

is the culpret

#

without it loads and prints fine

#

with it prints null

brisk mango
#

lol i dont get this

fathom shard
#

unless its final File config = new File("plugins/ChestSellV2/config.yml");

#

but that makes no sense

#

like at all

torn robin
#

Hear me out

brisk mango
#

i mean its just because of spigot

torn robin
#

What if you used the essentials API to get the prices

fathom shard
#

because they might wanna use my prices

#

i mean realisticaly

#

i could just transfer the essentials file and force them to configure via mine

frigid ember
#

Question: Is it efficient to update mutliple config nodes even when you don't necessiarily have to update all the config nodes, but just to ensure that order of config nodes is correct?

fathom shard
#

yeah imma do that

torn robin
#

4eh you could allow an override file

#

and if it’s not in that file just default to essentials’

brisk mango
#

@frigid ember i dont understand your question

torn robin
#

@frigid ember doesn’t sound efficient but if you care about order ig why not

#

As long as it isn’t like 200 keys you should be fine

brisk mango
#

i mean

#

i would never go for config files

torn robin
#

JSON

#

?

worldly heathBOT
#

Edit this to change the output of the command!

brisk mango
#

YAML files* or loading shit into memory

#

not even json

#

DB is the best

#

that other shit isnt worth it

#

especially if you store alot of data

torn robin
#

DB is a pain imo

#

Specifically with all the async loading

#

It’s useful just painful

brisk mango
#

its not painful

#

What is painful with async loading?

#

lol

fathom shard
#

@brisk mango its public well im making it in return i get a permanent free MC server so

torn robin
#

data management mostly

brisk mango
#

mk

torn robin
#

I was doing 1.13 not sure if asynclogin wasn’t deprecated

fathom shard
#

Oh also @brisk mango u got a good way to load a prices.yml?

torn robin
#

Good deal 4eh

fathom shard
#

so instead of using config i use a new file

brisk mango
#

like create the file and etc?

fathom shard
#

well a way to create it and use it as like another FileConfiguration

#

and then read the keys from that

brisk mango
#

I mean i dont have a FileConfiguration way but ive got this

fathom shard
#

so long as i can for each the config section and get what i need it's all good

brisk mango
#
public final class DataFile {

    private final Main plugin;
    private final String name;

    private File file;
    private YamlConfiguration config;

    public DataFile(Main plugin, String name) {
        this.plugin = plugin;
        this.name = name;
    }

    public boolean setup() {
        file = new File(plugin.getDataFolder(), name);

        boolean succeded = false;

        if (!file.exists()) {
            try {
                succeded = file.createNewFile();
                config = YamlConfiguration.loadConfiguration(file);
            } catch (Throwable reason) {
                throw new RuntimeException(reason);
            }
        }

        return succeded;
    }

    public void save() {
        try {
            config.save(file);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    public void reload() {
        config = YamlConfiguration.loadConfiguration(file);
    }

    public YamlConfiguration getConfig() {
        return config;
    }
}

#

@fathom shard

frigid ember
#

@frigid ember i dont understand your question
@brisk mango I have a game that will have multiple spawn points (an unknown value), and the user can set spawn locations with world,x,y,z,yaw,pitch values. The setup for the config looks something like this

Arenas:
  Test:
    name: "Test"
    otherstuff...
    Teams:
      red:
        '1':
          world: World
          x: 100
          y: 100
          z: 100
          yaw: 100
          pitch: 100
        '2':
           ...etc...

My issue is when I add a new point and how would I go around figuring out what the last node for the list of spawn points.
Does this make more sense for what I'm trying to do?
If there's already written information, how do I know to set a 3 instead of a 7 for the next node of information for a spawn point.
And yes, this is also being stored in memory as well, but I can't guarentee that the memory will match exactly what the file reads.

YAML files* or loading shit into memory
@brisk mango And yeah, I would use a DB but it's a pain to setup with the amount of information I'm wanting to store.

fathom shard
#

oh i see okay i'll take a look and see, thanks

#

how i said see way too many times

brisk mango
#

lol

#

:wat:

#

ah rip

fathom shard
#

its 2:32am i mean wow* XD

brisk mango
#

oh i see okay ill take a see and see, thanks

#

@frigid ember i mean this is just painful to store this information in a YAML then get it

#

it gets really confusing especially when its like this

#

Like, having an arena and each arena having an team and each team having an location lol

#

You have to store the amount of locations somewhere

#

in the yaml

#

and then get it + 1

#

@fathom shard just make an instance of the class and call the setup() method in onEnable()

torn robin
#

It can be a bit confusing at first definitely

brisk mango
#

and then just make an method in the class that returns the instance

#

so

#

DataFile file = plugin.getDataFile();

torn robin
#

@frigid ember assuming you know about config sections you’d set the next key to the amount of keys+1

brisk mango
#

oh those are keys im stupid

#

just do

#

int size = ConfigurationSection#getKeys(false)#size()

#

and size++

#

when setting another location

frigid ember
#

Hmm, yeah I guess if I'm careful enough I can make the memory and config consistent. but otherwise im dead x.x

torn robin
#

I’d probably assign names to the spawns/teams

frigid ember
#

Well yeah, the teams have names

#

And the locations have different types ......

torn robin
#

Oh I see 👌

frigid ember
#

Like there are PointLocations and RegionLocations (which store two locations) and PointLocations have two types: SPAWN and RESOURCE. And RegionLocation has 3 types: NEXUS, CAPTURE, ARENA. So they have different types

fathom shard
#

@brisk mango nah this shit is fucked

#

Im tempted to just give up

brisk mango
#

yeah, nothing new

#

just java

#

nah dont

frigid ember
#

But the user can have multiple of the SPAWN type and multiple of the CAPTURE region type. soooo yeah this can be complicated. I think I will give each spawn a name just so it is easier to find and locate these.

brisk mango
#

Just make a class that contains all the methods.

#

and give them more descriptive names

#

@fathom shard wait I mean, if the file already contains the stuff you dont need to load it

#

just load it once when the plugin enables and it shouldnt be null

#

maybe its fucked up if you loadConfiguration

#

maybe it doesnt have enough time and youre calling methods

#

or idk

fathom shard
#

@brisk mango nah basically, i have the resources but i need to create that file inside the datafolder but its not copying over the data

#

just the file name

brisk mango
#

No idea

fathom shard
#

so i need to make a good way to do that

#

like saveDefaultConfig() but for prices

#

perhaps i could take a look at sourcecode

brisk mango
#

i mean wait

#

just use spigot's configuration thingy

fathom shard
#

wdym

brisk mango
#

nvm

#

ignore what i just said

#

but honestly i have no idea why its working maybe ask someone in TSC but i dont think they will help you @fathom shard

#

because this doesnt seem to be ur issue

paper compass
#

Quick question

#

I released a new plugin

#

If you want review the code

#

@subtle blade

#

Since choco is the best at reviewing code

brisk mango
#

Never call methods from constructor

torn robin
#

Wym by that

#

And why not?

brisk mango
#

Because the work in the constructor is bad

#

its not used to do any work in it

#

its used for constructing objects

paper compass
#

Where

brisk mango
#

when you register your command.

#

in the DI

#

Also BukkitRunnable is an piece of shit class

torn robin
#

You mean like setting the command executor?

brisk mango
#

use BukkitScheduler instead

paper compass
#

Well I didn’t know which one to use, I forgot ok?

brisk mango
#

ublic AutoPrestigeCommand(AutoPrestige plugin) { this.plugin = plugin; plugin.getCommand("autoprestige").setExecutor(this); }

#

remove plugin.getCommand

paper compass
#

I really don’t get what’s so bad about it

#

It changes nothing

brisk mango
#

Anyway, you should never call any methods from a constructor, because the work in the constructor is bad, the object isnt fully initialized yet and youre calling methods, you just shouldnt, but you can call private methods iirc, but never call overriden methods, you can actually run into some weird issues, because the method can be called before the class constructor, i dont know how its called atm, but an exception would be thrown

torn robin
#

Are you saying from within the class itself or ever

paper compass
#

Well it works perfectly

brisk mango
#

You can call private methods but you shouldnt

torn robin
#

Like are you saying don’t call static methods

brisk mango
#

but you cant call overriden methods

#

since you can run into some issues

#

it has its name, i just cant remember atm

frigid ember
#

When you mean calling methods from a constructor you mean

brisk mango
#

Basically, any methods in a constructor are bad

frigid ember
#

opposed to the builder pattern?

brisk mango
#

public ClassName() {
//Calling methods
}
#

i mean in here, in the class constructor

frigid ember
#

Oh within the constructor.

#

I thought you meant ProfileBuilder().setName("Nermin").create();

paper compass
#

Oh my fucking god

#

I love when I use getInstance then people are like use Class(MainClass)

frigid ember
#

Lol

torn robin
#

That would indeed make sense

frigid ember
#

There's not even a difference between the 2.

paper compass
#

Then now when I use Class(MainClass) people tell me to use getInstance

brisk mango
#

There is a difference between a singleton and dependency injection.

paper compass
#

Like WTf do I use

frigid ember
#

People suggest using the Singleton pattern.

brisk mango
#

No , they dont and that is wrong

torn robin
#

I recommend DI

brisk mango
#

Singletons are never better than dependency injections, dependency injection is more testable/reusable, explicit cohesion and defined ordering of how classes are used

paper compass
#

Same

frigid ember
#

Okay you're just rambling junk now.

paper compass
#

Ok nerd

#

If anyone else wants to review the code

tough viper
#

Can I ask a question?

paper compass
frigid ember
#

Use-case for grabbing the main class there can't be a difference.

brisk mango
#

Nerm are you brain damaged?

#

there is a couple reasons i listed above.

paper compass
#

Omfg here we go

frigid ember
#

Explian those reasons in depth shall you?

#

Don't just go off of words you've heard from other people.

#

If I'm wrong, I'm wrong; prove it.

torn robin
#

@paper compass post it on the forums if you want thorough feedback

paper compass
#

Yea will do

frigid ember
#

Why DI over SP

brisk mango
#

Dependency injection doesnt cause memory leaks, also you cant run into weird null pointers while with a singleton pattern you can, also dependency injection is more reusable, more testable and defines ordering of how classes are used

torn robin
#

DI is object oriented and follows SOLID principles

brisk mango
#

your question doesnt make no sense, you cant add NMS stuff

paper compass
#

We may need multiple help channels lmao

tough viper
#

yeah

#

i'm going to wait

hallow surge
#

2nd that

frigid ember
#

Doesn't SP also follow principles?

Could you also explain what you mean by NP's and Garbage Collection?

hallow surge
#

can we add an arguement channel for this nerd

#

clearly has a problem

frigid ember
#

lol

paper compass
#

I just want people to review my code I made in like 10 mins

#

Not for an arguement to happen

torn robin
#

@tough viper anythinf specific?

paper compass
tough viper
#

mainly worlds

frigid ember
#

We're not arguing; some people just get offended easily.

tough viper
#

so I can do World.setType

brisk mango
#

Garbage collector doesnt work on singleton pattern, since it gets loaded in memory and stays there, while it works on DI, because it only gets called from the class constructor when being constructed. @frigid ember

torn robin
#

Why do you want to set its type?

brisk mango
#

@paper compass I already reviewed your code and said the couple things you have wrong and you can improve.

paper compass
#

((CraftWorld)world).getHandle() @tough viper

#

iirc

tough viper
#

Could I do

torn robin
#

@paper compass use ChatCokors don’t hardcore the color symbols

brisk mango
#

Whats the reason @torn robin

paper compass
#

It was a quick plugin

#

Omg

brisk mango
#

There is none difference between those two

paper compass
#

Not again

tough viper
#

How would I do nmsWorld.setType

torn robin
#

The chat color enum is globally supported and doesn’t mess with file encoding

tough viper
#

I haven't found arguments for it

paper compass
#

((CraftWorld)world).getHandle() @tough viper

torn robin
#

Reflection probably Procez

paper compass
#

Oh

#

Probs

tough viper
#

I mean ((CraftWorld)world).getHandle().setType(...)

#

What are the arguments?

hallow surge
#

lol no idea

#

redacted

paper compass
#

Lmao

frigid ember
#

What are you trying to do @paper compass

brisk mango
#

Nerm, what do you mean by going off with words that ive heard, its things I know from my java experience and are generally known @frigid ember

paper compass
#

It’s just an autoprestige plugin

#

I kept googling for one but I couldn’t find one

brisk mango
#

DI has always been better than a singleton pattern.

paper compass
#

So I just made my own and uploaded it

frigid ember
#

Typically when you go at a person saying their brain-damaged kind of shows that you've been triggered in 1 way or a nother 😆

#

I might've been wrong

torn robin
#

The auto prestige manager looks very useless

paper compass
#

Meh

frigid ember
#

What's next? To attempt to distraught someone?

brisk mango
#

Yeah, because youre trying to say a SP is better than a DI , whatever

paper compass
#

I can easily do stuff faster imo

hallow surge
#

@frigid ember shut up your not helping go to general

frigid ember
#

Single sided ^

#

Anyways back to the topic, you can't say you've always been right? Everyone's been wrong

#

here and there several times etc

paper compass
#

They are basically the same lmao

torn robin
#

Guys this is help not prove-yourself-right

paper compass
#

In one way or another they are still accessing a class

brisk mango
#

Never said I was always right, anyway can we just end this discussion? DI is better than a SP, no point arguing no more

frigid ember
#

Done.

brisk mango
#

Ive explained why

#

yeah, thanks.

tough viper
#

setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i)

frigid ember
#

@paper compass what do you need again?

tough viper
#

What is int i

paper compass
#

I just wanted someone to review my code ig

#

😂

frigid ember
#

I believe someone already reviewed it?

paper compass
#

Meh

brisk mango
#

@paper compass I mean i dont know what is your point, I reviewed the code and pointed out a couple things that can be improved/are wrong.

paper compass
#

I use BukkitSchedular instead of BukkitRunnable in extends right?

brisk mango
#

yes.

paper compass
#

What’s the difference

brisk mango
#

I dont know whats the point of making an own runnable class though?

#

BukkitScheduler is better in performance. BukkitRunnable is an piece of shit class, every method synchronized and throwing 5 exceptions, its basically thread-safe

torn robin
#

BukkitRunnable is outdated iirc

paper compass
#

Ah right

torn robin
#

Also the ChatColor thing

#

other than that looks good

paper compass
#

I just forgot which to import because I was just making this for my prison server

brisk mango
#

Something like with Random java class, its better to use ThreadLocalRandom rather than creating new random objects, since it will always have its own thread and wont be thread-safe

paper compass
#

Well yeah

#

I always use ThreadLocalRandom

#

Random is on the main thread ThreadLocal is on another thread

#

Correct?

brisk mango
#

no

paper compass
#

Oh?

#

I’ve been told wrong 😮

brisk mango
#

Random is thread-safe, meaning it can be used from another thread or from the main thread, but that will make it have worse performance when its between threads. ThreadLocalRandom always runs on the thread where you use it and each ThreadLocalRandom has its own thread seed

#

Which means its not synced, and it has a better performance

paper compass
#

Oh kk

brisk mango
#

I mean if you say that, you probably dont really know how threads work in java lol

torn robin
#

So when should you use Random?

#

If ever

brisk mango
#

Random doesnt always run on the main thread, depends if you use it on the main thread or not, it can be used Asynchronously or synchronously but that will cause it to have less better performance than getting an current random from ThreadLocalRandom class

#

never

#

you shouldnt create new random objects

tall crystal
#

then what do you use to get a random number?

brisk mango
#

ThreadLocalRandom

#

final ThreadLocalRandom random = ThreadLocalRandom.current();
torn robin
#

(What we were just talking about)

brisk mango
#

Lol

tall crystal
#

sorry just been writing some rtp code and was using Random

frigid ember
#

What packet corresponds with Acknowledge Player Digging [0x08] I can't find

#

Can't find any?

fathom shard
#

@brisk mango u got a sec (sorry im being a pain)

brisk mango
#

yes sure

fathom shard
#
    public static void writeToFile(HashMap<Location, List<UUID>> input, File file) throws IOException {
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));

        out.writeObject(input);

        out.close();
    }``` is my code
brisk mango
#

Location isnt serializable

fathom shard
#

wait what i swear it is

brisk mango
#

java.io.NotSerializableException: org.bukkit.Location

#

🤷‍♂️

fathom shard
#

well time to make a new instance of location that is

paper compass
#

No need to

#

public String serializeLoc(Location l){
return l.getWorld().getName() + "," + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ();
}

public Location deserializeLoc(String s){
    String[] st = s.split(",");
    return new Location(Bukkit.getWorld(st[0]), Integer.parseInt(st[1]), Integer.parseInt(st[2]), Integer.parseInt(st[3]));
}
#

I can’t format code I’m on phone

#

@fathom shard

velvet halo
#

.<

paper compass
#

‘Test’

velvet halo
#

Location is config serializable

paper compass
#

Nope

velvet halo
#

`

#

it is this character

paper compass
#

I’m on phone

velvet halo
#

oj

#

@brisk mango Location is config serializable...

paper compass
#

Guys what if my phone charger just electrocuted me
; _ ;

velvet halo
#
plugin.getConfig().set("location", location); //serialize
Location location = (location) plugin.getConfig().get("location"); //deserialize
``` @fathom shard @brisk mango
paper compass
#

Lol @brisk mango knows nothing

brisk mango
#

[03:50:38] [Server thread/WARN]: java.io.NotSerializableException: org.bukkit.Location are you sure about that @velvet halo

velvet halo
#

Yes I am

brisk mango
#

@paper compass was that an joke right

velvet halo
#

You are probbly doing it wrong

brisk mango
#

not me

#

guy above

paper compass
#

@fathom shard

velvet halo
#

Look at the javadocs

fathom shard
#

its config serialisable

velvet halo
fathom shard
#

im not using YAML

brisk mango
#

i genuinely know nothing @paper compass

#

¯_(ツ)_/¯

paper compass
#

Oh

fathom shard
#

therefore Temedy is right no?

paper compass
#

Use mine then

velvet halo
#

What are you using then?

#

JSON?

paper compass
#

public String serializeLoc(Location l){
return l.getWorld().getName() + "," + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ();
}

public Location deserializeLoc(String s){
    String[] st = s.split(",");
    return new Location(Bukkit.getWorld(st[0]), Integer.parseInt(st[1]), Integer.parseInt(st[2]), Integer.parseInt(st[3]));
}
#

Heh

fathom shard
#

as of right now no im using .bin

brisk mango
#

I mean , a stack trace shouldnt lie

fathom shard
#

it will be json

velvet halo
#

Why not just make an encapsulation class @paper compass That doesn't seem good

fathom shard
#

just gotta recode some shit first

paper compass
#

What

#

Wait why tf do people even use json

#

Is it faster?

velvet halo
#

Yes >.<

#

Gson is very nice

paper compass
#

Oh

#

Ok I’m using json for my plugin config files now Lmaoo

velvet halo
#

I haven't tested the performance but it is generally said to be faster

brisk mango
#

i'd prefer DB over anything

velvet halo
#
public class JsonStorage {

    private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();

    public static void write(String path, Object object) {
        File file = new File(path);
        if(!file.exists()) file.mkdirs();

        try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))) {
            GSON.toJson(object, bufferedWriter);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static <C> C read(String path, Type type) {
        File file = new File(path);
        if(!file.exists()) file.mkdirs();

        try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) {
            return GSON.fromJson(bufferedReader,type);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}
``` If you want a simple class todo it
#

@brisk mango It depends what you need to store

#

If you need to store a location then you should store it locally instead of a database

fathom shard
#

why does final EconomyResponse response = plugin.getEconomy().depositPlayer(player, totalSale); throw an NPE and yes i have vault on plugins

#

man im rusty asf

brisk mango
#

plugin.getEconomy() perhaps null

#

or plugin

#

or player

paper compass
#

How do you register economy

velvet halo
#

Look at vault api documentation

paper compass
#

I’m asking him

velvet halo
paper compass
#

How he did it

#

I know how

velvet halo
#

No you shouldnt rely on other people

paper compass
#

Lmfao

velvet halo
#

You should read the documentation

#

Then it will work

paper compass
#

I meant I wanna see how he did it

#

See if he didn’t do it correctly

fathom shard
#
    private boolean setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            return false;
        }
        economy = rsp.getProvider();
        return true;
    }```
paper compass
#

Do you setupEconomy in onEnable?

velvet halo
#

Yes you have too

paper compass
#

Dude legit

#

I’m trying to help him

brisk mango
#

iHusker bruh

fathom shard
#

Yes ohsry

#

I do

paper compass
#

So how do you get the player then?

fathom shard
#

is full error

brisk mango
#

Perhaps player/totalSale is null

paper compass
#

Show us your PlayerInteractEvent

fathom shard
#

its on a player event so using the event method

brisk mango
#

well that doesnt give more information since its just an null pointer

#

shouldnt it be Economy instead of EconomyResponse? @fathom shard

paper compass
#

No

fathom shard
brisk mango
#

did you use DI to get an instance of main?

fathom shard
#

of course

paper compass
#

You shouldn’t be getting a NpE with the code you have

#

Hmmm

fathom shard
#

I hate singleton lol

brisk mango
#

same

#

LOL again

paper compass
#

Show us how you setupEconomy

brisk mango
#

@paper compass he already did

#

?

worldly heathBOT
#

Edit this to change the output of the command!

paper compass
#

I meant in his onEnable

brisk mango
#

yeah, exactly, you shouldnt be getting null pointer idk why ur getting it @fathom shard

fathom shard
brisk mango
#

no needed for that, its just enough info that he said he calls the method.

fathom shard
#

is full main class

paper compass
#

Please use

#

if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}

brisk mango
#

Why exactly

keen moth
#

just debug lol

tall crystal
#

if you have the plugin.yml load set to STARTUP it ended up failing to load vault in my experience

fathom shard
#

it depends inside plugin yml it'd throw an error on startup

#

no?

brisk mango
#

yes.

paper compass
#

Also put softdepend: [Vault] in the plugin.yml

brisk mango
#

Most likely

#

you dont need that @paper compass

paper compass
#

Try that

fathom shard
#

it hard depends without vault it fails why would i use soft

brisk mango
#

No, that doesnt change anything

paper compass
#

It makes the plugin load after vault loads

brisk mango
#

no

#

loadbefore: does that

#

lol

fathom shard
#

either way

#

Its not a start time error

#

its a error after everything loads

#

load order in my instance does not matter

brisk mango
#

^

keen moth
#

nope, i'd still implement the check. just because vault is installed doesn't guarantee there is an eco provider

paper compass
#

Just vault load after or before your plugin loads @fathom shard

#

Just a quick check

brisk mango
#

Bruh what does that exactly change, its not a start time error, can you read

#

that litterly changes nothing

fathom shard
#

confirmed no issues with vault

#

i lied

#

i cant read

keen moth
#

do you actually have an eco plugin installed?

fathom shard
#

LOL okay so no vualt apparantely

paper compass
#

Oh?

#

See

fathom shard
#

its there tho

paper compass
#

This is why I said put

if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}

fathom shard
#

so like what?

keen moth
#

which is why you should utilize the return type of the setup method lol.

#

the debug message is misleading tho. it could mean there is no eco provider, not necessarily that vault isn't installed

paper compass
#

Can you try putting
softdepend: [Vault]
In t he plugin.yml

#

Hmmm

#

Maybe?

brisk mango
#

why softdepend

paper compass
#

Uhh

fathom shard
#

it could be only plugins are vault and this let me grab an eco rq

#

didnt think I NEEDED

#

an eco

paper compass
#

Ah

keen moth
#

no need for softdepend. leave it as regular depend, and you can remove the plugin check.

paper compass
#

So you don’t even have an eco plugin?

keen moth
#

vault doesn't provide an eco. it's simply an interface for eco and perms

#

to sum up what you need:

  1. leave as depend in your plugin.yml
  2. remove plugin check
  3. use return type of setup method. if false -> no eco provider (no essentials, iconomy, etc), disable plugin or at least the eco features. if true -> proceed as normal
fathom shard
#

Thank youuu

#

Everything works :D

#

just need to convert storage to json now

radiant pollen
#

How would I make aspects of my plugin not trigger anti-cheat plugins?...

#

or should I just make my own anti-cheat...?

brisk mango
#

yeah.

paper compass
#

Oh shit

#

Yes

brisk mango
#

otherwise, you cant

paper compass
#

If you’ve never make an anti cheat I wouldn’t recommend making it @radiant pollen

#

They are hard to make

#

Imo

radiant pollen
#

Well I need to do something.

paper compass
#

Try lower the checks

#

If you know what I mean

radiant pollen
#

Yeah.

#

The main problem is I have things that set player velocity and they're a false positive 100% of the time.

paper compass
#

What Antichrist plugin is it

brisk mango
#

Cant do nothing with that if its another plugin triggering the checks.

paper compass
#

Lmfao autocorrect

brisk mango
#

Antichrist
LOL

paper compass
#

Autocorrect lmao

brisk mango
#

Lol noob

radiant pollen
#

ACR

fathom shard
#

To be honest, you’d be better off either a) developing your own (good luck) or b) make an override permission that u can give to players that the anti cheat will ignore to do what u want assuming the anticheat will allow for that

#

Otherwise option c is not have an anti cheat

#

Unless designed specifically for your needs of the server likr Hypixel most of the time at best they are irritating plugins that can cause issues with general players

paper compass
#

Try using the “AntiCheatAPI” class to exempt the player for a bit then unexempt them

brisk mango
#

good lock LOL

paper compass
#

My fix lmao

brisk mango
#

i like your responses 4eh

radiant pollen
#

Yeah, making the player exempt for a few ticks might be the best thing to do.

paper compass
#

😄

radiant pollen
#

Thanks

paper compass
#

Np

fathom shard
#

@brisk mango im not wrong tho lol

brisk mango
#

yes youre not

#

like

#

good luck making an good anticheat

#

lol

paper compass
#

Atleast I found a API for the plugin

#

Which is the simplest way

fathom shard
#

Public anticheats are never really well designed anyway

#

Anti cheats imo need to be tailored specifically to your needs

paper compass
#

@radiant pollen is that anti heat actually good? If so how good

#

Ffs autocorrect

fathom shard
#

Anti hear lmfao

#

Shit

#

LOL

#

Phones are trash for typing

radiant pollen
#

It seems to be pretty good. The config is extensive.

paper compass
#

Wow

radiant pollen
#

Everything I do in my minigame would be considered hacking somewhere else and it's detecting all of it so

paper compass
#

NoCheatPlus-AAC how good is it

#

Lmao

radiant pollen
#

Never used many anti-cheat plugins before.

paper compass
#

Ah

#

Is it anywhere close to AntiGamingChair?

brisk mango
#

no Lol

#

never

paper compass
#

Lmao

brisk mango
#

Anti hear

#

lol

paper compass
#

Antigamingchair is actually not that good, I hacked for 10m and didn’t get banned

velvet halo
#

.<

paper compass
#

I love how hypixel made watchdog MachineLearning but it hardly learnt anything because it never bans

#

Even though like 20% of their player base are hackers

brisk mango
#

bruh

#

AntiGamingChair is the best minecraft anticheat

paper compass
#

Explain

brisk mango
#

no better outta there

paper compass
#

I hacked for 10 mins

brisk mango
#

no need to explain

#

yeah, because it has many phases and checks

#

to actually confirm if ur cheating

paper compass
#

Blatant killaura

brisk mango
#

maybe if you had some iq you would get it, it doesnt ban instantly

#

yeah, it doesnt ban instantly so there is minimum percentage of people who get banned and are legit

velvet halo
#

ooof

paper compass
#

Think

#

10 mins of blatant killaura/reach

brisk mango
#

yeah and after 10 mins you get banned though ?

paper compass
#

I just quit

brisk mango
#

so whats the point

#

sure

paper compass
#

It was getting boring af

brisk mango
#

bruh i have my opinion and sure other ppl do aswell so lets just not argue about this no point

paper compass
#

Singleton and dependency are basically the same, they both get a class no matter what

#

Kk I’m off to sleep

brisk mango
#

??

#

Im sure we've discussed about this.

wet bronze
#

Can anybody help me with dynmap? I made a world border then did /wb fill, then I added dynmap and did /dynmap fullrender, and there's still huge chunks of black on the dynmap. The fullrender isn't finished yet but the black chunks haven't gone anywhere after almost 24 hours of fullrendering.
It's also not that big of a map inside the world border, only 5k x 4k

brisk mango
#

@fathom shard maybe you can get exerosis sometime here so he can bully these noobs

paper compass
#

“bully these new players” how old are you? 5? Imagine using noob as an insult.

brisk mango
#

if you have as much experience with java as i do, you will understand what im saying

paper compass
#

Ahahah

brisk mango
#

what youve basically said is a non-sense

paper compass
#

How much experience do you have just wondering

#

“bully these new players” how old are you? 5? Imagine using noob as an insult.

brisk mango
#

yeah should definetly bully these spigot noobs that are trying to teach people and just mislead them instead, just like bunch of fucking kids that have no idea what are they doing

paper compass
#

Ahahaha

#

You’re funny you should be a comedian 🙂

radiant pollen
#

wtf

brisk mango
#

With dependency injection you cant get null pointers while with a singleton pattern you can, also dependency injection is more reusable, more testable and defines ordering of how classes are used

paper compass
#

Cool

#

I know that

brisk mango
#
  • no difference between SP/DI
#

definetly

paper compass
#

But I’m just saying that they both get a class

brisk mango
#

yeah I get your point. Im just saying that its a better practice to use a DI.

paper compass
#

I use DI

brisk mango
#

But theres nothing wrong with SP too. It's just really better using di

#

Also, I doubt you knew that

paper compass
#

I love when I use SP people tell me to use DI, and when I use DI people tell me to use SP

#

It’s really confusing

brisk mango
#

Its not confusing, just remember the reasons why its better to use DI rather than a singleton

#

Its those people that have no idea what theyre saying

#

and have basically no knowledge in the language

paper compass
#

I basically did because with a singleton you actually need to define it in order for a NPE not to produce

brisk mango
#

just because they've "heard" a SP is better than a DI then they say it.

#

yeah, with dependency injection you dont. Because it uses the class constructor

#

thats a quite good reason too.

paper compass
#

So I did know it 😉

brisk mango
#

Well, you didnt know it is more testable/reusable

#

did you?

paper compass
#

Kk nerd

brisk mango
#

thanks

paper compass
#

It’s almost 5am lmao

#

Cya

brisk mango
#

cya

velvet scaffold
#

does anyone know of a way to make mob spawning behaviour / mob cap act like each individual player on a server has the same mob spawns as single player?

hollow temple
#

I saw a plugin for that a while ago

#

Wish i could remember what it was

velvet scaffold
#

I feel like i saw somewhere paper has this as a feature in the config files, can someone confirm or deny this?

pastel basin
#

@velvet scaffold Yes, you can do this with paper

runic wadi
#

i think default settings should be basically vanilla and then you can adjust to recommended settings if you desire

#

but sadly the out-of-box experience is like buying an iphone on ebay

fleet crane
#

mob-spawn-range: 8 that's literally the only spawn option not the same as vanilla

#

and even then its only not the same if your view distance is >= 7

#

which for most servers it isn't anyway

runic wadi
#

most servers have less than 7 chunk view distance?

#

ew

#

glaucoma servers

fleet crane
#

view distance 10 --> 6 is basically 3x less load on the server

#

makes a huge difference

tough viper
#

how do I prevent a mob from despawning with Spigot?

tough viper
#

Thank you!

grand aurora
#

Is anyone able to help me figure out some problems I am having with my capture the flag plugin?

fleet crane
#

?ask

worldly heathBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

grand aurora
#

Sorry, I am having some issues with resetting the flag. I need to be able to create a banner with the same pattern, location, and rotation as the original. I am not getting any errors but neither the pattern nor rotation is working.

fleet crane
#

have you tried asking the author for help in their thread?

grand aurora
#

No, I am writing the plugin from scratch

fleet crane
#

ok well perhaps share your code then

grand aurora
#

public void resetFlags() { for (Map.Entry<Location, Flag> flag : this.flags.entrySet()) { flag.getValue().startPos.getBlock().setType(Material.BLACK_BANNER); ((Banner) flag.getValue().startPos.getBlock().getState()).setPatterns(flag.getValue().flagPattern); flag.getValue().state = "base"; Bukkit.broadcastMessage(flag.getValue().name + " has been reset"); } }

fleet crane
#

BlockStates are snapshots

#

you always need to go through a store, modify, update

grand aurora
#

Okay, how do I update a blockstate?

fleet crane
#

by calling .update

grand aurora
#

Okay. Thanks I'll try it!

fleet crane
#

BlockState bs = //; bs.setPatterns; bs.update

grand aurora
#

Great! The Pattern updates now, but do you know how to set the direction? I know you can set data based on a number for north, west, east, south but how would I get that from the Location? Or is there a better way?

brisk mango
#

You mean get a direction from yaw/pitch?

grand aurora
#

I think? I have never tried anything like this before, I just need the banner facing the same direction

brisk mango
#

you can make an array of BlockFace

fleet crane
#

well a 3-tuple location (x,y,z) won't have a direction

#

only a 5-tuple (x,y,z,yaw,pitch) will

brisk mango
#

private static final BlockFace[] ORDERED = new BlockFace [] {
NORTH, EAST, SOUTH, WEST
}
#

and make a method that returns BlockFace from a location

grand aurora
#

I'm using the API location class so I assume I can get the yaw, pitch and block faces

#

How do I set which direction the banner is facing from this though?

brisk mango
#

1 second

#


private static final BlockFace[] ORDERED = new BlockFace [] {
NORTH, EAST, SOUTH, WEST
};

public static BlockFace fromYaw(float yaw) {
return ORDERED[Math.round(yaw / 90F) & 0x3]
}
#

@grand aurora

grand aurora
#

Thanks!

brisk mango
#

np

#

?ask

worldly heathBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

brisk mango
#

um I think you only have to be registered on spigot

dry kiln
#

I know the answer to this

#

But I was wondering if theres any hope

#

Is it possible to make someone riptide

#

forcibly

brisk mango
#

what does mean riptide @dry kiln

dry kiln
#

exactly as i said

#

make them riptide, like the enchantment

brisk mango
#

maybe NMS

grand aurora
#

Also, is there any benefit to the way I am doing the reset vs storing the block data as a string and setting it with Bukkit.getServer().createBlockData()

frigid ember
#
Document found = (Document) Mongo.getCollection("mc").find(new Document("UUID", player.getUniqueId().toString()));
``` good question why does this return null
#

wait

#

nvm

velvet halo
#

Does anyone recommend using Guava for cache or should I utilize something different?

brisk mango
#

Guava is fine

velvet halo
#

I don't like the sound of fine xD

#

I want to make sure Guava is reliable and efficient

brisk mango
#

I dont know what do you honestly expect tbf, guava is pretty good

fleet crane
#

if an FWSE can use it, so can you

velvet halo
#

That is true, I didn't know FWSE was using it

#

The more you know

fleet crane
#

com.google.guava didn't give it away?

velvet halo
#

I wasn't sure if google used the libraries that they provide for the public in their own systems.

brisk mango
#

why would they create them then lol

fleet crane
#

they use guava in particular extensively

brisk mango
#

what do you think about calling methods from a constructor @fleet crane

fleet crane
#

Idk

neat orbit
#

does anybody know a plugin that autosells everything that is dropped from a farm in a chunk? like a chesthopper

tranquil yoke
#

How do i sort players by money and deaths on playerlistplus

vernal spruce
#

Tried asking the one who created it?

brisk mango
#

Not sure with the plugin, but in java, you can sort players by values using TreeMap

idle zodiac
#

How would I go about making a firework particle effect?

#

I'm lost XD

brisk mango
#

PacketPlayOutWorldParticles

#

has like 7 parameters i think

#

Not sure if you need to use abstraction/reflection when using over more versions

#

Though in the newer versions, you can just use World#spawnParticle

idle zodiac
#

would that work in 1.8?

brisk mango
#

no I think

idle zodiac
#

sad

brisk mango
#

just use packets huh?

idle zodiac
#

sure

#

will try XD

#

i'm kinda new

#

started 4 days ago

sturdy oar
#

yeah nobody does particles with packets to be honest

#

since we have a good API for them

brisk mango
#

The api is only in newer versions @sturdy oar

sturdy oar
#

and that's why you should update

brisk mango
#

no its really not

#

what if some people use older versions if they have a pvp server for example?

#

and they need particles?

sturdy oar
#

Well in my opinion I've never supported <1.13 because it's just retarted

brisk mango
#

And the spawnParticle thingy only works on the API version

#

arent all spigot versions retarded

sturdy oar
brisk mango
#

this thing isnt even true

#

i doubt that 56% of the people use 1.15.2