#help-development

1 messages ยท Page 2093 of 1

glossy venture
#

talking

austere zenith
#

how to use better bees spigot plugin

proper pawn
coarse finch
eternal night
#

can you ?paste your pom

#

?paste

undone axleBOT
proper pawn
#

like this?

quiet ice
glossy venture
#

yeah it technically works

#

but its a bit confusing

eternal night
#

Ah

#

it seems like you did not run your build tools ?

tardy delta
#

bird

proper pawn
#

i did "java -jar BuildTools.jar --rev 1.18.1 --remapped"

eternal night
#

and that worked ?

#

is your build tools up to date

proper pawn
#

i got [WARNING] The requested profile "remapped" could not be activated because it does not exist.

eternal night
#

update your build tools

#

and maybe clean your build tool work environment

#

that seems like build tools is trying to do stuff on an outdated source

proper pawn
#

wdym exactly? sorry im not good.

eternal night
#

like, when running that you should get a bunch of folders in the directly you run the command in

#

work Bukkit CraftBukkit etc

proper pawn
#

yea i got that

eternal night
#

Delete those

#

download the latest build tools

#

from the website

#

and then try again

coarse finch
#

someone please help, how can i update my config to newer version while keeping custom values

proper pawn
#

thats what i did already but ill try again

eternal night
#

if it still fails, please send the entire logs of the build tool

restive tangle
#

The player armor slots are 100-103 right?

eternal night
#

you can upgrade a config by basically having a version field in the config

#

and then run migration logic based on the version you find

coarse finch
#

yes i know

#

it doesnt work

eternal night
#

"it doesn't work" is not really a thing anyone can help you with

coarse finch
#

it doesnt update the config

eternal night
#

what doesn't update the config

coarse finch
#

this java reloadConfig(); this.saveDefaultConfig(); saveConfig();

eternal night
#

what is that

coarse finch
#

but it should

eternal night
#

how is that going to perform a version upgrade

coarse finch
eternal night
#

you reload the config, e.g. load all values from file, then call saveDefaultConfig which does nothing because a file already exists

#

and then you save it ?

#

how does that do anything

noble lantern
#

getStraight("key", "default value");

#

String*

coarse finch
noble lantern
#

You need to save the config after using it

coarse finch
#

yes and i do

noble lantern
#

AE does this so your doing something wrong somewhere

coarse finch
eternal night
#

no

#

saveDefaultConfig just writes the config in your jar to disk if the file does not exist yet

noble lantern
#

^

smoky anchor
#

Hello &everyone.
Does anybody here know how to iterate over all possible block states ?

noble lantern
eternal night
coarse finch
#

ah so ive been lied to

#

got it

eternal night
#

lol

paper falcon
noble lantern
#

Nope

#

Also

paper falcon
#

okay

noble lantern
#

Pls use putIfAbsent

#

Prevents duplicate entries

eternal night
#

also, quick side question, if you are just storing, I presume, a team, why do you need multiple hashmaps

paper falcon
#

a hashmap for each team, I'll do various things

glossy venture
#

just store the team keyed by player

#

instead of storing null

#

otherwise use a hashset per team or something

eternal night
#

that looks good @proper pawn

wet breach
eternal night
#

^

glossy venture
#

like

HashMap<Player, Team> teams = new HashMap<>()
#
public enum Team {
  RED, GREEN, BLUE
}
proper pawn
eternal night
#

Yea because it is mojang mappings

#

lemme grab you a page to translate between spigot mappings and mojang mappings

glossy venture
#

and maybe a

HashMap<Team, List<Player>> playersByTeam = new HashMap<>();
eternal night
paper falcon
#

alrighty thanks @glossy venture

eternal night
#

WorldServer -> ServerLevel

#

for example

glossy venture
#

to insert do like

public void setTeam(Player p, Team t) {
  teams.put(p, t);
  playersByTeam.computeIfAbsent(t, __ -> new ArrayList<>()).add(p);
}
#

forgot to add the key lol

paper falcon
#

๐Ÿ‘Œ

coarse finch
#

@noble lantern how can i delete values that should no longer exist?

noble lantern
#

Set the path value to null iirc

coarse finch
#

ok

