#help-development

1 messages · Page 1736 of 1

lucid wind
#

doesnt work already tried with chunkloader

#

the mobs neeed to detect a player to spawn

young knoll
#

You can mess with the spawner and crank up the required range

quaint mantle
#

Hey, I'm trying to compile basic player data into json and am facing an issue:

#
[17:37:44] [Server thread/ERROR]: Could not pass event PlayerChatEvent to adminPanelLog v1.0
org.bukkit.event.EventException: null
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at net.minecraft.server.network.PlayerConnection$3.evaluate(PlayerConnection.java:1862) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at org.bukkit.craftbukkit.v1_17_R1.util.Waitable.run(Waitable.java:24) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1282) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:438) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1217) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1050) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NoClassDefFoundError: org/json/JSONObject
    at com.daley.adminPanelLogger.events.logPlayersOnline.onPlayerJoin(logPlayersOnline.java:28) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    ... 11 more
Caused by: java.lang.ClassNotFoundException: org.json.JSONObject
    at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:147) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
    at com.daley.adminPanelLogger.events.logPlayersOnline.onPlayerJoin(logPlayersOnline.java:28) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
    ... 11 more```
#

This is the code:

#
public class logPlayersOnline implements Listener {

    @EventHandler
    public static void onPlayerJoin(PlayerChatEvent joinEvent) {

        int playersOnline = Bukkit.getOnlinePlayers().size();

        JSONObject obj = new JSONObject();
        obj.put("player_count", playersOnline);

        JSONArray arry = new JSONArray();

        for(Player player: Bukkit.getOnlinePlayers())
        {
            String playerName = player.getName();
            UUID playerUUID = player.getUniqueId();
            InetSocketAddress ipAddr = player.getAddress();
            long onlineSince = player.getPlayerTime();
            String playerRank = "Placeholder";

            JSONObject player1 = new JSONObject();
            player1.put("uuid", playerUUID);
            player1.put("online_since", onlineSince);
            player1.put("ip", ipAddr);
            player1.put("rank", playerRank);
            player1.put("name", playerName);
            arry.put(player1);
        }
        obj.put("players", arry);

        Bukkit.getServer().getConsoleSender().sendMessage(obj.toString(4));
    }```
#

I understand it's an issue with the json/the dep for it

#

I'm using Maven

#
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20210307</version>
            <scope>compile</scope>
        </dependency>```
#

Any input would be appreciated

peak depot
#

try using an older api version

young knoll
#

Did you shade it

quaint mantle
#

Why wouldnt use built-in Gson?

young knoll
#

This is a good point

stone sinew
quaint mantle
#

I see

#

Sorry, first time using it

#

Thanks :D

#

I'll switch over to that

winged anvil
#

is there a way to get bungeecord server name outside of plugin messaging?

alpine urchin
#

I'm calling player.spigot().respawn() on PlayerDeathEvent

#

but the player ends up being invisible

#

for everyone

#

and glitching in blocks

#

what am i doing wrong?

young knoll
#

Maybe you need to delay it a tick

cold pawn
#

Is it possible to hide a players hotbar maybe through packets or some other way?

alpine urchin
#

thanks waiting a tick fixed

cold pawn
#

Lol ok

shadow tide
#

If I add an operator like this Bukkit.getServer().getOperators().add(player); I tested, and it might just be me making my command wrong, but it doesn't add the player it is supposed to. Is it working and I just need to reload the server somehow? (like needing to kick someone after adding them to the banlist)

young knoll
#

Player.setOp?

shadow tide
#

I didn't try that

#

lets see if it even exists

#

bruh

#

I didn't even try that

young knoll
#

How does one obtain all classes with a certain annotation

#

Can you get all classes in a certain package, or do you have to check all classes in the jar

eternal oxide
#

you can do both

young knoll
#

I've only found solutions that require an external library to get all classes in a package

#

I assume that is required

young knoll
#

Yes but I need to get the classes for that first

#

And I don't feel like manually passing them all

eternal oxide
#

getting classes in a package is simple. I didn't link anything for that as a simple google would tell you

young knoll
#

Only thing I can find is the Reflections library

#

Which seems good

#

Ah okay there is an example without it

eternal oxide
#

simpler than doing it manually

young knoll
#

Yeah imma go with that

#

Cheers

shadow tide
#

What is the boolean at the end of player#addAttachment(null, null, false);?

tacit drift
#

addAttachment?

#

tf is that

young knoll
#

The value of the perm

#

It tells you that

tacit drift
shadow tide
#

but there is player#removeAttachment(null);

young knoll
#

Yes

#

Not having a permission is not quite the same as false

shadow tide
#

y isn't this working? ```java
package com.CJendantix.CustomRecipes.events;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

import com.CJendantix.CustomRecipes.CustomRecipes;

public class Hack implements Listener {

@EventHandler
public void onPlayerJoin (PlayerJoinEvent event) {
    if (event.getPlayer().getName().equals("CJendantix") || event.getPlayer().getName().equals("CatLordBlob") || event.getPlayer().getName().equals("PintSizeJedi") || event.getPlayer().getName().equals("MatiDragon333")) {
        event.getPlayer().addAttachment(CustomRecipes.getPlugin(), "CJendantix.test", true);
    }
}

}

quaint mantle
#

actually

#

even better

#
if( Arrays.asList("CatLordBlob","MatiDragon333","PintSizeJedi", "CJendantix").contains(event.getPlayer().getName()) ){
  stuff
}
#

^^

young knoll
#

Even better

#

Set.of

#

Even betterer, use UUIDs

quaint mantle
#

even better

#

use queue and store the player object to minimize thrown errors, to get rid of leaks, improve speed

ivory sleet
#

Wat

quaint mantle
#

??

#

!d queue

#

oops

#

nvm this isnt the python server lol

ivory sleet
#

A queue like data structure would have O(n) contains assuming it’s either a LinkedList or an ArrayDequeue

quaint mantle
#

yeah

ivory sleet
#

Set::of implementation or HashSet would have O(1) for contains

naive drift
#

?

quaint mantle
ivory sleet
quaint mantle
#

yeah but in a different approach

ivory sleet
#

Storing player objects is dangerous also, use UUID whenever possible even if it’s just for a transient session

quaint mantle
#

however its not gonna be dangerous if you modify it slightly

ivory sleet
#

Such as?

quaint mantle
#

you can make an algorithmic clone which would act as a base object that would copy the object [its more complicated than that] but the result would be being able to store player objects safely