coarse finch
#
reloadConfig();
getConfig().getBoolean("back-enabled", true);
getConfig().getBoolean("kickall-exempt-enabled", true);
getConfig().getString("messages.permission-message", "You don't have permission to use this!");
getConfig().getString("messages.kickall-message", "Kickall command was used!");
getConfig().getString("config-version", null);
this.saveDefaultConfig();
saveConfig();```
#

should remove config-version and ass messages.kickall-message

#

but it doesnt

#

@noble lantern

hybrid spoke
#

longest thread alive goes brr

#

rip #Cipher

coarse finch
crude loom
#

Is it possible to get a material given DyeColor?

wet breach
#

should remove that

coarse finch
#

huh

#

ok

coarse finch
wet breach
#

well you are getting the values

#

not setting them

#

so change all them gets to sets ๐Ÿ˜‰

glossy venture
#

save the default config in onEnable

#

at the start

simple silo
#

how to use mappings of the NMS files?

wet breach
#

you need to save your in memory changes to apply

coarse finch
glossy venture
wet breach
#

I am assuming set something in the config

noble lantern
#

Hes trying to manage configs between versions

coarse finch
#

yes

noble lantern
#

Ie plugin versions

wet breach
#

well regardless still need to use the set methods

#

to set something in config

noble lantern
#

There move be a remove or delete method

coarse finch
#

it not just the delete that deosnt work

#

none of it works

noble lantern
#

Only call saveConfig

#

saveDefaultConfig should only run in your plugin one time

coarse finch
wet breach
#

saveDefaultConfig replaces the config.yml

#

with the config.yml in the jar

coarse finch
#

it does not

#

i tried that

smoky anchor
#

Hello &everyone.
Does anybody here know how to iterate over all possible block states ?

eternal night
#

Only with NMS

#

the API does not really provide you a way to do so

glossy venture
#

bro ive been living with my stupid bug for way too long
basically it needs to download and unzip the minecraft assets, but the check to check if i needed to download them again always returned true, so i was waiting for 10 seconds every single restart

#

i finally fixed it

wet breach
coarse finch
#

yes

wet breach
#

I find it odd in how many people have problems using simple methods

coarse finch
#

main/resources/config.yml

wet breach
#

like, these api stuff don't magically just stop working ๐Ÿ˜‚

coarse finch
#

i always have stupid issues no one else has

#

its a curse

eternal night
#

saveDefaultConfig does only overwrite the config.yml if it doesn't exist yet

#

didn't we go over that already ๐Ÿค”

coarse finch
#

yes

#

we arent doing that anymore

eternal night
#

oh what are we doing then

wet breach
#

trying to set defaults per version and then saving them to config

eternal night
#

your get calls do not change the values in the config instance

wet breach
#

I already mentioned this

#

lol

coarse finch
#

but wont set reset custom values

eternal night
#

Well if you call set on existing configurable paths then yes

coarse finch
#

then how can i make sure it doesnt do that

eternal night
#

there is a contains(String) method to check if it already exists

coarse finch
#

actually, can i just check if the key exists

eternal night
#

isn't that exactly what the mentioned contains method would allow you to do ๐Ÿ˜‚

coarse finch
#

no?

eternal night
#

what ๐Ÿ˜…

coarse finch
#

it check if it contains a string

eternal night
#

no

#

lol

coarse finch
#

not if a key existss

eternal night
#

hmm

coarse finch
#

wait

#

what is setDefaults

eternal night
glossy venture
#

would this be everything?
i dont have enough time and will to test all cases

glossy venture
#

idk im trying to implement all methods i might need

#

to a custom item stack wrapper thing

#

CompiledStack

wet breach
#

but why do you need to change the hash in that way?

glossy venture
#

you mean the hash = hash * 31 + ...

#

?

wet breach
#

yes

glossy venture
#

idk i saw it in Arrays.hashCode(...)

eternal night
#

wouldn't the nms item stacks have proper equals and hashing methbods

glossy venture
#

nope

#

they dont

eternal night
#

yikes

glossy venture
#

lol

eternal night
#

mojang strikes again

glossy venture
#

yeah

wet breach
#

its not hard to make your own

#

but I just don't know why you need to do it that way lol

frigid rock
#

does anybody know what this means? (its mongodb) Expecting replica set member from set 'Cluster0-shard-0', but found one from set 'atlas-8yanjy-shard-0'

coarse finch
#

lmao dyno is offline

glossy venture
#

tf

mighty pier
#

main class: https://paste.md-5.net/atidorocir.java
yamlconfiguration class: https://paste.md-5.net/equpasuwoj.java
placeholderapi class: https://paste.md-5.net/equpasuwoj.java
error in console: [13:42:39 WARN]: Exception in thread "Craft Scheduler Thread - 21648" [13:42:39 WARN]: org.apache.commons.lang.UnhandledException: Plugin Scoreboard-revision vR4 1.1 RELEASE generated an exception while executing task 10 at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException [13:42:39 WARN]: Exception in thread "Craft Scheduler Thread - 21649" [13:42:39 WARN]: org.apache.commons.lang.UnhandledException: Plugin Scoreboard-revision vR4 1.1 RELEASE generated an exception while executing task 10 at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException

#

there is something wrong with return String.valueOf(Disabler.instance.getKills(p));

summer scroll
glossy venture
#

looks like Disabler.instance is null

mighty pier
#

e

glossy venture
#

show rest of stacktrace

mighty pier
#

its all of it

glossy venture
#

is the error produced in String.valueOf

summer scroll
#

is getKills a get method from HashMap?

mighty pier
#

no

#

yamlconfiguration

summer scroll
#

okay, the instance is null then

#

show the code

summer scroll
#

look at your onEnable on Disabler class

restive tangle
#
                (gearMap[inventory.helmet!!.type]!! + gearMap[inventory.chestplate!!.type]!! + gearMap[inventory.leggings!!.type]!! + gearMap[inventory.boots.type]!!)

What are the armor slot indexes?

summer scroll
#

you initialize instance = null on line 31

mighty pier
#

yes ondisabler

#

ondisable

summer scroll
#

oh

#

my bad

#

i usually have onEnable first

mighty pier
#

yes same i just copied the code

onyx flax
#

Would anyone be able to point me to a tutorial or document about unit testing w/ Spigot? I'm used to unit testing with things like PHPUnit and Mockery and a couple other web frameworks, but really getting tired of random PRs where people aren't testing their code ๐Ÿ˜‚ so I'll test it for them.

summer scroll
mighty pier
#

e

restive tangle
mighty pier
coarse finch
#

is there a place where i can ask people to join a server to help me test my plugin real quick?

mighty pier
#

i didnt do PlayerData.setup in the getKills,deaths,etc

glossy venture
#

why not set up player data in onEnable

mighty pier
#

idk

#

i dont get the any player's uuid when in onenable

summer scroll
mighty pier
#

oh

#

ok

summer scroll
#

And do it inside onEnable

mighty pier
#

ok it works

coarse finch
#

can anyone join my server real quick to help me test my plugin

mighty pier
#

k

#

send ip

coarse finch
mighty pier
#

bruh

#

im on 1.8

coarse finch
#

oh oof

restive tangle
#

Do armor slot indexes stay the same for all versions?

glossy venture
#

sure

#

im in the server

#

@coarse finch

#

i can help you test

coarse finch
#

oh i found someone but thanks

glossy venture
#

ok

echo basalt
#

they should but can't guarantee

#

just use getHelmet, getWhatever

#

or getArmorContents

#

0 is boots, 1 is leggings

wet breach
#

for the most part yes, however there could be a time

#

where mojang decides to add more

restive tangle
#

Isn't it 5, 6, 7,8??

#
for (i in 5 until 9) {
                    lateinit var key : String
                    when (i) {
                        5 -> key = "HELMET"
                        6 -> key = "CHESTPLATE"
                        7 -> key = "LEGGINGS"
                        8 -> key = "BOOTS"
                    }
                    inventory.contents[i] = ItemStack(gearMap.keys.filter { material -> material.name.contains(key) }.shuffled().first())
                }
echo basalt
#

depends

#

sometimes it's like 101, 102

#

but generally it's

int headSlot = 39;
int chestSlot = 38;
int legsSlot = 37;
int feetSlot = 36;
restive tangle
#

I'm not a fan of copy pasting the same code

echo basalt
#

ยฏ_(ใƒ„)_/ยฏ

#

I code in java, you enjoy your kotlin

restive tangle
#

I code in Java too, still doesn't change if I like copy pasting code lmao

echo basalt
#

you do you

#

change those ints to bytes

restive tangle
echo basalt
restive tangle
#

Oh, that's no good

simple silo
#

Caused by: java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerPlayer org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer.getHandle()'
any idea why this occurs?

hasty prawn
#

Is your server running 1.18.2

simple silo
#

yes

#

I never used NMS before so maybe I forgot something?

hasty prawn
#

Could you send the entire error

#

?paste

undone axleBOT
simple silo
hasty prawn
#

What is VaroCommand line 19

simple silo
#

ServerPlayerConnection playerConnection = player.getHandle().connection;

hasty prawn
#

Are you using the remapped jar as the dependency?

#

That error looks weird lol

chrome beacon
#

Are you using maven?

hasty prawn
#

^

simple silo
chrome beacon
#

Paper userdev plugin?

hasty prawn
#

If you're using mojang maps you need to make sure you're converting the JAR back to Spigots maps when you compile

simple silo
#
repositories {
    mavenCentral()
    maven {
        name = 'spigotmc-repo'
        url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
    }
    maven {
        name = 'sonatype'
        url = 'https://oss.sonatype.org/content/groups/public/'
    }
    mavenLocal()
}

dependencies {
    compileOnly 'org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:remapped-mojang'
}
glossy venture
#

bro my windows 10 game bar thing is frozen

#

bruh

chrome beacon
simple silo
eternal night
#

It is a gradle plugin

simple silo
#

oh

#

where can I get it?

eternal night
#

That's the example repo on how to use it

#

Note tho, if you are running a spigot server and not a paper server, ensure you only use methods and classes available on spigot

simple silo
#

Could not find method maven() for arguments [https://papermc.io/repo/repository/maven-public/] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

eternal night
#

oh

#

you are on groovy

#

you will have to convert the example into groovy

simple silo
#

Cause: paperweight requires a development bundle to be added to the 'paperweightDevelopmentBundle' configuration, as well as a repository to resolve it from in order to function. Use the paperweightDevBundle extension function to do this easily.

eternal night
#

Yea see the comments in the example for groovy usage

simple silo
#

I think I should learn more about Gradle, I never really learned it

eternal night
#

If you want to use it, yea it is a fun rabbit hole to dive into

glossy venture
eternal night
#

gg

simple silo
#

its doing it for a long time without errors so thats good I think lol

glossy venture
#

yeah

#

i had it take like 7 minutes

simple silo
#

Could not get unknown property 'Charsets' for task ':compileJava' of type org.gradle.api.tasks.compile.JavaCompile.

quiet ice
#

gradle can be annoying from time to time

hasty prawn
#

Gradle is a pain in the ass to setup but it's a godsend when it works

simple silo
#

I got it, I commented out the things which didnt work and it worked lmao

weary prawn
#

I'm trying to change the default chunk generator to one that just makes a void world just to learn, shouldn't this be working?
1.18.2

glossy venture
#

you need to define the generator in bukkit.yml i think

#

like

# ...
worlds:
  name:
    generator: YourPlugin
#

or use multiverse

weary prawn
#

is there any where I can see it documented?

hasty prawn
weary prawn
#

I appreciate it, hope I can get this working ๐Ÿ˜„

zealous osprey
#

Could someone enlighten me ?
I'm trying to get the instance of the sign from a block location, which I used to do via #getState() and then casting, but that doesnt work anymore aparently

glossy venture
#

what do you mean by "doesnt work"

#

is there a runtime error?

#

like a ClassCastException

zealous osprey
#

oh yeah should have clarified, indeed it's a ClassCastException

simple silo
#
[15:09:01 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH  - git-Paper-220 (MC: 1.18.2) ---
[15:09:01 ERROR]: The server has not responded for 45 seconds! Creating thread dump
[15:09:01 ERROR]: ------------------------------

is this normal when creating worlds?

chrome beacon
#

No

simple silo
#

oh

#

what can I do about it?

chrome beacon
#

Ask Paper and provide full log

chrome beacon
zealous osprey
#

I did, it's the block version not the material enum

mighty pier
#

how do i extinguish the player?

#

like player is on fire

#

delete fire

chrome beacon
chrome beacon
mighty pier
#

yes found it but thank

zealous osprey
worldly ingot
glossy venture
#

just a cross

worldly ingot
#

It looks like you're playing with a controller lol

glossy venture
#

idk i hated it at first but i wanted to use it for bw

#

and now im usedto it

#

i can aim better now

#

like in guis

worldly ingot
#

Weird

#

but whatever works for you. Was just strange lol

glossy venture
#

lmao

mighty pier
#

how do i set player's yaw?

chrome beacon
#

Set the players location

#

It contains yaw

mighty pier
#

yes but idk how

chrome beacon
#

Yes

chrome beacon
raw sky
chrome beacon
#

Just guessing since those images aren't loading for me

raw sky
chrome beacon
#

?paste

undone axleBOT
raw sky
#

oh yea thats weird

grim ice
#

or make your own website

#

for pasting

raw sky
#

ok imma post to imgur rq

chrome beacon
#

Paste the text in a paste site

#

Don't send images

raw sky
#

its not just code

#

its file explorer and stuff

raw sky
#

is that better?

#

ill get a better solution later

eternal oxide
#

run buildtools

raw sky
#

I have

#

look at the middle image

#

actualy I think Ive ran it more than that hold on

chrome beacon
#

Open 1.16.4 folder

#

And send contents

#

Also did you reload the project so it uses the latest pom

raw sky
raw sky
chrome beacon
#

Alright try

File > Invalidate Cache

red sedge
#

hey

chrome beacon
#

Hello

red sedge
#

so um, im using json to store player data, the data will be updated as long as the player is online

#

should i close the handle when im done writing the information or just close it when the player leaves

kind hatch
#

You should be caching that information and writing it at both a regular interval and when the player leaves.

chrome beacon
#

Read on join. Save on quit and maybe an autosave once in a while. No need to keep the file reference

raw sky
red sedge
raw sky
#

did that image load btw?

kind hatch
#

yes it loaded.

raw sky
#

ok good

chrome beacon
kind hatch
# red sedge huh, so should i have like an object to store the player data a variables?

Implementation would be up to you, but the idea behind what I suggested has two benefits. One, It is more efficient as write operations can be expensive/taxing for the CPU. Second, you are preserving as much recent data as possible by autosaving a cache every so often. It's just a precaution as if the server crashes, and you only save data on shutdown, then every bit of data that was going to be saved has now been lost.

raw sky
red sedge
kind hatch
red sedge
#

also wouldnt saving all player data at once lag the server?

kind hatch
#

It might. Really depends on your setup, but there are ways you can split tasks up.

red sedge
#

How?

kind hatch
#

Well, it would only start to lag if the amount of players is extremely large OR the amount of data that needs to be saved is extremely large.

#

But, it would be momentary.

red sedge
kind hatch
#

That being said, you would obviously mitigate that by only loading players that are online.

chrome beacon
#

Also writing to a file can be done async

kind hatch
#

^

chrome beacon
#

So no need to block the server when saving

red sedge
#

okay

kind hatch
#

Keep in mind that JSON files are small. So if each player only takes up about a kilobyte of disk space, and you have 10K players online. You likely wouldn't even see a large drop in performance as you are only writing 10MB worth of information to disk. Even if you did that all at once.

dull whale
#

how can I make my client entity dismount a boat

red sedge
#

just the online ones

kind hatch
#

True, and you should be doing it that way. I'm just pointing out that even if you had the entire database, it probably wouldn't be that bad. (Ofc it the amount of data is larger, then it might be worse.)

red sedge
#

and if i have 10k players online, writing files isnt my biggest issue

kind hatch
#

Yea. You'd likely be switching to another storage medium at that point.

red sedge
eternal night
#

I mean, if you can, SQL or generally a DB is probably best

#

their indexing capabilities beat plain json files per user in a lot of areas

red sedge
#

but would it really change so much

eternal night
#

I mean, idk what data you store

#

but any form of "best" or "worse"

#

is pain with json

kind hatch
#

It likely would. Although you wouldn't see a whole lot of it on a small scale.

red sedge
#

idk, player health, speed etc

kind hatch
#

I can tell you with certainty that it would help in some areas. Take YAML for example. The data within can be a number of things. Strings, Integers, Lists, etc. However, the file is saved and read as a String. Completely negating any benefit that would be gained by reading the data as it's actual type. You would't have that issue with a MySQL database, as it's designed to be compact.

red sedge
#

Okay

#

I think I can switch to MySQL if I need to later on right?

#

How hard would that be

kind hatch
#

Depends on your codebase. I mentioned earlier that I use an interface for my storage solutions. Meaning that the end user can choose between YAML, MySQL, and whatever else I made available. If you are hard coding everything to work with JSON, then you will have to refactor your entire project to switch it over to MySQL.

red sedge
#

there is a way to hardcore everything?

kind hatch
#

That being said. I recommend that you don't just switch it over completely, as you will be in the same boat when you want to switch to something else.

red sedge
#

cant i just... switch the reading/writing methods

last ledge
kind hatch
# red sedge cant i just... switch the reading/writing methods

This is why I prefer using interfaces for things like this.

If you have a method called createPlayer() and you are using JSON. That method is obviously going to contain code for saving JSON. So now, you need to call that method every time you want to create a player.

What if you want to use MySQL instead? You now have to rewrite the createPlayer() method with code that works with MySQL. Consequently, you now lost all of the JSON code that you wrote.

So what if you could easily switch between them? In comes the interface.

You will still have the method createPlayer(), but this time, depending on a setting, it can switch between the JSON code you wrote, and the MySQL code you wrote.

simple silo
#

Can I somehow change the name of the player above their head?

red sedge
#

and then switch them according to the type?

slim kernel
worldly ingot
late sonnet
worldly ingot
kind hatch
#

Kinda.
It would look more like this.

public interface DataManager {
  void createPlayer(UUID uuid);
}
Player player = //however you get the player.
DataManager dataManager = new ImplemntationOfDataManager();
dataManager.createPlayer(player.getUniqueId())

Now, the ImplementationOfDataManagerClass would look something like this:

public class YAMLDataManager implements DataManager {
  @Override
  public void createPlayer(UUID uuid) {
  // Your code for creating the player  
  }
}

In this example, I'm using YAML, but it can be for whatever you need.

Then the code above would turn into this.
DataManager dataManager = new YAMLDataManager();

#

@red sedge

kind hatch
#

That way, you can do things like this.

DataManager yaml = new YamlDataManager();
DataManager mysql = new MySQLDataManager();
DataManager h2 = new H2DataManager();

Interfaces like this are really flexible.

worldly ingot
#

Gave the option of JSON, SQLite, and MySQL

kind hatch
last ledge
mighty pier
#

where does p.hasPlayedBefore() get the data from?

last ledge
kind hatch
kind hatch
mighty pier
#

k

kind hatch
tardy delta
#

i manually deleted the world every time to check my database implementation of hasPlayedBefore ๐Ÿคฃ

mighty pier
#

how do i check if PlayerData.get().get("Players." + p.getUniqueId() + ".firstjoin")); exists?

mighty pier
#

i already have a server that people played before

#

they wont have firstjoin

kind hatch
#

Then do you have another plugin that was keeping track of first joins?

mighty pier
#

no

kind hatch
#

Then you aren't going to be able to get the first join date of players who have already joined.

zealous osprey
#

go through the server logs and add them manually ?
Well rather automate the finding of them, but still

slim kernel
kind hatch
#

That information isn't something that's logged. There is a method called #getLastPlayed() which will return a timestamp, but it updates every time the player joins and leaves.

#

If you want to keep track of join dates, you have to do it at the very beginning of the server.

worldly ingot
#

It's blockOccupied() that's causing issues, placePlotOnNextAvailable() is just calling it

#

Line 42 in particular, if you could highlight it

#

Whatever it is that's on that line is taking a hell of a long time

#

With that being said, I've a feeling that a for loop almost certainly isn't the most effective way to go about finding an available plot. There's likely a mathematical way you can go about calculating it and doing an O(1) operation instead

glossy venture
#

does CraftItemEvent get called when you take the result item, even when the recipe is not 'valid'

#

like i dont have the recipe registered

#

because its for custom items

#

its a custom crafting system

worldly ingot
#

It should be called when the item is taken out of a crafting table. I don't think it has to be a registered recipe

glossy venture
#

it doesnt seem to be called tho

#

the listener is at the bottom in the code above

last ledge
# kind hatch Have you verified that? Print out the contents of the map to double check.
        for (String blockName : plugin.getConfig().getConfigurationSection("Blocks").getKeys(false)) {
            for (String blockNameProperties : plugin.getConfig().getConfigurationSection("Blocks." + blockName).getKeys(false)) {
                List<Integer> percentages = new ArrayList<>();
                List<String> commands = new ArrayList<>();
                percentages.add(plugin.getConfig().getInt("Blocks." + blockName + "." + blockNameProperties + ".percentages"));
                commands.addAll(plugin.getConfig().getStringList("Blocks." + blockName + "." + blockNameProperties + ".commands"));
                materialBlocks.put(Material.matchMaterial(blockName), new BlockProperties(percentages, commands));
                ```System.out.println(blockName);```
            }
        }```