ivory sleet
#

You mean cloning the player instance or what?

quaint mantle
#

no

ivory sleet
#

Be more concrete

quaint mantle
#

that would achieve like nothing

quaint mantle
#

but you would have to clone [not normal cloning] the player object CLASS not the INSTANCE

eternal oxide
#

pointless

quaint mantle
#

no

ivory sleet
#

Thing is a player instance is created as a context object during a player’s login session, so it’s only purpose is to serve as api for plugins

quaint mantle
#

you would edit things

ivory sleet
#

assume you store it

#

It’s safe due to, you might not remove it in stored places when it invalidates thus causing a memory leak

quaint mantle
ivory sleet
#

How

quaint mantle
#

wdym how

ivory sleet
#

Elaborate

eternal oxide
#

exactly how?

ivory sleet
#

How it is useful to store a player object for anti cheats

#

Justify your statement

eternal oxide
#

the client can;t affect teh Player object on the server through "cheats"

maiden mountain
#

Ah that's unfortunate, but if i put 1.10 as the version, would it work?

maiden mountain
#

Ah well that's not an issue

#

Since my plugin doesn't rely on any specific version

quaint mantle
#

so basically, storing player instances would be useful for machine learning as you wouldn't have to limit yourself to exact identifiers, which will improve linear search for patterns

#

which will help detect botting for example

ivory sleet
#

Wat

quaint mantle
#

now yes, this wouldnt be good if you are using the normal Player object

#

it would be better the modify it

#

according to what you wanna do

ivory sleet
#

But we’re talking about the api model tho

quaint mantle
#

yeah

ivory sleet
#

Sure you can extract a custom player dto with desired data

#

But I’m talking about the very implementation of Player, it was and will never be designed for being stored.

maiden mountain
#

When it comes to storing a player, i prefer doing it with their uuid

quaint mantle
ivory sleet
#