#

Do i print like this?

kind hatch
glossy venture
#

?jd

glossy venture
#

ignore this

glossy venture
#

i guess ill try it with an InventoryClickEvent

simple silo
#

what does this mean, I changed the player name with NMS and now I have this problem

kind hatch
#

Don't ever change the player's name with NMS. Modifying the player object as a whole can screw up everything.

chrome beacon
#

Make the name shorter

kind hatch
#

I'm pretty sure there is a method available to change the player's displayname above their head.

simple silo
#

Can I somehow reset the custom names in the server?

kind hatch
#

I'm pretty sure there is, as plugins are able to add things like prefixes and suffixes to player's names just fine. Granted that might be done with Scoreboard teams, but it should be possible without having to delve into nms.

simple silo
#

will resetting playerdata do it?

sonic briar
#

hello

#

no english

kind hatch
#

You could likely just restart the server.

sonic briar
#

ฤฑ am turkish

simple silo
#

the playerdata which is in world

simple silo
kind hatch
#

Then yea, you might want to delete that. Make sure you are out of the world first.

simple silo
#

aight, playerdata delete helped

#

alright, how do I change the name above head without breaking everything?

simple silo
#
Searched in the following locations:
    https://repo.dmulloy2.net/repository/public/org/spigotmc/spigot/1.18.2-R0.1-SNAPSHOT/spigot-1.18.2-R0.1-20220228.182956-1-remapped-mojang.jar``` why did this just stopped working?
golden turret
#

getting a chunk dont necessarily load it, right?

kind hatch
#

Correct. You need to call #load() in order for it to load.

#

You can also check if it is already loaded with #isLoaded()

mighty pier
#

how do i run code every 1 second while the server is online?

golden turret
#

?scheduling

undone axleBOT
eternal night
#

get chunk iirc always performs a chunk load

kind hatch
#

Well, there are two methods. There is #getChunk(), but there is also #getLoadedChunks().

eternal night
#

on what object/class do we talk about getChunk

#

The world's getLoadedChunks obviously does not load any new chunks, but any getChunk method on the world will load the chunk if it isn't loaded rn

#

which also affects Location#getChunk and Block#getChunk respectively

sage merlin
#

how to use the ChatColor.translateAlternateColorCodes

eternal night
#
final String sectionSignChatMessage = ChatColor.translateAlternateColorCodes('&', "&6This is in gold, but with an &");
sage merlin
#

ive seen some people do it with a method?

eternal night
#

?

#

obviously you may wrap this in a method

cyan compass
#

I keep getting "this.missile_manager" is null and it's odd cause i do the exact same code in a different class and it isn't null and my IDE doesn't say anything about it

sage merlin
#

so what does the &6 do?

cyan compass
#

It makes it gold

eternal night
#