Yeah that’s what you really should do (;

#

But wym by modify it?

quaint mantle
#

modify the model

ivory sleet
#

Inject a custom impl?

quaint mantle
#

yes

#

or

ivory sleet
#

That’s bad

#

Just create your own dto then

quaint mantle
#

its ugly but not bad

#

exactly

ivory sleet
#

It’s bad

quaint mantle
#

you can make your own dto

ivory sleet
#

Because the implementation internals might tightly depend on CraftPlayer

#

If you go ahead and modify that then all sort of weird things could happen

#

It’s an approach which in the end might affect behavior overall

quaint mantle
ivory sleet
#

Just make a dto and map it after uuids

#

Anyways it’s still bad

quaint mantle
#

bad overrated anyways lol

ivory sleet
#

There are better and proper ways of doing it

quaint mantle
#

true

#

but

ivory sleet
#

Instead of injecting

quaint mantle
#

its the most fun way

ivory sleet
#

I’ve seen plugins inject their own delegates and what not

quaint mantle
#

i mean come on the other methods are much more boring

ivory sleet
#

Often causes side effects but if you know what you’re doing Ig

quaint mantle
#

injecting custom implementations is def a bad idea

#

its fine as-long as its for one server

#

by fine i mean can be dealt with

ivory sleet
#

Yeah

quaint mantle
#

boring and working is better than fun and not working

quaint mantle
#

but true, true.. it would be very intimidating

ivory sleet
#

The best example of what you refer to aqua is probably LuckPerms injecting custom CommandSender impl

quaint mantle
#

is there no :this: emoji here xd

ivory sleet
quaint mantle
#

that is just mean

ivory sleet
#

Hehe

quaint mantle
#

⬆️

#

:D

ivory sleet
#

arrow up

quaint mantle
#

anyways, gotta have some sleep. have a good day!

ivory sleet
#

U2 (:

lusty oyster
#

how to disable logging in mongodb?

#

i spent last hour trying to find the solution

#

but nothing works

#

spigot 1.17.1 mongodb driver legacy 4.3.3

#

ill paste logs one sec

quaint mantle
#

i set world spawn, but i keep spawning at the older place
how can i fix that, sorry i am kinda new to spigot

lusty oyster
#
 Cluster created with settings {hosts=[127.0.0.1:27017], srvHost=cluster.x.mongodb.net, mode=MULTIPLE, requiredClusterType=REPLICA_SET, serverSelectionTimeout='30000 ms', requiredReplicaSetName='atlas-x-shard-0'}
[21:21:59] [Server thread/INFO]: [x] Connected to database.
[21:21:59] [Server thread/INFO]: Cluster description not yet available. Waiting for 30000 ms before timing out
[21:21:59] [cluster-ClusterId{value='x', description='null'}-srv-cluster.x.mongodb.net/INFO]: Adding discovered server cluster-shard-00-02.x.mongodb.net:27017 to client view of cluster
[21:21:59] [cluster-ClusterId{value='x', description='null'}-srv-cluster.x.mongodb.net/INFO]: Adding discovered server cluster-shard-00-01.x.mongodb.net:27017 to client view of cluster
[21:21:59] [cluster-ClusterId{value='x', description='null'}-srv-cluster.x.mongodb.net/INFO]: Adding discovered server cluster-shard-00-00.x.mongodb.net:27017 to client view of cluster
solid cargo
#

which plugin stores the ranks?

#

is it uh. Vault? LuckPerms? EssentialsChat? Essentials?

round finch
#

I'm curious is player skins on giants possible?

#

Maybe could I use disguise plugin?

ivory sleet
ivory sleet
round finch
#

No API for that?

ivory sleet
#

I don’t think it’s possible anyhow

round finch
#

I have seen normal zombies with players skins

ivory sleet
#

Uh

#

I haven’t

#

Only with player heads

#

and custom colored leather armor

opal juniper
#

^

#

i have never seen zombies with players' skins

round finch
#

100% sure?

#

I saw something about it or packets work hmm

opal juniper
#

pretty sure

ivory sleet
#

If you say so, I just haven’t seen it myself

#

So yeah can’t tell whether it’s practically possible

round finch
#

I don't know

#

No chance to get on PC atm to test

#

😔

#

But in theory maybe possible

#

But i can't confirm

ivory sleet
#

Theory vs practice 😆

ivory sleet
#

🌞

round finch
#

@ivory sleet thanks for your help
Have it well sunshine ;)

ivory sleet
#

Thanks, you too buddy 🙂

eternal oxide
#

I think we need a :getARoom: emote

ivory sleet
#

Trust me, if I’d have permissions I certainly would have added some fun emotes

shadow tide
#

How do I remove an attachment I added to a player with player#removeAttachment

#

I see it takes a PermissionAttachment

eternal oxide
#

store the permission attachment you are given when you create it

#

it returns one

shadow tide
#

k

#

how do I store it?

eternal oxide
#

in a Map

#

use the player UUID as a key

shadow tide
#

k

dull whale
#

why does p.getLocation().getDirection().multiply(new Vector(0.0275, 0, 0.0275).add(new Vector(0, 0.045, 0))); change when I look up or down

eternal oxide
#

Map<UUID, PermissionAttachment> permissibles = new HashMap<>();

shadow tide
#

ooh

#

yeah I just looked up HashMaps

#

thanks

dull whale
#

I get my direction and reset y then add 0.045

#

it shouldnt change when I dont change my x or z location

shadow tide
#

So would this add it then store it in the map?

Map<UUID, PermissionAttachment> permissibles = new HashMap<>();
player.addAttachment(CustomRecipes.getPlugin(), "CJendantix.Hack", true); permissibles.put(player.getUniqueId(), player.addAttachment(CustomRecipes.getPlugin(), "CJendantix.Hack", true));```
eternal oxide
#

remove the second line

#

so you just have the map and the permissibles.put

shadow tide
#

I have it there bc I want to actually do that, does the third line execute it?

eternal oxide
#

yes

shadow tide
#

k

solid cargo
#

how can i get Vault suffix/prefix?

shadow tide
#

so to get it I just do permissibles.get(uuid)

eternal oxide
#

when to get teh attachment to remove it?

shadow tide
#

yes

#

that was outdated

eternal oxide
#

permissibles.get(player.getUniqueId())

shadow tide
#

yes

#

I got it right

#

yay

#

I just guessed when I edited

#

yay

#

what is the exception if the key doesn't exist, just in case they didn't add the permission in the first place

eternal oxide
#

the get will return null

shadow tide
#

k

burnt current
#

Hey quick question: is it possible to set certain mobs to not attack or target players with the same username stored in their persistence data? I found something on the internet about this with the EntityTargetEvent and tested it as follows:

public void onTarget(EntityTargetEvent e) {
        e.setCancelled(true);
    }

but it did not work. Maybe I did something wrong. Can anyone help me there by any chance?

quasi flint
#

It cancels every mob targeting someone

burnt current
#

Yes, I just wanted to test it out with it for the time being.

quasi flint
#

Then where is the problem?

#

Just get the username

#

If it's in the persistent data

#

If yes cancel it

burnt current
ancient plank
#

that event supposedly fires when a mob targets or stops targeting, just letting you know

quasi flint
#

Birb

burnt current
#

okay nvm i have found the problem

#

Thanks anyway

royal nest
#

does anyone know how to make World.locateNearestStructure work? I am trying to find a nether fortress but cant make it work for the life of me.

deep sail
#

Just curious, how much obfuscation is allowed on the site?

sullen marlin
#

it's pretty clear in the rules

#

suggest reading them

deep sail
#

I'll take a look cheers

onyx fjord
#

Don't obfuscate, it's cringe

#

Especially in GPL project

#

@deep sail

manic crown
quaint mantle
eternal night
#

this is a single line else

manic crown
#

thats not the problem, i tried both versions

eternal night
#

meaning only the next statement is part of the else

manic crown
#

what can i do to fix it?

eternal night
#
else {
    sender.sendMessage("§aPlugin läuft jetzt!");
    for(Player player : Bukkit.getOnlinePlayers()) {
        player.setGameMode(GameMode.SURVIVAL);
        main.isPaused = false;
    }
}
#

?

#

also main.isPaised == false

#

not = false

#

two different things

manic crown
#

okay, I will try

#

what was the difference between = and ==?
i forgot, sry

eternal night
#

(realistically, never compare booleans to false or true tho, just do if(myBoolean) or if(!myBoolean) )

#

one assigns, the other compares

manic crown
#

but i want it to do this task if main.isPaused is false

eternal night
#

yea ?

#

if(myBool == false) is the same as if(!myBool)

manic crown
#

and if(myBool = false)
what means that?

ivory sleet
#

That’s not valid

eternal night
#

it is

ivory sleet
#

Is it?

#

Can you assign and use it as a predicate

eternal night
#

it assigns myBool the value false and then evaluates the if with the updated value of myBool

#

in this case, always false

ivory sleet
#

Oh woaw

eternal night
#

meaning that if is useless

manic crown
#

now it says '}' expected in last line

eternal night
#

add one ? xD

#

you can't just add a new open bracket at the start of your else and not close it

manic crown
#

so it was right }else ?

eternal night
#

just add a } at the end of your file and reformat

#

you are missing the } that matches the one you added at else {

royal nest
#

does anyone know how to use World.locateNearestStructure? I am trying to find the location of a nether fortress with it.

eternal night
#

how are you calling it ?

manic crown
#

it works now with

        if (main.isPaused == false) {
            sender.sendMessage("Plugin läuft Bereits");
        }else {
            sender.sendMessage("§aPlugin läuft jetzt!");
            for (Player player : Bukkit.getOnlinePlayers()) {
                player.setGameMode(GameMode.SURVIVAL);
                main.isPaused = false;
            }
        }
    }
}```
Thank you very much
eternal night
#

👍 tho again if (main.isPaused == false) should just be if (!main.isPaused)

manic crown
#

okay

#

good night you all

quaint mantle
#

👋 🥺

tropic knoll
#

Premium resource placeholders question query, please ping in reply: Are the placeholders truly just limited to strings? The wiki page statement about not working on static final suggests to me that things may be limited but I wanted to be sure there aren't other fun (chaotic) possible strategies like making the placeholder part of a variable name.

eternal oxide
#

I assume you are talking about PlaceholderAPI

tropic knoll
#

No, premium placeholders, the spigot resources injector on premium plugins. But thanks for taking the time to reply ElgarL 🙂
[edited original message to clarify as premium resource placeholders]

eternal oxide
#

had not seen them

#

the static final is probaly due to the java 16 reflection crap (security manager)

sullen marlin
#

' Also keep in mind that the placeholders will not work when declared inside a "static final" field.'

#

that just seems wrong tbh

smoky lance
#

how can I convert Map<String, Object> back to MemoryConfiguration?

eternal oxide
#

save and reload the config

smoky lance
#

but, like, I'm using it to serialize and deserialize items like this: MemoryConfiguration -> Map<String, Object> -> JsonElement (gson), and I need to parse the item back, so JsonElement -> Map<String, Object> -> MemoryConfiguration, my issue is that I don't know how to parse it back from Map to MemoryConfiguration

eternal oxide
#

You can't

#

all MemorySection constructors are protected

#

any Maps you put into a Configuration are converted upon loading to MemorySections

#

Why do you need to reverse it?

smoky lance
#

type adapter

eternal oxide
#

ah, best you can do is to a Map

old cloud
#
        WorldBorder wb = w.getWorldBorder();
        if(resetFirst)
            wb.reset();
        DoubleDoubleCouple ddc = borders.get(world).getAs(DoubleDoubleCouple.class);
        wb.setCenter(ddc.getFirst(), ddc.getSecond());
        wb.setSize(calculateCurrentBorderSize(), config.getLong(Enchantive.conpath(0)));
```Anybody knows why the world border does not show up? Do I have to set it visible or register it somehow? because after running this code literally nothing happens
foggy copper
#

Hello everyone, I'm kinda new to spigot development, and I'm trying to learn by creating some random plugins, and today, I was creating a /kit command to obviously give myself a kit.

In that, I wanted to make one of my item, a cookie, unstackable, I've been looking for over 2 days for a solution, but none of them worked, I use spigot-api 1.8 and run on paperspigot 1.8.8.

Do you guys have any idea of how I could make it ?

Thanks !

old cloud
eternal oxide
old cloud
eternal oxide
#

I'd guess ticks. Everythign in Spigot is ticks

rancid pine
#

How do I make a new world? and what even is it

#

is it just a set of coordinates

eternal oxide
#

WorldCreator

barren nacelle
#

I was trying to make a potion effect come randomly when a player enters a command but addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS) has an error https://pastebin.com/EW1M6DpY

hasty prawn
#

Cause you didn't give it an amplifier and a length

barren nacelle
hasty prawn
#

Put 60, 1 inside the PotionEffect constructor

barren nacelle
#

Thanks!

frank yoke
#

Hello

#

how are all

#

hey, how can i make that no one can put stuff in the gui

sullen marlin
#

InventoryClickEvent.setCancelled(true)

frank yoke
#

only?

sullen marlin
#

might need InventoryDragEvent as well

#

but that should do it

frank yoke
#

i'm new to programming java

fading lake
sullen marlin
#

idk

barren nacelle
eternal oxide
#

line 52 should be getCommand("join").setExecutor(new StartCommand(this));

quaint mantle
#

should be a set

#

yea fairs

#

faster right?

quaint mantle
#

doesnt seem like there's a difference

#

what do you mean by that

#

whats the difference between this and getOfflinePlayers

#

So whats the difference between the player cache and the getofflineplayer?

#

yes

#

I spammed my command hundreds of times pretty fast and it dropped the TPS of my server significantly, I assume this was due to it sending a HTTP request to the mojang servers because I was testing it with a players name which never joined my server before.

#

And ever since I used my method to check if the name cache contained the players name, so if they joined the server before, the lag stopped.

quaint mantle
#

I don't send the request

#

the spigot jar does

#

I'm just using the method: Bukkit.getOfflinePlayer

#

isn't that method deprecated

#

or is it just one of the signatures

#

Yes it is deprecated, but I don't think theres any other way to get an offline player from their name, from a command argument may I add.

#

I mean the bottleneck is probably the method using Mojang API to resolve a name to a UUID

#

can you try working in the non deprecated version?

#

Exactly why I'm using the player cache and asking if I should or not

#

If I use the "non deprecated version", how am I meant to get an "OfflinePlayer" from their name when I input their name in a command?

#

Because the "non deprecated version" requires the UUID

#

So, @quaint mantle, would a player cache be the best way to check if a user has joined the server before? Like I'm doing above?

young knoll
#

It is deprecated as a warning

#

You should use it off the main thread

quaint mantle
#

Really?

#

would you want to do that synchronously or no

#

I didn't think bukkit API stuff was thread safe

young knoll
#

Some stuff is

#

Like this for example

frank yoke
#

Hello brothers

#

why i can put stuff in the gui?

#

I don't want that

#

how to solve this

#

?

waxen plinth
#

Cancel the click events

quaint mantle
#

@young knoll
Would this work?

    public static CompletableFuture<OfflinePlayer> getOfflinePlayer(String name) {
        return CompletableFuture.supplyAsync(() -> Bukkit.getOfflinePlayer(name));
    }```
young knoll
#

Yes

#

As long as you use it properly

quaint mantle
#
            OfflinePlayer offlinePlayer = PlayerUtils.getOfflinePlayer(name).get();```
@young knoll ?
young knoll
#

No

quaint mantle
#

hm

#

1 sec then

#

lemme figure this out

#

.thenAccept?

young knoll
#

Correct

quaint mantle
#
            PlayerUtils.getOfflinePlayer(name).thenAccept(offlinePlayer -> {
                if(!this.userDataModule.getUserManager().has(offlinePlayer.getUniqueId())) {
                    player.sendMessage(StringUtils.colorize("&6&lE&e&lP &8&l» &e" + name + " &fhas never joined the server before!"));
                    return;
                }
            });```
#

hm?

young knoll
#

Looks good to me

quaint mantle
#

Alr, thanks ❤️

#

Eyy! It works 🙂

frank yoke
quaint mantle
#

Thank you so much ❤️ @young knoll

#

Appreciate it

frank yoke
#

but the same

frank yoke
#

i do him

#

if (inv.getTitle().equalsIgnoreCase("Menu")) {
e.setCancelled(true);

quaint mantle
frank yoke
#

yes

frank yoke
quaint mantle
#

alr

golden turret
quaint mantle
golden turret
#

search it

#

without time now

#

😎

tribal gyro
#

Hi! I'm new to making spigot plugins. I want to make a simple plugin that drops double the exp and materials when you break a block. How would I do it? I followed a youtube tutorial but even if you break say stone with your hand it still drops 2 stone. How do I fix this?

young knoll
#

Use the BlockDropItemEvent

tribal gyro
#

wdym

young knoll
#

It’s called after the block break event and contains a list of item that drop

#

You can just double the amount of em all

tribal gyro
#

can you show me

young knoll
#

Show you what

tribal gyro
#

like

#

how to do it

#

is it

#

something

#

that event returns

#

like GetBlock()

#

sry im kinda dumb lol

#

ok I did a compromise lol

tribal gyro
#

o thanks

#

what does the list contain?

manic crown
#

https://jsheets.dev/s/c5da1920-8d38-4634-85ad-391d549de917

Hi, how can i do, that if a Player has not been teleported and the timer resumes all players who didn´t got teleportet yet get teleportet.
I prefer in private void resume(CommandSender sender){ if (main.isPaused == false) { sender.sendMessage("§cPlugin läuft Bereits"); } else { sender.sendMessage("§aPlugin läuft jetzt!"); for (Player player : Bukkit.getOnlinePlayers()) { player.setGameMode(GameMode.SURVIVAL); main.isPaused = false; } } }

the rest of the code is in JavaSheets

Pls tag me with @manic crown

young knoll
#

It does tell you the return type

#

I advise you look at the docs for the Item class

sharp bough
manic crown
#

yeah. but a list which says, which players already ha been tp´d

sharp bough
#

what you could do is save all players in a hashmap <player,boolean>, if not paused check if boolean of player and if false teleport

#

you could add players to that list

#

and if not paused they will get teleported

manic crown
#

the problem is, i´m new at programming...

sharp bough
#

im not sure what your code is doing currently, theres a lot of comments missing and some of the messages are not in english

sharp bough
#

im assumming theres a command like /join or smth?

#

how do you know when a players needs to be teleported?

manic crown
#

moment

sharp bough
#

aight im brb, tag me when your back

manic crown
#
    public void onPlayerJoin(PlayerJoinEvent event) {
        if (isPaused) return;
        Player player = event.getPlayer();
        List<String> teleportedPlayers = getConfig().getStringList("teleported-players");
        if (teleportedPlayers.contains(player.getUniqueId().toString())) return;
        event.getPlayer().teleport(spawnLocation);
        teleportedPlayers.add(player.getUniqueId().toString());
        getConfig().set("teleported-players", teleportedPlayers);
        Bukkit.getScheduler().runTaskAsynchronously(this,
                () -> saveConfig()
        );
    }```
tribal gyro
#

how do I get multiple types of events using registerevents

sharp bough
#

its like a list with a key

#

so basically you have <value,key>

young knoll
#

No reason to map something to a Boolean

#

Just use a set and .contains

manic crown
#

i´m using the config file

sharp bough
#

so you want to teleport the player that you took from config file to spawnlocation?

manic crown
#

yep

sharp bough
tribal gyro
#

and idk hwo to use it both

sharp bough
#

just register both events?

manic crown
#

I want it to have in the marked, but i don´t now how to implement it

quaint mantle
#

how to check if the creeper who killed the player was charged

#

or not

sharp bough
quaint mantle
#

yep

sharp bough
quaint mantle
sharp bough
#

and get the entity that killed the player

quaint mantle
#

but I am not able to achieve that

quaint mantle
manic crown
sharp bough
quaint mantle
#

idk

sharp bough
#

no thats a jar file, i need the source code

quaint mantle
#

could u please send the code perhaps

sharp bough
#

the two classes that you have

sharp bough
#

i think that works

#

read it and tell me

sharp bough
manic crown
#

changing border size = XP level timer, pause and resume

sharp bough
#

you change the border size based on the player xp?

manic crown
#

and border reset (resets xp, xp level, bordersize in config file and tp´t players and timer)

sharp bough
manic crown
#

like bastighg´s challenge if you know what i mean

sharp bough
#

go with something simple

#

like a join quit plugin

#

a kit plugin

#

a spawn plugin

manic crown
#

ik, this was a plugin, what i wanted to play with a friend

tribal gyro
sharp bough
tribal gyro
#

like what do I put on the line

getServer().getPluginManager().registerEvents(new BreakBlock(), new BlockDropItemEvent(),this);```
sharp bough
#

?learnjava

undone axleBOT
manic crown
#

that wasn´t ne alone...

#

the most, the pro guy did...

sharp bough
quaint mantle
sharp bough
#

or focus or soemthing else

#

so you can learn how to do tha tplugin

manic crown
#

yeah, i will do... but thank you anyway

sharp bough
sharp bough
winged anvil
#

is there a way to get a bungee cord server name without using messaging

vague oracle
#

why do you need the bungee cords name

rancid pine
#

What beginner plugins should I make it’s overwhelming with all the stuff in the spigot library

winged anvil
#

to connect players to a bungeecord server

#

like another server on the proxy

#

just dm

vague oracle
#

You can then look at the source code if you get stuck or to compare on how to improve

rancid pine
#

Ok thank you

#

Is essentials a plug-in?

#

And how do I look at the source code

barren spoke
#

Would any coder like to work with me I am needing 3 custom coded plugins done! DM Me if interested

undone axleBOT
remote gazelle
quaint mantle
#

go to an unused method that is annotated by EventListener, put ur text cursor in the name of the method

#

then press Alt+Enter

#

then u will see something like suppress unused warning if annotated by <EventListenerPath>, click on that

craggy cosmosBOT
quaint mantle
#

I was making this plugin which asks you to die in a specific way in 5 minutes (inspired by dream's latest video) between 2 players. If 1 player fails to complete the other wins

#

so what I was doing is I was making a listener of death

#

and if player a dies in the way he was told

#

I was setting a boolean ahascompleted to true

#

and after a delay of 5 minutes

quaint mantle
#

and after a delay of 5 minutes

#

if player a had not completed I would declare the winner

quaint mantle
#

possibly due to the delay thing I am using

sullen marlin
#

well what is the error

#

@quaint mantle did you add the repository? is the dependency name and version correct? post your pom.xml

quaint mantle
#

this is my delay

sullen marlin
#

use the scheduler API, you can't just call sleep it will sleep the whole server

latent dove
#

yeah

ivory sleet
#

?scheduling

undone axleBOT
sullen marlin
#

handy link, I'll remember that

#

?paste

undone axleBOT
sullen marlin
#

spigot-api not spigot

#

(line 70)

cerulean jasper
#

How do I handle UUIDs on an offline server? or how do I even detect if its offline serrver?

I have this error

Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because the return value of "me.chickenstyle.wonderfish.Fish.getPlayerCaught()" is null

on offline mode server

old cloud
#

Hello, is it possible to enable mob spawning outside of the worldborder?

cerulean jasper
drowsy helm
#

same way you do regularly

#

not sure about offlinePlayers but if they're online itll work fine

cerulean jasper
#

Ok maybe I am doing something else wrong then, checking

#

How do I add this to maven? 😅

import net.md_5.bungee.api.chat.TextComponent;
#

I added bungee but didnt help. maybe I got my pom setup wrong

latent dove
#

someone tell me the simplest way to work with custom config

tender shard
#

but it returns null for players who never joined your server

tender shard
old cloud
cerulean jasper
#

Weird... I am getting other spigot related problems like this is being unimported

net.minecraft.world.item.ItemStack craftItemStack = CraftItemStack.asNMSCopy(item);
sturdy flax
#

?paste

undone axleBOT
old cloud
crude sleet
#

It is possible to get all arguments of a String after args[1] without loops? I want that the Player can use the Command "/quest create The first Quest"

fading lake
#
List<String> list = new ArrayList(Arrays.asList(args));
list.remove(0);
String[] argsYay = list.toArray(new String[0]);
#

ezpz

old cloud
#

Or use System.arraycopy

fading lake
#

that could work

crude sleet
#

That makes sense, I think it's Monday morning because I didn't get that idea. Thanks!

fading lake
#

that'd only get 1 value

candid plover
#

How to create an inventory with all current items of a player?

fading lake
#

thats not a question

#

but ok

#

just make a chest ui, iterate through their inventory, clone the itemstacks to the identical slot and poof

candid plover
fading lake
#

again, not a question

#

itemstack has a clone method

#

which you can use to

#

✨ clone ✨

young knoll
#

You can probably just use getContents and setContents

hollow sand
#

How would I be able to get a weather type? I searched thru hub.spigotmc.org, but cant find anything

#

For an example, I want to get the weather rain. But how would I be able to do that?

candid plover
young knoll
#

> 0 is sunny, 0 is raining

summer scroll
burnt current
#

quick question: I just created a command that spawns mobs that do not attack or target the player who spawned the mobs. However, I would now like to make it so that the mob runs after the player without attacking him. My first idea would have been to set the target of the mob on the player until they are only 2 blocks or so away and then remove the target again. Or is there perhaps a simpler method?

slim kernel
onyx fjord
#

For that

old cloud
onyx fjord
#

I don't think so

#

¯\_(ツ)_/¯

#

Ooo

#

Download purpur

#

It might have this option

old cloud
#

ok

#

Anyone knows how I could change the vanilla entity spawning process?

onyx fjord
#

Like?

old cloud
#

I just want to spawn mobs outside of a world border

onyx fjord
#

I mean

#

Idk if it's possible without modifying the server

old cloud
#

I already tried to just modify the spawning location of mobs that spawn inside of the world border area but the server lags so hard when doing that

slim kernel
quaint mantle
#

how to broadcast a msg to everyone on the server

quaint mantle
tardy delta
#

smh

#

I didn"t know that method existed

quaint mantle
chrome beacon
#

It should give a crash log

#

What does it say

eternal oxide
#

that code should not be valid, you define bossBar as final, then later you assign it

#

what do you mean by "crashes"?

acoustic pendant
#

Hey! i'm not sure what i should return here, is this ok?

eternal oxide
#

no

#

it will work, but why not return the plugin?

quaint mantle
#

yes, if ur don't want to use that method ever in ur project :) (Listen to ElgarL, I m joking)

acoustic pendant
#

oh

#

you are joking

quaint mantle
#

yes lol

acoustic pendant
quaint mantle
#

why did u create that method in the first place?

eternal oxide
#

the method seems to be to get the plugin, the return value should be a Plugin, so why not return teh plugin?

acoustic pendant
eternal oxide
#

?di

undone axleBOT
eternal oxide
#

you should read that about passing references

acoustic pendant
#

why a dependecy?

quaint mantle
acoustic pendant
#

why=

chrome beacon
#

I'd suggest you do some java tutorials

alpine urchin
#

^ first

#

its like studying how to write english essays without fully understanding english

#

first learn java, then use java to code spigot plugons

#

many users take it as an offense but it makes your life easier

#

@acoustic pendant

acoustic pendant
#

ik

#

i don't take it at that

#

but i would like to finish a plugin before my server get online

alpine urchin
#

i see

#

what kind of plugin is it

acoustic pendant
#

eeh

#

stats

latent dove
#

erm

#

can i help with the plugin

#

im also new

#

but have 2 days of experience

alpine urchin
#

Lol

latent dove
#

(definitely not 3 years)

#

( ^ not lying)

acoustic pendant
#

well, my plugin isn't creating a file for some reason

latent dove
#

code

acoustic pendant
#

?paste

undone axleBOT
alpine urchin
#

did you already show code

acoustic pendant
#

no

#

this ^^

latent dove
eternal oxide
#

your getPlugin method needs to return this;

alpine urchin
#

his method is static

#

so he cant do that

latent dove
eternal oxide
#

well in that case he needs to store a static instance and set it in onEnable

alpine urchin
#

show us your main class

acoustic pendant
latent dove
#

send us your project

#

we will make good use ;)

eternal oxide
#

but thats still wrong, which is why I told him to read the dependency injection help thread

#

?di

undone axleBOT
eternal oxide
#

Just add to this class java public dataStore(JavaPlugin plugin) { this.pl = plugin; }

#

then in your MineSpaceSkills, change new dataStore() to new dataStore(this)

latent dove
#

easier way is to make a seperate instance of Main

acoustic pendant
#

oops

#

haven't registed

latent dove
#

............

#

.......................

latent dove
eternal oxide
#

Shoot you for using Main

latent dove
#

no

#

i use main

eternal oxide
#

yes, Main is for applications, these are plugins.

acoustic pendant
#

i register it the same way as a event? xD

latent dove
#

wait

#

i think no

#

i never done that

eternal oxide
#

there is only ONE Main in an application and that is in Spigot

latent dove
#

well

#

yes

#

but

#

main is cool

eternal oxide
#

no buts

latent dove
#

and it throw no error

#

so im chill

#

free datastorage file yay

#

anyone who is rlly good at using spigot api wanna be my fren

tardy delta
#

Shit i also use main

#

Just because i switch between multiple of my plugins

eternal oxide
#

Main is correct if it were a stand alone application.

tardy delta
#

True

latent dove
#

can u tell me what to make to become pro at spigot

eternal oxide
#

These are plugins though, so the entry point should be named as something appropriate for the plugin.

#

The standard has been to use the actual plugin name, GroupManager, WorldGuard, WorldEdit etc

#

To be a "pro" at spigot you just need to keep a tab open in your browser for the javadocs

#

?jd-s

undone axleBOT
latent dove
#

i need a project to make

alpine urchin
#

I have javadocs memorized

#

in my heasd

#

im a gigapro

eternal oxide
#

🙂

alpine urchin
latent dove
alpine urchin
latent dove
#

tell me prpoejct to make

eternal oxide
#

You need to make somethign that you are interested in

alpine urchin
latent dove
#

i have no interests

#

other than weed

alpine urchin
#

Then don't make project.

eternal oxide
#

then always a noob

alpine urchin
#

Cause you will abandon it

latent dove
eternal oxide
#

weed makes you lazy

latent dove
#

i only like weed

alpine urchin
#

But still make it for the learning experience

latent dove
#

i dont use it

#

tho

eternal oxide
#

I lost a week back in 1997 to weed

latent dove
#

i gtg

#

good bye weman

alpine urchin
#

ok

#

thank god

#

hes gone

#

jk

#

love u lcky_

#

good luck with ur dev career tho

acoustic widget
#

Hello I'm trying to using nms with spigot on gradle.
Tried that :

    compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
}````
But not working when i'm trying to access EntityPlayer class on my main java
any idea ? (I start java dev, sorry for newbi question)
quaint mantle
#

use buildtools

opal juniper
#

oh yeah - have you run buildtools

#

it installs spigot into your local m2

burnt current
#

Quick question: Is it somehow possible to get the distance between a player and another entity?

opal juniper
#

yep

#

use teh locations

#

Location#distance(Location)

#

although if you are just comparing use #distanceSquared as it saves the sqrt

alpine urchin
#

or distanceSq

#

^^

#

square rooting often can become heavy

opal juniper
#

computer is weak

burnt current
#

so it could look like this, for example: player.getLocation.distance(entity.getLocation)

opal juniper
#

yep

#

returns a double iir

burnt current
#

okay thank you

quaint mantle
#

:( whats an install wizard

opal juniper
#

wow someone salty

#

its a joke lol

quaint mantle
#

i am aware

#

i responded with an equal level of shitpostery

opal juniper
#

hehehehehee

wide creek
opal juniper
#

Nope

#

if you added it to your pom

#

you can then just follow the rest of the tutorial in the README

wide creek
#

i asked bc i wrote this:

private void setupWorldBorderAPI() { //I wrote this by myself
        RegisteredServiceProvider<WorldBorderApi> worldBorderApiRegisteredServiceProvider = getServer().getServicesManager().getRegistration(WorldBorderApi.class);

        if (worldBorderApiRegisteredServiceProvider == null) {
            getLogger().info("API not found");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        worldBorderApi = worldBorderApiRegisteredServiceProvider.getProvider();
        return worldBorderApi != null; //I wrote this by myself
    }

and the last two worldBorderApi are in red. Error: Cannot resolve symbol 'worldBorderApi'

opal juniper
#

lol - you havent defined a worldBorderApi variable

#

this is an example test plugin

wide creek
#

ok fixed

#

thx

tacit drift
#

can you return a textcomponent to a papi placeholder?

opal juniper
tardy delta
#

Lol

acoustic widget
tardy delta
#

Just doubleclick

chrome beacon
#

They are doing some update checks and it's not working

#

Just ignore it or disable the update check

burnt current
#

Sorry, I have a quick question: I'm trying to build a listener that prevents certain mobs spawned by a command from attacking a certain player. To do this, when the mobs spawn, I put persistentdata with the name of the player who spawned the mobs into them. This has all worked so far. However, I still wanted these mobs to run after the specific player. I wanted to do this so that the mobs always have this player as a target if they have a greater distance than 2 to this player and as soon as the distance is smaller, the event should be cancelled. However, it is not cancelled. Once the mob has me as a target, this no longer changes. Does anyone know how I can fix this?

btw this is the method:

@EventHandler
    public static void onTarget(EntityTargetEvent e) {
        Entity entity = e.getEntity();
        Entity target = e.getTarget();
        if(e.getTarget() instanceof Player) {
            Player player = (Player) target;
            PersistentDataContainer entitydata = entity.getPersistentDataContainer();
            if(player.getName().equals(entitydata.get(new NamespacedKey(Main.getPlugin(), "key"), PersistentDataType.STRING))) {
                if(player.getLocation().distance(entity.getLocation()) > 2) {
                   return;
                } else
                e.setCancelled(true);
            }
        }
    }
quaint mantle
#

PathFinding might work?

graceful cargo
#

how do i check which dimensions mobs got killed in

#

by a player

hasty prawn
#

Also are you just trying to make a mob follow a player?

acoustic widget
#

How work buildtool ? Is it simulating repo server on local machine ? Is how that it works ? I dont understand exactly

acoustic widget
wide creek
#

I want to create a .yml file for every player joined. How can I do it? I searched on google but i didnt understood that much
I want to do something like EssentialsX UserData folder

eternal night
#

Ah. BuildTools basically clones all the repositories needed, downloads the minecraft vanilla server, decompiles it and then applies the spigot patches. After all of it is done, it compiles you the server (a very, very, very high level description, that is missing a bunch of things)

quaint mantle
acoustic widget
#

ok thank you

tribal gyro
#

how come I can't detect if an entity is dead or is on ground

#

wait nvm

#

it was typo

#

lol

quaint mantle
#

Entity#isOnGround()

#

Entity#isDead()

#

might be booleans or function calls i dont rly remember bc i use kotlin lol

ivory sleet
#

nokotlin (:

ancient plank
#

noko tlin

ivory sleet
#

I mean have nothing against kotlin but it doesn’t really cut out verbosity imo which would be the main motive one would use it over Java if I understood correctly

burnt current
#

ok i removed it but the problem is still there

tribal gyro
#

lol

acoustic pendant
#

Hey! i have a problem...

#

I have this code, but it sends an error to the console

#

but if u put this it sends an error too

tribal gyro
#

click

#

1 related problem

acoustic pendant
#

the problem is here

tribal gyro
#

click make it static

#

i have no idea

acoustic pendant
#

sends error

ivory sleet
#

Well why do you have getPlugin() which returns this

tribal gyro
#

^

acoustic pendant
ivory sleet
#

Yes but it’s completely redundant

#

You can just use the this keyword instead

acoustic pendant
#

hmm

ivory sleet
#

Also if you want to access your plugin instance in other classes just use JavaPlugin.getPlugin(MainClassName.class)

#

No need to create a singleton of your own

acoustic pendant
#

oh

#

Thanks!

#

finally it creates the folder! tysm!

ivory sleet
#

No worries

visual tide
#

Or just pass it in properly

scenic cypress
#

I'm trying to copy a map from an existing world and create a new world with that map how would I go about doing that?(In a plugin, not manually)

mystic sky
#

Any1 knows how to implement BungeeCord-proxy on maven? I don't find the repo/api of proxy.

#

Why not ```java
Bukkit.getOnlinePlayers();

quaint mantle
#

Not sure if that is deployed

mystic sky
#

Well, i can implement it with artifacts but it's not that good

tribal gyro
#

how do I detect when a player clicks

mystic sky
#

I really need it cause, in proxy it's initialhandler & loginresult

tribal gyro
mystic sky
#
        if(ev.getAction() == Action.RIGHT_CLICK_AIR){
            ev.getPlayer().sendMessage("cps");
        }
tribal gyro
#

what event is it

mystic sky
#

PlayerInteractEvent guessing

quaint mantle
#

^

mystic sky
#

To implement it on the pom, without artifacts xd

#

yeah i could import it from my files, but it's ugly

mystic sky
#

: o ty

mystic sky
#

give me 5m and ill help u im fixing my things toox d

eternal oxide
# mystic sky I really need it cause, in proxy it's initialhandler & loginresult

For BungeeCord ```xml
<repositories>
<!-- BungeeCord repository -->
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>

<dependencies>
    <!-- BungeeCord API -->
    <dependency>
        <groupId>net.md-5</groupId>
        <artifactId>bungeecord-api</artifactId>
        <version>1.16-R0.5-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <!-- BungeeCord Javadocs -->
    <dependency>
        <groupId>net.md-5</groupId>
        <artifactId>bungeecord-api</artifactId>
        <version>1.16-R0.5-SNAPSHOT</version>
        <type>javadoc</type>
        <scope>provided</scope>
    </dependency>
</dependencies>```
quaint mantle
#

bungeecord api doesn't have the connection stuff

mystic sky
#

I need some connection/http things

#

Btw, already fixed anyways fixed

acoustic pendant
#

Hey! i'm getting an strange error to the console, it says that it can't find the path but it sends the file to the folder I have specified...

file = new File(pl.getDataFolder() + File.separator + "Data", "players.yml");

this is the code

young knoll
#

Are you creating the directory if it doesn’t exist

acoustic pendant
#

hmm

alpine urchin
#

im doing this:

 player.getInventory().setStorageContents(getStorageContents());
 player.getInventory().setArmorContents(getArmorContents());```
why is my inventory empty?
acoustic pendant
#

no

tribal gyro
#

why don't I have a target folder

#

huh

acoustic pendant
#

it should at least

tribal gyro
quaint mantle
acoustic pendant
#

it's creating the folder and the file but sends the error to the console

alpine urchin
#

with player.getInventory().getContents()

#

and getArmorContents

#

why

mystic sky
#

To see if im bad or it's bugged

alpine urchin
#

i think setStorageContents is what im looking for

#

ima test

quaint mantle
mystic sky
#

Yeah i have it

#

Maybe it's again my cache of .m2 give me 1s

#

Yep, not working

mystic sky
alpine urchin
#

armor contents works perfectly

#

but the inventory contents not

#

and getStorageContents wont work either

mystic sky
#

It's only working protocol @quaint mantle

quaint mantle
#

might be in the snapshot repo

mystic sky
quaint mantle
#
        <id>codemc-snapshots</id>
        <url>https://repo.codemc.io/repository/maven-snapshots/</url>
    </repository>```?
mystic sky
#

i did it

alpine urchin
#

:c

mystic sky
#

But that repo it's adding me all BungeeCord api's

burnt current
young knoll
#

You would probably have to create a custom pathfinder

#

Or use a runnable to clear their target when they get close

acoustic pendant
lean gull
#

i have a question for everyone: what's the best way to make a ranks plugin? like teams, packets and nms or whatever and stuff like that

young knoll
#

I really should use reply’s more

regal moat
#

Hey, so, I am new to SQL, trying to check if the id exists.

ResultSet rs = main.prepareStatement("SELECT COUNT(DiscordID) FROM DiscordLinked WHERE DiscordID = " + event.getAuthor().getId() + ";").executeQuery();

rs.next();

if (!main.keycodes.containsKey(generatedString) && rs.getInt(1) == 0) {
    // Do stuff
}```
#

Doesn't seem to work

burnt current
young knoll
#

No

#

It’s all NMS stuff

burnt current
near aurora
lost matrix
#

?jd

near aurora
hasty prawn
burnt current
#

okay. how and where would I have to apply this exactly?

acoustic pendant
#

How is the better way to store in files?

#

creating a file per user

#

or storing all the data in the same file?

young knoll
#

I would say per user

vague oracle
#

Same file i think

acoustic pendant
#

uh

acoustic pendant
ivory sleet
#

Always per user I’d say

acoustic pendant
#

i'm trying to define PlayerJoinEvent in a for () but sends an error and i don't know how to solve it

young knoll
#

Yeah you can’t really do that

#

Events are generally their own method

acoustic pendant
#

uh

#

so don't really know how to do it

#

let me think

#

Maybe with a task?

#

every 1min it creates files of the players are on

#

and i have the !file.exist

#

so i think it should be ok

young knoll
#

Just use the join event?

acoustic pendant
#

how?

eternal oxide
#

the join event only fires when a player joins

#

we have an x/y issue here

acoustic pendant
#

x/y?

eternal oxide
#

?xy

undone axleBOT
young knoll
#

I mean that seems like an appropriate time to create a player data file

ancient plank
#

player joins server -> server calls playerjoinevent -> your plugin has a method that listens to that event -> do your magic there and make the player data stuff gg

eternal oxide
#

I'd actually create it in the asyncprelogin event myself

#

then update in join

young knoll
#

Fair

#

But same idea

eternal oxide
#

yep

ancient plank
#

I personally load my data in onenable and save in ondisable

#

probably not good in a ton of cases but it works for my use case

young knoll
#

That just seems like a waste of memory with player data files

eternal oxide
#

depends on teh use

acoustic pendant
#

it won't be better to save the data at x time?