Legacy colour codes are like ยง6 for gold for example

#

but because people may not want to use the section sign for everything you can "translate" their ampersand usage to section signs

torn vale
#
public class onBlockPlaceEvent implements Listener {

    @EventHandler
    public void onBlockPlace(BlockPlaceEvent e) throws InterruptedException {
        Block blockPos = e.getBlock();
        TimeUnit.SECONDS.sleep((long) 1.5F);
        blockPos.setType(Material.AIR);
    }
}```
I want to break a block 1,5secs after it got placed. With this code it breaks only one block at the time...
eternal night
#

don't block the main thread

#

?scheduling

undone axleBOT
eternal night
#

see how to schedule actions on the server

sage merlin
#

dont use TimeUnit please

#

for spigot

eternal night
#

your method is blocking the entire minecraft server for 1.5 seconds

sage merlin
#

or Thread.sleep()

kind hatch
#

Also, don't use #sleep() on the main thread. >.<

torn vale
#

oh

sage merlin
eternal night
#

is mavenLocal() in your repo list

torn vale
#

๐Ÿ‘

eternal night
#

if you are on gradle

simple silo
eternal night
#

is that the entire stack trace ?

#

else move the mavenLocal()up

#

idk if the dully repo is fucking something up

#

but gradle processes these in order of declaration so that could solve it

simple silo
torn vale
eternal night
#

Generally what I find useful is to define which artifacts to pull from repos

#

saves you from this

ancient plank
#

?scheduling

undone axleBOT
eternal night
#

๐Ÿค” didn't I already link that

sage merlin
#

new BukkitRunnable( pubic void run() {}).runTakeLater(plugin, time);

eternal night
#

or just use the java 8+ lambda style

torn vale
eternal night
#

on the BukkitScheduler

#

๐Ÿ‘€

#

the "basically never use Thread.sleep" part was ignored

simple silo
#

How do I use packets?

eternal night
#

don't sleep in your logic, define a proper delay when scheduling the runnable

sage merlin
wet breach
sage merlin
#

just put the code you wanna delay within the runnable

simple silo
eternal night
#

This is mojang mappings

#

not spigot mappings

simple silo
eternal night
#

for "translations" between spigot and mojang mappings

wet breach
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

eternal night
#

Your PacketPlayOutPlayerInfo is ClientboundPlayerInfoPacket in pretty mojang mappings

simple silo
#

oh ok

torn vale
eternal night
#

the instance of your main class yes

wet breach
#

no

#

Well if you are referring to an example code piece probably

simple silo
#

I've read I somehow can change the name above head with PacketPlayOutPlayerInfo, anyone have an idea how?

torn vale
# eternal night the instance of your main class yes
    @EventHandler
    public void onBlockPlace(BlockPlaceEvent e) {

        BukkitRunnable runnable = new BukkitRunnable() {
            @Override
            public void run() {
                Block blockPos = e.getBlock();
                blockPos.setType(Material.AIR);

            }
        }.runTaskLater(BuildFFA.getPlugin(), 1500);
    }```
eternal night
#

runTaskLater returns you a BukkitTask

wet breach
eternal night
#

which is kind of like "the running BukkitRunnable`

simple silo
eternal night
#

The general nick process iirc is: Destroy player entity, send player info with remove of their game profile, send player info with addition of the changed name game profile, spawn in their entity to players"

torn vale
#

but

#

im so confused

wet breach
#

what LynxPlay said ๐Ÿ™‚

eternal night
#

Well either change the type of the runnable var

#

or cal runTaskLateron runnable instead of the just created bukkit runnable

sage merlin
eternal night
#

depends on what you need

sage merlin
#

so you can think of it as a clock pulse

simple silo
kind hatch
# torn vale im so confused

I'd recommend using the static method for scheduling if you need something quick.
Bukkit#getScheduler()#runTaskLater()

eternal night
#

First yeet the entity with ClientboundRemoveEntitiesPacket

torn vale
#
    @EventHandler
    public void onBlockPlace(BlockPlaceEvent e) {
        BukkitTask runnable = new BukkitRunnable() {
            @Override
            public void run() {
                Block blockPos = e.getBlock();
                blockPos.setType(Material.AIR);

            }
        }.runTaskLater(BuildFFA.getPlugin(), 1500);
    }```
(still does not break the block 1,5secs after placing)
eternal night
#

then REMOVE_PLAYER

#

1500 is the ticks

#

not millis

torn vale
#

oh

eternal night
#

1.5 seconds are 30 ticks

torn vale
#

yea

#

my bad

#

works now, tysm!

simple silo
#

just send the packets to all online players yes?

eternal night
#

all but the one nicking

#

Well you can send them the REMOVE and ADD

#

just not the destroy and spawn packets

#

else their client is fucked

simple silo
#

oh

#
ClientboundRemoveEntitiesPacket packet0 = new ClientboundRemoveEntitiesPacket();
ClientboundPlayerInfoPacket packet1 = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, player.getHandle());``` first one send to everyone yeah, what about second one?
eternal night
#

first one to all but the player you are renaming

#

second one to all

#

also first one needs the player's entity id

simple silo
#

how do I get it?

eternal night
#

the handle should have a getId method ?

simple silo
#

yes

#

alright

#

what next?

eternal night
#

Well next, info packet but with the changed game profile

#

and ADD

#

which is tricky

#

because there is no constructor for it

simple silo
#

what Info packet?

eternal night
#

ClientboundPlayerInfoPacket ?

simple silo
#

oh this one

#

Action.ADD_PLAYER

eternal night
#

ye

#

but it is tricky

#

because that packet contains basiclly the game profile with the changed name

simple silo
#

oh

eternal night
#

Player.gameProfile is public tho

simple silo
#

should I just do a new Player.gameProfile?

#

the last time I changed the name in gameProfile i fked up my server lol

eternal night
#

so basically:

var oldGameProfile = playerHandle.gameProfile
playerHandle.gameProfile = newGameProfileWithDifferentName;
ClientboundPlayerInfoPacket packet = new ClientboundPlayerInfoPacket(ADD, playerHandle)
playerHandle.gameProfile = oldGameProfile
simple silo
#

alright

#

ty

#

Player.gameProfile is private

eternal night
#

it is ?

simple silo
#

so do with reflection?

eternal night
#

oh

simple silo
eternal night
#

lol spigot

#

Well yea but reflection is painful

simple silo
#

alright, at least I know how to do reflection lol

eternal night
#

because the field is not going to be named "gameProfile"

#

at runtime

#

or well, might not

#

Yea, it is called cs in 1.18.2

simple silo
#

ok

#
            Field gameProfileField = player.getHandle().getClass().getField("cs");
            gameProfileField.setAccessible(true);
            GameProfile oldProfile = (GameProfile) gameProfileField.get(player.getHandle());
            GameProfile newProfile = new GameProfile(player.getUniqueId(), name);
            gameProfileField.set(player.getHandle(), newProfile);
            ClientboundPlayerInfoPacket packet3 = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, player.getHandle());
            gameProfileField.set(oldProfile, player.getHandle());
#

will this work @eternal night ?

torn vale
#

I want to give the player items after he died, how can I do this? This is my current code:

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e) {
        e.setKeepInventory(true);
        for (ItemStack item : e.getEntity().getInventory().getContents()) {
            if (item == null) return;
            item.setDurability((short) 0);
        }
        for (ItemStack armor : e.getEntity().getInventory().getArmorContents()) {
            if (armor == null) return;
            armor.setDurability((short) 0);
        }
        Player p = e.getEntity().getPlayer();
        ItemStack blocks = new ItemStack(Material.SANDSTONE, 64);
        ItemStack pearl = new ItemStack(Material.ENDER_PEARL, 1);
        p.getInventory().setItem(8, pearl);
        p.getInventory().setItem(2, blocks);
        p.getInventory().setItem(3, blocks);
    }```
simple silo
#

PlayerRespawnEvent @torn vale

torn vale
#

ty

eternal night
#

I think the class is wrong

#

player will be a ServerPlayer

#

while the cs field is defined on the Player class

#

I don't recall if you can access parent fields that way

#

also getDeclaredField

glossy venture
#

you can get the player from the server player i think

#

i believe player is the entity (?)

eternal night
#

concerning that Player is an abstract class

simple silo
#

ServerPlayer has a gameProfile field

eternal night
#

it does ๐Ÿค”

#

are you sure the field is defined in the ServerPlayerclass

#

pretty certain it lives in its parent class

simple silo
#

oh no, it is in Player

eternal night
#

Yea so just getClass().getSuperclass()

#

and then getDeclaredField

simple silo
glossy venture
#

wouldnt you just do getField

eternal night
#

oh

#

yes

#

right

#

you can just directly ref Player

#

mb

simple silo
#

ignore it?

eternal night
#

yes

simple silo
#

aight

glossy venture
#

yeah is from mappings

eternal night
#

intellij does not know you will run on re reobf server

#

also your last set call needs permuted args

#

old game profile is the value not the instance

simple silo
#

oh i see

#

and now, I need a SpawnEntity packet?

eternal night
#

Yea there is a PlayerAdd packet

#

ClientboundAddPlayer

#

and just throw the player in there

simple silo
#

alright

#

and now, how do I send them? lol

glossy venture
#

get the player connection its public

#

and send the packet

#

gou have to do this for everyone on the server and new players i think

eternal night
#

^^

#

especially the "freshly joined players" part

simple silo
#

the ClientboundRemoveEntitiesPacket should get sent to everyone right?

glossy venture
#

both should be sent to everyone

#

also the add

eternal night
#

no

#

remove entities and add player to everyone but the player in question

#

if you send a client a remove entities packet with their own entity id, you will have some fun times

simple silo
#

i guess i dont want to know what happens

#
for (Player p : Bukkit.getOnlinePlayers()) {
                if (p.getUniqueId() != player.getUniqueId())
                    ((CraftPlayer) p).getHandle().connection.send(packet0); // ClientboundRemoveEntitiesPacket
                ((CraftPlayer) p).getHandle().connection.send(packet1); // ClientboundPlayerInfoPacket REMOVE_PLAYER
                ((CraftPlayer) p).getHandle().connection.send(packet2); // ClientboundPlayerInfoPacket ADD_PLAYER
                if (p.getUniqueId() != player.getUniqueId())
                    ((CraftPlayer) p).getHandle().connection.send(packet3); // ClientboundAddPlayerPacket
            }
eternal night
#

could work

simple silo
#

alright, let's see

eternal night
#

last I tried it, I had to do some delay between the packets

simple silo
#

how do I do it without suspending the server?

eternal night
#

bukkit runnables

#

but first give this a try

#

it should work

simple silo
#

ok

eternal night
#

paper does it pretty much the same way without delays either

#

so

simple silo
opal juniper
#

;/

#

on what class?

#

is that the bukkit player

simple silo
#

i think it was the mistake that it was the bukkit player

eternal night
#

your name seems too long

simple silo
#

shouldn't it work with names which are longer than 16?

chrome beacon
#

No

simple silo
#

i saw names with over 50 characters on other servers

chrome beacon
#

That's prefix and suffix

simple silo
#

also without prefix and suffix

chrome beacon
#

Not possible

eternal night
#

^

simple silo
#

the name was completely different

eternal night
#

minecraft client simply does not handle that

#

that is resource packs and fonts

#

but still a prefix and suffix

simple silo
#

so how do i do it?

chrome beacon
#

Prefix and suffix

simple silo
#

yes

#

how?

eternal night
#

teams

#

on scoreboards

simple silo
#

wasn't it limited to a maximum number of teams?

eternal night
#

no

simple silo
#

oh

#

how do I do it?

eternal night
#

google

chrome beacon
#

A player can only be in one team though. Keep that in mind

eternal night
#

^ you basically do a per-player team

simple silo
#

if I can dynamically create teams it shouldn't be a problem

eternal night
#

you can

#

just, obviously means you are working with scoreboards

#

which, plugins like to fuck with

chrome beacon
#

I have the code for this actually. Sadly I'm not home atm

simple silo
#

so should I use a random name for team name?

chrome beacon
#

If you want

sick ermine
#

I don't want to put an ItemStack field inside the ItemBuilder class. but I need itemstack in setTexture method. What do you recommend? should i put ItemStack field inside the class

simple silo
chrome beacon
#

Yes

eternal night
#

why use a random uuid

#

if you have the player uuid

#

:5head:

chrome beacon
#

Was about to say

simple silo
#

good idea

#

by this way i can even modify it later

chrome beacon
simple silo
#

how do I put a player in the team?

eternal night
simple silo
#

java.lang.IllegalArgumentException: Team name '6ab0e034-3296-4654-a6c2-12996dba537b' is already in use
this is a problem now

chrome beacon
#

Don't create it if it already exists

eternal night
#

^ pretty straight forward

simple silo
#

nice, it works

#

thanks

#

I also saw on other servers that players have multiple name lines

#

How is this possible?

mighty pier
#
        if (logger.getLastDamageCause().getEntity() instanceof Player) {
            Player a = (Player) logger.getLastDamageCause().getEntity();
            sender.sendMessage("attacker: " + a.getName() + ", combat logger: " + logger);``` why it do that?
#

no i meant

#

it just returns the same player

#

i hit meowcatto

#

and i did the command

#

logger.getLastDamageCause().getEntity() doesnt work

eternal night
#

getEntity() returns you the entity that was damaged

#

which is logger

mighty pier
#

oh

#

how do i get the player that damaged logger?

eternal night
#

for that, there is just getKiller()

mighty pier
#

oh

eternal night
#

or you instanceOf check the event against EntityDamagedByEntityEvent

#

pick your poison

mighty pier
#

i cant do getkiller

#

cuz its a commnad

eternal night
#

๐Ÿค” well do the event thing

worldly ingot
#
logger = // whatever
if (logger.getLastDamageCause() instanceof EntityDamageByEntityEvent event) {
    event.getDamager(); // This is who damaged the player. Do with this what you will
}```
mighty pier
#

yes i did the same thing

knotty gale
#

hey so I have a plugin that starts a countdown in actionbar and I am trying to find a way to cancel it using args

#

there are no errors in my code and the error message when you dont use an arg sneds

#

but ntohing happens

tardy delta
#

Paste code

knotty gale
#

alr

#
public int PlayClock;
     public int i = 25;
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
        if(cmd.getName().equalsIgnoreCase("Pc")) {
            Player player1 = (Player) sender;
            if(!player1.isOp()) return false;
            if(args.length == 0) {
                player1.sendMessage(ChatColor.RED + "Incorrect usage. You must use an argument!");
            }
            else {
                String word = args[0];
                if(word == "start") {
            PlayClock = this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
                public void run() {
                    if(i!=-1) {
                        if(i!=0) {
                             for (Player players : Bukkit.getOnlinePlayers())
                             {
                                 players.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.GOLD + "PlayClock: " + (i)));
                                 players.playSound(players.getLocation(), Sound.BLOCK_NOTE_BLOCK_BIT, 1, 0);
                             }
                            i--;
                        }else {
                            getServer().getScheduler().cancelTask(PlayClock);
                            for (Player players1 : Bukkit.getOnlinePlayers())
                            {
                             players1.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.RED + "PlayClock " + ChatColor.BOLD + "EXPIRED"));
                            }
                             i--;
                        }
                    }
                }
            }, 0L, 20L );
            i = 25;
        }
                else if(word == "stop") {
                        Player player = (Player) sender;
                        if(!player.isOp()) return false;
                        else {
                            getServer().getScheduler().cancelTask(PlayClock);
                        i = 25;
                         for (Player players1 : Bukkit.getOnlinePlayers())
                         {
                             players1.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.RED + "PlayClock " + ChatColor.BOLD + "CANCELLED"));
                             players1.playSound(players1.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 1);
                             
                         }
                        
                    }
                    
                }
        return false;
    }
        return false;
}
        return false;
}
}
eternal night
#

please use a pastebin

#

?paste

undone axleBOT
eternal night
#

also, try to reformat your code

#

this is horrible to look at

#

every modern IDE has an option to automatically do so

#

strings are also not compared using == but rather with .equals

visual tide
#

*if it was fine in the first place

eternal night
#

yeaa I doubt this is fine in the first place

patent horizon
#

could someone help me with 1.18.2 nms?

#

i have buildtools and everything, im just not sure what to put in the build.gradle

eternal night
#

maybe @simple silo can help you ? idk if they ended up using paperweight userdev

#

but spigot generally does not have gradle tooling

quaint mantle
#

Where can I see how to do an event when an item is added to a players inventory from an NPC/Shop (non-dropped/direct to inv)

patent horizon
#

might be on close

eternal night
#

pretty much depends on the shop plugin

#

if it is decent, it should have an API to hook into

patent horizon
#

RedLib has that feature

eternal night
#

the server will not publish an event for plugins modifying your inventory through the API

patent horizon
eternal night
#

Yes but that is for guis made through redlib

quaint mantle
#

Hmmm ok, I'll have to look into RedLib

eternal night
#

is the shop plugin using redlib ?

opal juniper
#

Maybe just make it yourself o.O

eternal night
#

if it isn't, redlib has nothing to do with this

patent horizon
#

oh

#

i thought the question was just how to get that feature

eternal night
#

I understood that they have some shop plugin and want to listen to when a player grabs an item from said shop ยฏ_(ใƒ„)_/ยฏ

#

idk

patent horizon
#

shouldnt minecraft have a feature for that already?

#

since crafting tables do that

eternal night
#

The crafting table has its own logic to trigger events related to it

quaint mantle
#

Well, I use DTLTraders (which as far as I can tell doesnt have an API/or isnt listed)

eternal night
#

might want to ask in their discord

#

but generally, you are pretty out of luck when other plugins modify state through API

quaint mantle
#

already on that

eternal night
#

those usually do not trigger events

strange elk
#

is there a way to fake sent a command by a player but the command is send using code serverside?

echo basalt
#

Bukkit.performCommand(player, command) or something

patent horizon
#
    @EventHandler
    private void portalEnter(PlayerPortalEvent event) {
        ProtectedRegion cavernPortal = WorldGuard.getInstance().getPlatform().getRegionContainer().get(new BukkitWorld(Bukkit.getWorld("ul_plex"))).getRegion("cavern_portal");
        ProtectedRegion lagoonPortal = WorldGuard.getInstance().getPlatform().getRegionContainer().get(new BukkitWorld(Bukkit.getWorld("ul_plex"))).getRegion("fishing_portal");
        Location player = event.getPlayer().getLocation();

        assert cavernPortal != null;
        if (cavernPortal.contains((int) player.getX(), (int) player.getY(), (int) player.getZ())) {
            Location loc = new Location(Bukkit.getWorld("ul_plex"), -96.5, 119, -9.5, 180, 0);
            event.setCancelled(true);
            event.getPlayer().teleport(loc);
            event.getPlayer().getWorld().spawnParticle(Particle.PORTAL, loc, 25);
        }
    }``` why isnt this teleporting me when i step into the portal in the region?
strange elk
knotty gale
#

does anyone know how to make a plugin that would let you map out an area and if a arrow would hit there it would make something happen?

#

maybe like a message

cyan compass
#

Are there any good countdown tutorials that aren't outdated? I can't find any great ones

small lynx
stuck flax
#

I'm making a nickname plugin for my bungeecord network that writes to a MySQL database. What would be the best way to fetch from the database without making a million requests each time the player sends a message or should I just do async database requests?

small lynx
#

Just cache once and not more

small lynx
past drum
#

How would I play the Guardian Effect when you get like mining fatigue to a player? I think this would be done using packets but how exactly would you go about this

small lynx
#

Like this

past drum
#

Well isn't the effect a packet?

small lynx
#

Just instaciate the world in a variable

#

And play the effect

past drum
#

So it's that simple just an effect

#

ty

echo basalt
#

player.playEffect(EntityEffect.GUARDIAN_TARGET);

small lynx
#

^

maiden thicket
echo basalt
#

yeah that

#

whatever

maiden thicket
#

banned from commissions because u did not know what it was

#

ez

echo basalt
#

bruhh

vocal cloud
#

:Clap:

maiden thicket
#

illusions commissions were an illusion after all

vocal cloud
echo basalt
#

:(

maiden thicket
#

๐Ÿ˜”

echo basalt
#

taah go back to your cursed emotes

maiden thicket
echo basalt
#

no

maiden thicket
#

smh

echo basalt
#

you should earn enough for that

#

I use 5$ nitro myself

maiden thicket
#

earn from what

#

๐Ÿ’€

echo basalt
#

you don't got commissions?

maiden thicket
#

bro cade be making them when im offline ๐Ÿ’€๐Ÿ’€

#

also wrong chat for this but ye

echo basalt
#

๐Ÿ’€

#

cade waits for me to wake up

tender shard
#

what the heck is cade lol

#

sounds like a weird linux desktop environment

echo basalt
#

youtuber manager guy

tender shard
#

KDE, MATE, GNOME and CADE

maiden thicket
tender shard
#

still no idea what you're talking about

pliant oyster
#

anyone here good with packetevents?

echo basalt
#

cade is our middleman

tender shard
#

ok, got it

echo basalt
#

surprised ghast

vocal cloud
#

He's sneezing. We all know they're allergic to humans

echo basalt
#

man has been sneezing for the past hour

#

turns out that if you set a ghast's attack ticks to a value very close to the shoot tick, but not quite there

#

the ghast will just have its mouth open

vocal cloud
#

Wow you monster. Haven't you ever felt that sneeze that will never go away

echo basalt
#

yeah those suck

#

I wonder if we can make an audio engine within minecraft

#

by doing reverb and stupid stuff like that

#

and sending packets on a rate above 20 ticks per second

tender shard
#

why the heck do plugins think it's a good idea to "implement Player" instead of "implement HumanEntity" for NPCs?! Now I have to do weird stuff like this...

public class SentinelHook {

    public static boolean isNpc(Player player) {
        return player.getClass().getName().contains("NPC");
    }
    
}
#

a PLAYER is supposed to be a PLAYER, and NOT a NON-PLAYER-character

#

I mean it's called NON-player-character for a reason

echo basalt
#

player.hasMetadata("NPC")

#

sentinel runs on top of citizens

#

ยฏ_(ใƒ„)_/ยฏ

tender shard
#

that's still bullshit

#

a NonPlayerCharacter is not a Player and as such should not implement Player. Especially since that's exactly why the HumanEntity interface exists in the first place

#

they can implement HumanEntity as much as they want, but a NON player should not be a Player

#

hence the word NON player character

grim ice
#

kids who think npc is an actual word:

crisp steeple
#

one thing i dont get is why most of the inventory related events return a HumanEntity for their getPlayer methods instead of a player

#

can npcs click in inventories and stuff?

muted sand
tender shard
echo basalt
tender shard
#

so to allow plugins like Citizens to make NPCs behave "like" players, most inventory related stuff allows to use HumanEntity

crisp steeple
#

i mean

tender shard
crisp steeple
#

other events that citizens npcs can do return a player as well

tender shard
#

but anyway, Player isn't an interface in the first place that should be implemented, that's explained on the front page of the spigot api docs

#

plugins should be safe to assume that a player is always a player and that if a player is online, that "Bukkit.getPlayer" also returns the same object while that "player" is online

quaint mantle
#

hey so im trying to get a custom command working but it is saying value of main.getCommand is null even tho i have the plugin.yml setup correctly.

tender shard
quaint mantle
#

commands:
getprefixes:
description: get your prefixes
usage: /<getprefixes>
permission: yourplugin.yourcommandpermission

misty current
#

if I were to make an NPC api, how could I make NPCs reappear when they get out of render and then back in for a player?

quaint mantle
#
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "LilUtilities.Main.getCommand(String)" is null
        at LilUtilities.Main.onEnable(Main.java:11) ~[LilUtilities-1.1.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:501) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:559) ~[paper-1.18.2.jar:git-Paper-281]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:473) ~[paper-1.18.2.jar:git-Paper-281]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:664) ~[paper-1.18.2.jar:git-Paper-281]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:431) ~[paper-1.18.2.jar:git-Paper-281]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:316) ~[paper-1.18.2.jar:git-Paper-281]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-281]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-281]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
[00:08:29 INFO]: [LilUtilities] Disabling LilUtilities v1.1```
quaint mantle
#

this.getCommand("getprefixes").setExecutor(new GetPrefixs());

quaint mantle
tender shard
#

open your plugin .jar file with winrar/similar programs, then see if your plugin.yml ACTUALLY contains that command

tender shard
quaint mantle
#

its not in there

tender shard
#

then there's your problem

quaint mantle
#

ohh shit i just realized plugin.yml is not config.yml xDDD

#

i know where i went wrong ๐Ÿคฃ

tender shard
# misty current anyone?

I don't really get the question. when they're out of "render" distance, they "disappear" automatically, because that's what the render distance is for

misty current
#

imagine i spawn an npc and a player gets far

#

the client despawns the npc

tender shard
#

the client doesn't "despawn" it, it simply stops rendering it. the NPC should be still visible if you come back

misty current
#

but then when the player gets close again the npc is meant to reappear

#

i'm asking how should I detect that

tender shard
#

you actually don't have to worry about this at all. once you send a "my NPC is at 0|64|0" packet, and a player walks a thousand blocks, then comes back to 0|64|0, they'll still see the NPC

#

the client will remember that the NPC is at that place unless you tell it otherwise

misty current
#

ohh so it doesn't work like on other servers

#

so the client keeps track of every player's position?

#

even if they are not rendered

tender shard
#

I am not sure how it works with "official REAL players", but I am 99% sure that when I spawn NPCs, I simply send a "Player joined packet" or however it's called ONCE to all online players, and once again to every player who joins later, and that it always worked

#

for "real" players, the server will probably stop updating the position to far-away players, but you don't have to worry about that for your custom players, since you have to manually send packets for them anyway when they move

tranquil viper
#

does enchantment value start at 0 -> 1 or 1 -> 1

tender shard
#

just tell every player once "npc mfnalex is at 0|64|0 in world_nether now" and that should be enough

tranquil viper
#

meta.addEnchant(e , 2, true) - give 2 or 3

misty current
#

aight thanks

tender shard
misty current
#

what if I wanted to do something similar with other entities tho?

tranquil viper
tender shard
misty current
#

i remember i did something with armorstands but when i got far and back to where the stand was supposed to be it was gone

tender shard
#

okay for holograms I actually have a runnable, I am not sure whether it's needed or whether I only have that for custom "visiblity radius"