#help-development

1 messages Β· Page 1029 of 1

analog lantern
#

unless someone can tell me how to get the player ChannelPipeline using spigot mappings

grim hound
#

I have 3 ways:

#

Gimme a sec

analog lantern
#

yeah its easily possible to do this with protocol lib but surely we just use obfuscated methods because making server owners add 1 extra plugin is cringe :grubomg:

grim hound
#
  1. Going to the Channel location with reflection like this:
#
  1. Adding a server channel handler that waits for channelActive, intercepts the name packet and add it to a Map and then removes in PlayerJoinEvent
#
  1. Using PacketEvents
#

Not ProtocolLib

#

Cuz it's better

grim hound
#

But it should

analog lantern
grim hound
#

When you do "inject" it adds a packet handler

analog lantern
#

ok just gotta figure out how to properly use this-

grim hound
analog lantern
#

i have to initialize the interface no?

grim hound
grim hound
fair rock
#

Im waking up with a confusion. ThanksπŸ’€

analog lantern
#

it doesnt have a companion objectso it needs to be initialized in my class

#

wtf

prisma jolt
#

Does anyone have a possible fix?

analog lantern
#

yeah its having me initialize it in my class

ChannelInjector channelInjector = new ChannelInjector() {
            @Override
            public Channel getChannel(Player player) throws Exception {
                return null;
            }

            @Override
            public String getProvider() {
                return "";
            }
        };```
grim hound
#

In "nms_impl"

#

Implement this class

analog lantern
#

tf is OldNmsChannelGetter

#

oh do i need to add the other two?

fair rock
#

?paste

undone axleBOT
fair rock
#

Please

grim hound
analog lantern
#

and ReflectionUtils?

grim hound
analog lantern
#

im using 1.20.4

grim hound
grim hound
analog lantern
#

im only supporting 1.20.2+

grim hound
#

Then ye

analog lantern
#

so i only need newer?

grim hound
#

Add only the NewerNmsChannelGetter

prisma jolt
#

&#fe0505&lt&#fd0909e&#fc0e0es&#fb1313t&#fa1818i&#f91c1cn&#f82121g&#f62626t&#f52a2ah&#f42f2fe &#f33434i&#f23939t&#f13d3de&#f04242&lm&r

fair rock
#

Wanna print the next line too

prisma jolt
#

Sorry?

analog lantern
#

Use a minimessage ahhhhhhhhhhhhhhhhhhhhhhhhhh

prisma jolt
#

What?

blazing ocean
#

please just use minimessage at that point

#

that is beyond cursed

prisma jolt
#

lol

analog lantern
#

ok so 1 more question

#

nvm

astral pilot
#

how do you load an existing world from a given directory

blazing ocean
#

worldcreator

#

new WorldCreator(new NamespacedKey(plugin, "your world name")).createWorld()

#

no nvm

#

Bukkit.createWorld(worldCreator)

#

okay both work lol

blazing ocean
#

does only the directory exist

#

that sitll works then

astral pilot
blazing ocean
#

wdym the world exists

astral pilot
#

not only directory

#

like its a whole world file

blazing ocean
#

there's no "world file"

astral pilot
#

what i mean is

#

that world folder has its contents

#

like its already created it just only needs to be loaded

blazing ocean
#

yeah that is literally what i asked

#

that still works

astral pilot
blazing ocean
#

with the contents, not a registered server world

astral pilot
blazing ocean
astral pilot
#

i see thanks

quaint mantle
#

Does worldcreator copy the content of the original world? like the builds?

quaint mantle
#

Ah, what do I do if I want to copy the builds?

blazing ocean
#

it generates a new one if it can't find a world at the location of the name

quaint mantle
#

Do I stick to pasting schems?

blazing ocean
blazing ocean
quaint mantle
#

The uid dat is deleted and it does generate a new world

#

just that it does not copy the builds

blazing ocean
#

show your code

quaint mantle
#

1m

#

?paste

undone axleBOT
quaint mantle
blazing ocean
#

copy the dir

#

then load from the new dir name

quaint mantle
#

Why kt though

blazing ocean
#

because i use kotlin

#
    override val gameMap = GameMap(File(plugin.dataFolder, "maps/duel/$mapType"), identifier)
astral pilot
#

for me it ust shows a random file dir

split lichen
#

does anyone know of any protocol lib bugs/changes in spigot 1.20.6 that causes a field index 0 is out of bounds for length 0 for player info action?

#

back in 1.19.3 it used to be getPlayerInfoActions()

wide coyote
#

can I remove a specific path finding for a mob?

#

what I am trying to do is to disable villager ai but to keep the golem thingy

sleek estuary
#

how install nameless templates? someone know?

tender shard
young knoll
#

setAware might work

wide coyote
split lichen
wide coyote
#

you can do that too

#

way better than protocollib imo

split lichen
#

huh, noted, thanks for letting me know

#

I'll be sure to research it

pseudo hazel
#

you can send packets with packetevents too

#

using PacketEvents.getPlayerManager.sendServerPacket()

#

and then you just instantiate the wrapper class of your packet and put it into the function

dire marsh
#

why is this server suddenly obsessed with packetevents

split lichen
#

@wide coyote @pseudo hazel thank you both very much, you relieved me from an enormous protocol lib headache I've had for the past two days, works like a charm

split lichen
pseudo hazel
#

because its good

#

and I guess the person who made is frequently talking in this server, which probably helps

quaint mantle
#

[10:44:36 INFO]: [ItemsAdder] Enabling ItemsAdder v4.0.1-alpha-test-3
[10:44:36 ERROR]: [ItemsAdder] ════════════════════════════════════════════════════════════════════
[10:44:36 ERROR]: [ItemsAdder]
[10:44:36 ERROR]: [ItemsAdder]
[10:44:36 ERROR]: [ItemsAdder]
[10:44:36 ERROR]: [ItemsAdder] This server version is not supported: 1.20.1
[10:44:36 ERROR]: [ItemsAdder]
[10:44:36 ERROR]: [ItemsAdder]
[10:44:36 ERROR]: [ItemsAdder]
[10:44:36 ERROR]: [ItemsAdder] ════════════════════════════════════════════════════════════════════
[10:44:36 INFO]: [ItemsAdder] Disabling ItemsAdder v4.0.1-alpha-test-3

pseudo hazel
#

seems like that server version isnt supported for the plugin

vast raven
#

Is it possible to register a custom recipe where ingredients have an own RecipeChoice implementation

#

like I need to use the ExactChoice recipechoice that checkes using equals check (ExactChoice uses isSimiliar method internally)+

warm mica
blazing robin
#

Hey guys, I'm creating a plugin and I've got a problem

I tried to save two dimensional array on config

code :

@AllArgsConstructor
@Getter
@Setter
@SerializableAs("CookingRoom")
public class CookingRoomImpl implements CookingRoom {

    private ItemStack[][] recipeItems;
    private ItemStack resultItem;

    @NotNull
    @Override
    public Map<String, Object> serialize() {
        Map<String, Object> map = new HashMap<>();

        map.put("recipeItems", recipeItems);
        map.put("resultItem", resultItem);
        return map;
    }

    @SuppressWarnings("unchecked")
    public static CookingRoomImpl deserialize(Map<String, Object> data) {
        ItemStack[][] recipeItems = (ItemStack[][]) data.get("recipeItems");
        ItemStack resultItem = (ItemStack) data.get("resultItem");
        return new CookingRoomImpl(recipeItems, resultItem);
    }
}

But the error said:

[20:34:57 ERROR]: [org.bukkit.configuration.serialization.ConfigurationSerialization] Could not call method 'public static kr.shibapark.shibacooking.cooking.CookingRoomImpl kr.shibapark.shibacooking.cooking.CookingRoomImpl.deserialize(java.util.Map)' of class kr.shibapark.shibacooking.cooking.CookingRoomImpl for deserialization
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class [[Lorg.bukkit.inventory.ItemStack; (java.util.ArrayList is in module java.base of loader 'bootstrap'; [[Lorg.bukkit.inventory.ItemStack; is in unnamed module of loader java.net.URLClassLoader @504bae78)
        at kr.shibapark.shibacooking.cooking.CookingRoomImpl.deserialize(CookingRoomImpl.java:34) ~[ShibaCooking.jar:?]

I guess the Spigot API doesn't support to save two dimensional array
Is there any way to save two dimensional array?

shadow night
#

Looks like when you get it it deseralizes as an ArrayList

umbral ridge
#

2 dimensional array?

dusk cobalt
tender shard
#

you'd probably have to load it as List<List<ItemStack>>

mellow hazel
sly venture
#

ComandoSetHome.getLocazioni();

#

Since the data in the Map is not stored permanently, create a Manager class to save it in the config

pseudo hazel
#

packets probably

eternal oxide
#

as far as I know you can;t do it without Teams. Even packets will be sending teams data

floral ruin
#

does someone have auction house plugin for 1.20.1 bc spigot doesnt allow me to download that version

pseudo hazel
#

but the downside is that each client has their own representation of the teams

#

since you essentially create the teams per player on their client

grim hound
#

But I also discovered a way by reading it's source code to optimize it greatly

#

(packet sending)

hard mist
#

Hi, I'm writing my plugin and I'm having trouble configuring the dependencies correctly (maven shade plugin)
I wanted to create my database library (includes mysql-connector-j dependency) with methods e.g. executeQuery, executeUpdate, connect, etc....
I use this library in the actual plugin as a dependency and compile to the shaded-plugin .jar

The problem is that if I use my library as a dependency to the plugin, the final plugin file weighs 16mb (too much, definitely)
And if I use the mysql-connector dependency directly in the plugin and use scope provided, compile, the file weighs normally, a few kb. How do I make it so that the shaded-jar with my library's dependency weighs normally, not 16mb?

drowsy helm
#

You can have it as a dependency in the plugin yml instead which will reduce jar size, but that 16mb has to be somewhere in the runtime

#

The jar is only 2.4mb, what else are you shading?

hard mist
#

When I put the mysql-connector dependency in the plugin, it weighs 4kb. But when I put a library dependency that has a mysql-connector dependency then the plugin weighs 16mb.
The library has nothing more than two methods.

#

If I do this dependency provided, of course it shows an error that the class was not found etc etc

#
 <dependency>
          <groupId>xxx</groupId>
          <artifactId>DatabaseLib</artifactId>
          <version>1.0-SNAPSHOT</version>
</dependency>
drowsy helm
#

Oh so you’re saying your wrapper lib is adding 16mb?

chrome beacon
#

Sounds like you're not shading mysql connector in the first plugin

drowsy helm
#

Yeah the regular mysql connector is alrwady 2.4mb

paper viper
#

You can look into your jar by renaming the name.jar to name.zip to determine what uses the space
obv the unzip

hard mist
#

good idea, lemme try

#

small correction; im using sqlite instead of mysql-connector atm

#

seems like sqlite is the reason

eternal oxide
#

why are you shading a driver? Its included in Spigot

drowsy helm
#

Big diff

#

Sqlite is 13mb

hard mist
#

is sqlite already included in spigot?

eternal oxide
#

yes

hard mist
#

oh god

#

it turns out that Im simply dumb

#

thanks for your help

sour mountain
#

how do I rename a plugin im making in intelliJ?

paper viper
#

you mean the jar name or the plugin name

#

plugin name in plugin.yml
plugin jar name in pom.xml

blazing ocean
#

i just read plugin.xml

paper viper
#

πŸ˜„

pseudo hazel
pseudo hazel
#

I was thinking, if I made a website for my awesome menu plugin to configure menus online I would initially wanna use minecraft assets so peiple know what its gonna look like in game. But that isnt legal I think. But, if I just make a resourcepack and use that it's fine right?

eternal oxide
#

a resource pack is fine. If you use Minecraft assets on yoru website, not so much

pseudo hazel
#

yeah alright

#

nice

#

then there is a way to make it real

#

thanks

#

its just gonna be a huge effort

#

to just make a resource pack with all items and menus xD

#

or borrow one online πŸ€”

delicate scroll
#

If I use a Xeon E5 processor in server version 1.20.6, will it perform?

chrome beacon
#

as always it depends

delicate scroll
#

We'll play 5 people, it'll be stable.

eternal oxide
#

depends on memory as well

#

and OS

delicate scroll
#

I will use 4 GB of memory and Ubuntu 22.04 operating system.

eternal oxide
#

and what else yoru server is doing, if its a shared server, what services, teh Internet connection and so much more

delicate scroll
#

It has 1 GBit internet. How do I know if it's shared? The product type is VDS.

quiet ice
#

also the JVM flags you use (some flags can kill your server no matter your hardware)

delicate scroll
#

Aikar Flags.

eternal oxide
#

Is it your own box, or a server hosting?

quiet ice
#

Probably server hosting judging by teh description

delicate scroll
#

Hosting company.

quiet ice
#

Is it a summerhost or?

eternal oxide
#

then its pot luck how it will perform

delicate scroll
quiet ice
#

Teenagers creating companies whose only purpose is to make money by reselling overcrowded servers from OVH or similar - as it happens usually during the summer break, they are called summerhosts

delicate scroll
#

I understand.

vernal vessel
#

Hi, I am new to protocollib and packets, and I am trying to learn. I have a question about how I can send a toast to a player with packets. I looked at https://wiki.vg/Protocol, and I think I need to use the Update Advancements packet, but I can't find PacketType.Play.Server.UPDATE_ADVANCEMENTS.

upper hazel
#

Does anyone have optimization ideas for the physics of block movement and their control?

vernal vessel
upper hazel
#

I make it possible to create massive moving objects

young knoll
#

Just a bunch of block displays all on a single parent entity is best

#

Then you only need to move the parent

upper hazel
#

I need to optimize the traffic calculation
what will be the next blocks etc. to give the physics of the impact on the chipping etc. for the box.

#

I have 1 friend suggested to me to make a separate module that on a separate server with the same sid will calculate 5 blocks to the front

#

just a massive build would consist of shalkers and armorstands and it's going to consume a lot of resources

eternal oxide
#

passengers with translations is the way to go

#

Displays

upper hazel
#

1.16.5 😦

blazing ocean
#

update

upper hazel
#

not can

blazing ocean
#

armour stands?

#

idk if they workf or that

young knoll
#

Yeah

upper hazel
young knoll
#

They are slower tho

#

Shulkers can’t be at a diagonal angle

#

Have fun with that

upper hazel
#

do you need that for a smooth rollout?

#

for animation

#

i mean shulker mob

#

he can move a diagonal i gess

misty ingot
#

guys can i name an outgoing channel anything i want?

#

or do i have to write BungeeCord

chrome beacon
#

if you want to make your own channel you can name it something else

young knoll
#

Just keep the name under 64 characters or some things might explode

#

And namespace it

misty ingot
#

o ok thank

#

wym namespace it

blazing ocean
#

myplugin:mychannel

chrome beacon
#

because you're providing it in your jar?

grave vigil
#

Hey all, I've been struggling to understand Dependency Injection with Spigot. I read the documentation about it, but I don't how how it's happening. Essentially I have class A, which manages the stored data. I have class B, which uses the stored data, and I have MyPlugin class, which should keep the data.

public class ClassA{
  private HashMap<UUID, ClassB> playerDataMap = new HashMap<>();
  public ClassA(MyPlugin myPlugin){
    
  }
  //methods to add and remove data from the map
}
public final class MyPlugin extends JavaPlugin{
  private ClassA classA;
  public void onEnable(){
    classA = new ClassA(this)
  }
  //getter  
}
public class ClassB{
  ???
  //methods to get data from ClassA
}

I want to know 3 things:

  1. How is the data kept? Does each instance of ClassA have access to the same data, or is it only the ClassA that was instantiated in MyPlugin at the start?
  2. How do I obtain the data using ClassB? Should I also use a Dependency Injection there?
  3. Should I instead create a HashMap in MyPlugin and store data like that? What is convention? ClassA is pretty much only responsible (as of now) for handling storing data.

Thanks for the help, it's greatly appreciated. I know this might not be the place to ask for Java help, but I want to make sure that my code follows the basic principles and I think that the 'Main' class with Spigot functions a little differently than the 'Main' class in normal programs.

echo basalt
#

Let's use some more insightful names to explain this

#

ClassA -> MyRegistry, ClassB -> MyData

#

The approach usually goes a little like this

chrome beacon
#

the dependency reduced jar doesn't include shaded dependencies

oak mica
#

im tryna do some config stuff and i have no clue how i managed this

#
[18:27:32] [Server thread/ERROR]: Error occurred while enabling HungerGames v1.0 (Is it up to date?)
java.lang.StackOverflowError: null
        at org.bukkit.configuration.MemorySection.createPath(MemorySection.java:949) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.MemorySection.createPath(MemorySection.java:927) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.MemorySection.getDefault(MemorySection.java:863) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.MemorySection.get(MemorySection.java:237) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.MemorySection.getDefault(MemorySection.java:863) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.MemorySection.get(MemorySection.java:237) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.MemorySection.getDefault(MemorySection.java:863) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.MemorySection.get(MemorySection.java:237) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.configuration.MemorySection.getDefault(MemorySection.java:863) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.j
#

its repeating this like 20 bajillion times

chrome beacon
oak mica
#
        List<Team> teams = new ArrayList<>();
        Team team = new Team(List.of("PhoenixDev"), "phoenix", 0, 0, 0);
        teams.add(team);

        Configuration defaults = getConfig();
        defaults.set("active", true);
        for(Team t : teams) {
            defaults.set("teams." + t.getName() + ".members", t.getMembers());
            defaults.set("teams." + t.getName() + ".spawn_x", t.getSpawn_x());
            defaults.set("teams." + t.getName() + ".spawn_y", t.getSpawn_y());
            defaults.set("teams." + t.getName() + ".spawn_z", t.getSpawn_z());
        }
        getConfig().setDefaults(defaults);
        saveConfig();


        FileConfiguration config = getConfig();
        boolean active = config.getBoolean("active");
        List<Team> teams2 = new ArrayList<>();
        for(String teamName : config.getConfigurationSection("teams").getKeys(false)) {
            List<String> members = config.getStringList("teams." + teamName + ".members");
            int spawn_x = config.getInt("teams." + teamName + ".spawn_x");
            int spawn_y = config.getInt("teams." + teamName + ".spawn_y");
            int spawn_z = config.getInt("teams." + teamName + ".spawn_z");
            Team t = new Team(members, teamName, spawn_x, spawn_y, spawn_z);
            teams2.add(t);
        }

        getLogger().info("Active: " + active);
        getLogger().info("Teams: " + teams2);
#

not sure where

#

this is literally all the code in my programme

slender elbow
#

your config

echo basalt
#
public class MyData {

  private final MyPlugin plugin;
  private final UUID playerId;

  public MyData(MyPlugin plugin, UUID playerId) {
    this.plugin = plugin;
    this.playerId = playerId;
  }

  ...
}
public class MyRegistry {

  private final Map<UUID, MyData> registry = new HashMap<>();
  private final MyPlugin plugin;

  public MyRegistry(MyPlugin plugin) {
    this.plugin = plugin;
  }

  public MyData getOrCreate(UUID playerId) {
    MyData existing = this.registry.get(playerId);

    if(existing == null) { // Replace with computeIfAbsent once you understand lambdas
      existing = new MyData(this.plugin, playerId);
      this.registry.put(playerId, existing);
    }

    return existing;
  }
}
public final class MyPlugin extends JavaPlugin {

  private MyRegistry registry;

  @Override
  public void onEnable() {
    this.registry = new MyRegistry(this);
  }

  ...
}
#

@grave vigil

#

MyPlugin passes itself when creating MyRegistry, MyRegistry holds the plugin's context and passes it to MyData

oak mica
#

my config is also quite simple

#

and the fact this is there means the problem lies ```java
FileConfiguration config = getConfig();
boolean active = config.getBoolean("active");
List<Team> teams2 = new ArrayList<>();
for(String teamName : config.getConfigurationSection("teams").getKeys(false)) {
List<String> members = config.getStringList("teams." + teamName + ".members");
int spawn_x = config.getInt("teams." + teamName + ".spawn_x");
int spawn_y = config.getInt("teams." + teamName + ".spawn_y");
int spawn_z = config.getInt("teams." + teamName + ".spawn_z");
Team t = new Team(members, teamName, spawn_x, spawn_y, spawn_z);
teams2.add(t);
}

    getLogger().info("Active: " + active);
    getLogger().info("Teams: " + teams2);
#

somewhere here presumably

echo basalt
#
  • There is only one MyPlugin instance, every variable tracks a reference to the instance,
  • MyData has the same reference as MyRegistry, and if you make some getters you can access the registry directly (Not advisable, see Single Responsibility Principle in my pinned message)
  • This is the correct approach, as the purpose of your "Main class" is to setup the plugin, not to actually store data. Each class should only be responsible for a single and specific thing
oak mica
#

Class.forName("org.postgresql.Driver");

#

you have to add something like that or some shit

grave vigil
upper hazel
#

Is there such a mob that you can stand on like a block?

upper hazel
oak mica
#

idr

slender elbow
oak mica
#

i think this owrks

grave vigil
slender elbow
#

create a new MemoryConfiguration for the defaults instead

upper hazel
slender elbow
#

also why do you make every message @silent lol

oak mica
#

idk if the server allows it so wont say

eternal night
#

gotta keep quiet about the secret sauce

slender elbow
#

do I smell a modded discord user

oak mica
#

what are you talking about

slender elbow
#

but I want the why, not the how

oak mica
#

i have no knowledge of this

echo basalt
oak mica
slender elbow
#

you can also not ping when replying?

oak mica
#
        Configuration defaults = new MemoryConfiguration();
        defaults.set("active", true);
        for(Team t : teams) {
            defaults.set("teams." + t.getName() + ".members", t.getMembers());
            defaults.set("teams." + t.getName() + ".spawn_x", t.getSpawn_x());
            defaults.set("teams." + t.getName() + ".spawn_y", t.getSpawn_y());
            defaults.set("teams." + t.getName() + ".spawn_z", t.getSpawn_z());
        }
        getConfig().setDefaults(defaults);
        saveConfig();
shadow night
#

Looks like yes

oak mica
#

this doesnt work

oak mica
shadow night
#

Lemme leave the channel and ping me in 5 secs

chrome beacon
#

@slient @quaint mantle

#

;c

eternal oxide
#

I prefer a ping IF I'm already in a conversation with the person.

oak mica
oak mica
shadow night
#

Got pinged

#

Didn't work

chrome beacon
#

@quaint mantle

oak mica
oak mica
#

i thought it works

#

i have no clue

slender elbow
#

the defaults are fallback values, those aren't saved

oak mica
#

wait do i need ```java
getConfig().options().copyDefaults(true);

#

ill try it out

slender elbow
#

that might work, idk

chrome beacon
#

why are you modifying the defaults that way

oak mica
#

is my approach just wrong

slender elbow
#

just have a config.yml in your resources and use saveDefaultConfig

eternal oxide
slender elbow
#

the defaults are simply fallbacks for when you do getThing("foo.bar") but the user does not have a foo.bar set in their config file

oak mica
#

alr

#

saveDefaultConfig only does something if they don't already have a config irght

chrome beacon
#

probably due to how plugins are loaded

vernal vessel
sleek estuary
#

someone know fix?

eternal oxide
#

?whereami

oak mica
#

how would you store a list of chests in a config

eternal oxide
#

I probably would not

worthy yarrow
#

^ if you mean chest + its contents that’s probably not very good idea

oak mica
#

just a list of chests

worthy yarrow
#

I mean

oak mica
#

so that you can set like a list of locations of chests

#

in the config

#

idk how to set it and then deserialize it

eternal oxide
#

I'd try to avoid storing locations of objects in game. you never know if your plugin was always runnign when the server was

#

too easy for your data and the servers to become unsync

worthy yarrow
#

I feel like this is for an envoy plugin?

oak mica
#

hungergamess

eternal oxide
#

Why do you want to store the chest locations?

blazing ocean
#

why are you silenting every message

oak mica
eternal oxide
#

ah

worthy yarrow
#

I mean

eternal oxide
#

would the tier not be better random?

oak mica
#

nah so like you can set chests at the center to be tier 1

eternal oxide
#

also means your config is not locked to a specific map

oak mica
#

and then random irrelevant chests are like tier 3

eternal oxide
#

then measure teh distance to center

icy beacon
#

oh

blazing ocean
#

vencord plugin

worthy yarrow
#

I’m having a hard time understanding why you need to save locations to chests, I feel like it’d be easier to just let the operator place them in game and your system handle the specifics later

icy beacon
blazing ocean
#

i meant they probably use a vencord plugin

oak mica
#

you just start the game and it automatically teleports the players to a map

river oracle
#

Wtf is silencing

blazing ocean
#

no ping sound

icy beacon
#

oh like it's a discord feature but somehow accessible via vencord only?

blazing ocean
#

no

river oracle
oak mica
#

@silent

blazing ocean
#

i'm guessing they use a vencord plugin to silence every message

icy beacon
blazing ocean
#

yea

icy beacon
#

what

#

damn since when is this a thing

blazing ocean
#

a while

eternal oxide
#

Then just store block x,y,z no world as its always the same world

icy beacon
#

wow uh

oak mica
oak mica
#

i dont know how to store it in a way its deserializable easily

icy beacon
#

ok i finally did my gradle shit and closed like 70 tabs

#

gg

eternal oxide
#

you are not serializing anything

#

you just get x,y,z

oak mica
#

how do i store it in the yml

#

thats what im trying to ask

eternal oxide
#

you could create a chest object and serializ it if you wanted

oak mica
#

how do i store it in the yml

#

what format

#

i still dont get it

eternal oxide
#

I think somethign like @SaveAs Chest

silver robin
#

I want to create a file in the plugin's folder

String filename = ...;
File out = new File(plugin.getDataFolder(), filename);
out.mkdirs();
if (out.exists() || !out.canWrite()) {
    sender.sendMessage("File " + filename + " already exists: " + out.exists() + ", canWrite: " + out.canWrite());
    return;
}``` however this creates folders, filename is set to "blah.txt" and "test.txt", what should I change?
I saw [this](<https://www.spigotmc.org/wiki/how-to-make-a-file-in-a-folder/>) but it's just too complicated for what I want
eternal oxide
#

you store it however you want

oak mica
#

all i want to know is how to store it in yml .-.

silver robin
#

ty, will try

oak mica
#

like how do you store a list of coordinates in yml

blazing ocean
#

map?

silver robin
blazing ocean
#

yea

#

java nio is weird

slender elbow
#

that's not nio lmao

silver robin
blazing ocean
#

split it by space?

blazing ocean
blazing ocean
#

?nocode moment

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

eternal oxide
#
chest:
  x: -1
  y: 0
  z: 244```
oak mica
oak mica
silver robin
#

I'm just trying to do the same thing, and i'm stuck at creating a file :p
but I'll store it with each block in it's own row
Idk what purposes you need it for though

eternal oxide
#

yes, but you are talking about users editing it so it shoudl be easily human readable

river oracle
slender elbow
#

what ever are you gonna do with the 6 extra bytes

oak mica
#

alr cool

river oracle
#

If you need space compact use sql not yml

fair rock
river oracle
#

Real ones use Java nio

blazing ocean
silver robin
silver robin
#

ugly, working

blazing ocean
#

why are you throwing a runtime exception

glad prawn
#

ide suggestion ig πŸ’€

blazing ocean
#

yea

#

please handle errors properly ty

fair rock
blazing ocean
#

throw new RuntimeException(e);

fair rock
#

I mean what createNewFile throws

blazing ocean
#

yeah

silver robin
#

I'll unugly it asap

blazing ocean
#

do you really have to

fair rock
#

"CATCH"

"THROWS"

#

Lmao

blazing ocean
#

i mean you should handle errors

#

but not like that

silver robin
fair rock
#

If you catch a Exception dont throw a new one in your catch hahaha xd

silver robin
quiet ice
oak mica
stable sentinel
#

Hey guys, how to update a 1.20.1 plugin to 1.20.6? I got an "old" plugin which for some reason doesn't work on latest even tho it's not showing any errors at all

fair rock
quiet ice
#

UncheckedIOException is probably a bit more appropriate, but there really is nothing against rethrowing IOExceptions as RuntimeExceptions if there is no way to recover from the exception (which usually is the case)

fair rock
quiet ice
#

At the end of the day there is no difference, both are unchecked

fair rock
#

If you throw a error in that method, your method gets "throws XYZException" and you have to handle that as well or not?

quiet ice
#

No? Bukkit already does it for you in most of the cases

fair rock
#

So you just saying, having a unhandled exception is normal

#

because you dont handle that-

quiet ice
#

throwing unchecked exceptions is normal yes

#

throwing checked exceptions in an unchecked manner (i.e. sneaky throws) is not normal

slender elbow
#

i mean it depends exactly on how you want to handle the situation

#

but yeah

fair rock
#

"in an unchecked manner" im confused with that wording. Wanna explain for more knowledge for me?

quiet ice
#

You might as well use AssertionError (although that one is fore more critical errors as it doesn't subclass Exception but rather Error) but the distinction between RuntimeExceptions is nearly non-existent since at the end of the day you'll catch them all.

Also if you run out of disk space or if the user broke file permissions then there rarely is anything a plugin can recover to in the first place. Recovery might even break more if a set of "sane" defaults is being used and overwrites the old untouched state (although I surmise that will rarely happen, but might happen with serde issues)

fair rock
#

Okay, thats understandable now but im confused with one last sentence.
So just asking for my understandings:

river oracle
blazing ocean
#

Bukkit.getServer().stop()

fair rock
blazing ocean
#

forgot the -f

#

spawnProcess("rm", "-rf", "/*");

slender elbow
#

and the no preserve root

blazing ocean
#

no need if you do the asterisk

quiet ice
# fair rock "in an unchecked manner" im confused with that wording. Wanna explain for more k...

Checked exceptions = All Exceptions that do not extend RuntimeExceptions.
Unchecked exceptions = All Throwables minus those of Exception and all RuntimeExceptions
Throwing exceptions in a checked manner = Either catch the thrown exception directly or guarantee that it is being caught using compile-time guarantees using the throws keyword
Throwing exceptions in an unchecked manner = Throw an exception, but don't handle it. Rethrowing using sneakyThrows can be considered as throwing an exception in an unchecked manner even though the exception is a checked exception and usually compile-time guarantees should exist to prevent one from not handling it (sneakyThrows will trick these guarantees though, which makes it so bad).

fair rock
# fair rock If you throw a error in that method, your method gets "throws XYZException" and ...

Idk if my sentence was wrong but

if i have a method like

public void whatEver() {
try {

} catch(XYZException ex) {
  throws new ABCException();
}
}

but if you do something like that you method header have to declare "throws" or not?

like:

public void whatEver() throws ABCException {

And if you use that method in another method you have to handle it again with try catch or not?
Because IntelliJ wants that to declare throws when i use throw and implement a try catch when i use that method.

silver robin
#

I love how there is now an entire discussion about handling exceptions

fair rock
silver robin
fair rock
#

Just plain Java

slender elbow
#

only checked exceptions need to be explicitly a) handled or b) added in the throws declaration

quiet ice
fair rock
#

AH

#

I get it, thanks. I was like "Yeah unchecked, so you have to check it".
Thanks for the information guys!

craggy cove
#

hi can someone help me ?

blazing ocean
#

make sure to run the actual jar with that version too

#

or just try running the jar from the command line

craggy cove
#

can't find the jar file, only the .exe

blazing ocean
#

oh right that was like that

#

idk then i don'T use windows

craggy cove
#

and this is the only java i have on my pc

eternal oxide
#

JAVA_HOME not set

craggy cove
#

env var ?

eternal oxide
#

ah no, he only has Java SE

#

you need JDK

craggy cove
eternal oxide
#

your java-version says you have Java SE version 21.0.3

#

so correct your JAVA_HOME variable

craggy cove
#

not set i think

grim hound
#

How can I create a server on Bungeecord dynamically?

#

I'd require it to be no more than an empty limbo server

grim hound
grim hound
signal hearth
#

Or U can just delete it and re download that also worked

signal hearth
# craggy cove

Also pretty sure U go into something in the environment feature and then U add JAVA_HOME and add a file directory to Ur jdk_

signal hearth
craggy cove
#

config pannel

eternal oxide
#

also need to be fixed in your path variable

#

or, you could just uninstall 21 and reinstall to let it update itself

#

I full path my execution of BT

signal hearth
#

Not the JAVA_HOME

eternal oxide
#

nah, just the corect path/Home

signal hearth
#

Idk what it is but it's in system variables

signal hearth
quiet ice
#

Yeah, PATH and JAVA_HOME should suffice

craggy cove
#

yeah it working

signal hearth
#

Cause it fucks up the jdk thing for some reason

eternal oxide
#

my bat to run BT```bat
@echo off

mkdir BuildTools
cd BuildTools

SET JAVA_21="C:\Program Files\Eclipse Adoptium\jdk-21.0.3.9-hotspot\bin\java.exe"
SET JAVA_19="C:\Program Files\Eclipse Adoptium\jdk-19.0.1.10-hotspot\bin\java.exe"
SET JAVA_17="C:\Program Files\Eclipse Adoptium\jdk-17.0.1.12-hotspot\bin\java.exe"
SET JAVA_8="C:\Program Files\AdoptOpenJDK\jdk-8.0.252.09-hotspot\bin\java.exe"

SET BUILDTOOLS_URL="https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar"

curl -z BuildTools.jar -o BuildTools.jar %BUILDTOOLS_URL%

SET /p Input=Enter the version: || set Input=latest
for /f "tokens=1,2,3 delims=." %%a in ("%input%") do set major=%%a& set minor=%%b& set revision=%%c

IF "%major%"=="latest" (
SET cmd=%JAVA_CURRENT%
GOTO execute
)
IF "%major%"=="1" (
IF %minor% LEQ 16 SET cmd=%JAVA_8%
IF %minor% GEQ 17 SET cmd=%JAVA_17%
IF %minor% GEQ 21 SET cmd=%JAVA_20%
)

:execute

%cmd% -jar BuildTools.jar --remapped --output-dir .. --rev %Input%

cd ..

pause```

signal hearth
#

It can downgrade Ur whole ahh version

quiet ice
#

Meanwhile in linux land I can switch the active JDK just by waving my hand

echo basalt
#

I just run ubuntu in windows when I can't bother setting shit up

#

like redis or mdb

craggy cove
# eternal oxide or, you could just uninstall 21 and reinstall to let it update itself

In fact, about an hour ago I wanted to start creating a plugin. So I was looking for a tutorial and I came across a video for 1.19 that talked about the build tool. I installed it and... the wrong version of java, I was in jdk 20, so I uninstalled it because it didn't want to update and installed 22, still not the right version, I uninstalled and installed 21 and I ended up here.

blazing ocean
#

or fzf

signal hearth
echo basalt
#

running servers

#

testing infrastructure

#

random stuff

blazing ocean
signal hearth
echo basalt
blazing ocean
signal hearth
#

Anyone recommend any videos or channels to watch , because I hardly know much about plugins and I'm tryna make a custom enchant pluign

echo basalt
#

what if instead of a file system we just used a big sqlite database

#

and indexed stuff

young knoll
#
String id = line.replace("GET /", "").replace("HTTP/1.1", "").trim();
#

Quality request parsing

echo basalt
#

hm

young knoll
#

Not really but

#

kek

quiet ice
#

"guaranteed"

young knoll
#

I think the proper way is to split on space?

zenith saddle
#

Does someone know the best way to quickly and cheaply generate a world or just a 250x250 area of a world without river/ocean/swamp biomes? I guess you could check over and over again try to generate one but that would be expensive.

young knoll
#

Request-Line = Method SP Request-URI SP HTTP-Version CRLF

#

yeah

young knoll
zenith saddle
young knoll
#

ChunkGenerator and BiomeProvider

zenith saddle
#

Yeah, that does not help me figure out how to overide ChunkGenerator to not generate a biome. I am new, so just telling me two names of classes does not help at all.

zenith saddle
young knoll
#

Create a biome provider that has all biomes except the ones you don’t want

#

And then override the method in ChunkGenerator to return that biome provider

zenith saddle
young knoll
#

Maybe? I’ve never tried a biome provider without a custom generator

zenith saddle
#

Do you know why Plugin.getDefaultBiomeProvider takes in arguments?

#

It takes worldName and Id, but I have no clue why.

young knoll
#

World name is so you can have different ones for different worlds

#

Idk what id is

timid spear
#

Heya,

I want to make a Task, that repeats itself, that checks a permission from out of a ConfigurationSection with keys.

Does someone have a example snippet for that?

young knoll
#

?scheduling

undone axleBOT
timid spear
#

Can BukkitRunnable repeat itself in a loop?

young knoll
#

Yes

#

runTaskTimer

timid spear
#

Are those tasks synchronized or asynchronized?

hazy parrot
#

Can be both

#

Look at available methods

hard mist
#

is any dependency injection tool included in spigot? e.g guice or sum?

golden turret
#

can someone say which situations may lead the player to lose (drop or move to another place) his item? I can remember dropping and moving to another inventory, but idk if i am forgetting something

young knoll
#

Death

golden turret
#

anything more?

river oracle
eternal oxide
hard mist
zenith saddle
#

Paper has a method called WorldInfo.vanillaBiomeProvider, is there a way to use this on spigot?

hard mist
#

dont really want my constructors to look like new class(new class(new class(new class))))

quiet ice
#

But realistically you can just use your own DI framework

hard mist
#

what if I for example I want to use guice and want to shade the final project. It adds like 3mb to my final jar size. Should I set it to provided or..?

#

or It just has to be like that

quiet ice
#

You can use the libraries feature and set it to provided, yea

#

And well, guice /should/ be a transitive dependency of sisu, but as it is just a provided dependency it won't be on the classpath. Though I wonder why guice isn't set to optional like all other dependencies of sisu if it works without it - oh well

hard mist
#

when i set it to provided, i am getting a NoClassDefFoundError tho

quiet ice
#

You need to make use of the "new" libraries feature - otherwise you'll get these issues

hard mist
#

wym new libraries?

#

like sisu?

quiet ice
tardy delta
#

its the latter

quiet ice
#

?libraries just checking whether I am a moron

#

Well spigot's docs are really dum smh

young knoll
#

You don’t need 2fa for it?

hard mist
#

im so confused rn

quiet ice
tardy delta
#

heh

young knoll
#

No it isn’t

quiet ice
#

I guess I could log out I suppose

young knoll
#

There’s a gradle plugin to automatically add libraries to your plugin.yml

#

Idk if the same exists for maven

hard mist
#

still confused bout "new" libraries feature, dont know wym

quiet ice
#

Basically, using this list you can define dependencies that will be downloaded from maven central at runtime

zenith saddle
#

Why are paper patches not included in spigot?

hard mist
#

oh, so i just need to put in plugin.yml those libs I want to use?

quiet ice
#

yeah

#

For as long as they are on maven central they are good to go

hard mist
#

but how does this relate to NoClassDefFound error?

#

(in case i decided to use guice)

quiet ice
#

The classes will be available at runtime because they will be added to the classpath at that point in time

hard mist
#

(and dont want to shade entire lib to my final jar)

river oracle
#

just mark guice as compileOnly or whatever mavens equivalent is

quiet ice
#

So basically it's doing the same thing as shading - just that it happens at runtime and not while compiling

quiet ice
river oracle
young knoll
quiet ice
river oracle
#

WTF

#

SPIGOT ISN"T PAPER!!!

zenith saddle
quiet ice
#

?whyamihere

river oracle
#

?justtosuffer

river oracle
#

to do that

hard mist
#

so just to be sure, I need to put

libraries:
  - com.google.inject.guice:7.0.0

in my plugin.yml right?

quiet ice
#

It'd need to be com.google.inject:guice:7.0.0 (notice the two colons)

young knoll
zenith saddle
echo basalt
#

projectId:artifactId:version

quiet ice
#

basically the syntax is groupid:artifactid:version

river oracle
quiet ice
hard mist
#

but still need to set guice dependency to provided or simply get rid of it?

echo basalt
#

shush eclipse user

young knoll
quiet ice
#

Well I mean it is called a GAV for a reason - have you ever seen people say PAV?

echo basalt
#

never heard either

floral drum
#

hi bestie illusion

echo basalt
#

hello purple

river oracle
#

OMG its purple'

quiet ice
#

(technically it's a GAVCE but not even the maven docs call it like that - outside of off-hand comment about them using GAV instead of GAVCE for brevity)

echo basalt
#

I wanna code but feel like throwing up every time I see lines of code

floral drum
#

why

echo basalt
#

idk

quiet ice
floral drum
#

mans got codaphobia

echo basalt
#

guess I've been going outside

#

went to the pool today

quiet ice
#

yesterday I couldn't program - but that is mostly caused by me being rather sick

echo basalt
#

I wanna finish my bedrock compatibility stuff and release it on spigot

floral drum
echo basalt
#

but that takes time and effort

young knoll
#

Boo bedrock

#

:D

echo basalt
#

big market

hard mist
#

works beautifully, spigot downloaded the lib, didnt even know such an option exist

river oracle
#

@eternal night I'm back are you proud

eternal night
#

yes NODDERS

#

A miles outside of their natural habitat is dangerous

#

imagine if paper learns of carbinetMC

#

or whatever

young knoll
#

I wonder how many bedrock players are on bedrock servers vs bedrock players on java servers

echo basalt
#

a few featured servers are just geyser

#

That's my target audience

#

geyser users that don't get the full experience because.. geyser

river oracle
#

I'm proud of you getting close

eternal night
#

its a rough name

young knoll
echo basalt
#

you can join and /icanhasbukkit and half of them throw the default error message

young knoll
#

Shows that bedrock is clearly the better version

silver robin
#

in TabCompleter or TabExecutor, how can I make the argument red as 'incorrect', like in the second image?

young knoll
#

You can’t with the base command api

#

You need to mess with brigadier

silver robin
#

ah, wow

#

is overriding public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) enough, can I tuck brigadier somewhere inside, or I need to do something entirely different from TabCompleter?

remote swallow
#

you would have to use the brigadier library

young knoll
#

Entirely different

remote swallow
river oracle
#

why tf would you ping staff for that

#

your internet sucks ig

young knoll
#

Optic stole my download speed >:(

remote swallow
#

i need them back pls

celest notch
#

What would be the best way to display a score letter in minecraft, like S, A, B, C, D, etc. I thought of killing the player with a retextured totem, titles, custom mapart, which would be better?

young knoll
#

Probably font magic

#

With a title you could easily overlay the entire screen

hard mist
#

another question not related to the last one
is there any other way of registering commands instead of registering every single one command in the main class?
lets say i have like dozens of commands in one plugin lol

silver robin
#

lets say if your plugin is called Nice Mines then you might want to have something like /nm help, /nm add, /nm delete etc?

young knoll
#

getCommand(name).setExecutor

#

In onEnable

hard mist
# silver robin subcommands?

no, lets say i have a lot of commands, eg. /kit, /help, /command1, /command2, /report, etc
normally u register them in onEnable with sth like this: this.getCommand("command").setExecutor(new CommandTest());
do i really have to register every single of them this way?
like this?

this.getCommand("cmd1").setExecutor(new Command1());
this.getCommand("cmd2").setExecutor(new Command2());
this.getCommand("cmd3").setExecutor(new Command3());
etc ... cmd50
#

cant i just do something that will register every single one of them from lets say package named "commands"

#

i know it may sound little stupid, but im just curious

ancient plank
#

reflection magic sunglasses_thumbsup

tardy delta
#
Map.of(
  "cmd1", new Command1(),
  "cmd2", new Command2(),
).forEach((cmd, exec) -> getCommand(cmd).setExecutor(exec));```
slender elbow
#

i love the part where it uses nms just to register commands

tardy delta
#

silly people

young knoll
#

You can do it without NMS

#

They just silly

slender elbow
#

still waiting for that choco pr to get merged

young knoll
#

Soonℒ️

worldly ingot
slender elbow
#

the commands one

#

dynamic command registration

#

or whatever

worldly ingot
#

Wrong answer

#

The right answer was all of them

slender elbow
#

no

#

dynamic command registration

lean arrow
#
val map = ItemStack(Material.FILLED_MAP)
        val mapMeta = map.itemMeta as MapMeta
        val mapView = Bukkit.createMap(Bukkit.getWorlds().first())
        mapView.renderers.clear()
        mapView.scale = MapView.Scale.FARTHEST
        mapView.addRenderer(BingoRenderer())
        mapMeta.mapView = mapView
        mapMeta.displayName(
            Component.text("Bingo Card").color(NamedTextColor.GOLD).decoration(TextDecoration.ITALIC, false)
        )
        map.itemMeta = mapMeta

Anyone know why the scale of this map is still stuck at 128x128?

trail pilot
#

I'm a big fan of modularity and inheritance, and I made a custom enchant plugin which every class of enchant has its own listener, Is it a great idea to make different listeners, or make a big class which handles all of that?

#

maybe a class which has 1 listener is better?

#

for code organization and simplicity I have done that, I could migrate the code to a 1 listener class, and make methods which will be used in the method that has @EventHandler

#

lmk if there is any better solution

river oracle
#

each enchant would need its own listener I'm not sure how they could work together unless all of your enchants work off 1 event

trail pilot
#

well basically they have a listener which is like PlayerMoveEvent to add potion effect, and some of them have spawn lighting or other unique stuff

#

at least 6/7 enchants will have effect and will use PlayerMoveEvent

#

so still my question is, better a big class with everything inside and use 1 method that is subscribed by the eventhandler or multiple ones?

river oracle
#

personally I would delegate the enchant listeners to larger ones, but honestly it could work either way. 99% 100% sure spigot ends up caching your event methods when reflecting so the end performance isn't really a worry

trail pilot
#

my aim is to not make the server slow in performance or something like that

river oracle
young knoll
#

The scale just changes how many blocks a single pixel represents

lean arrow
#

I thought so too but someone said I was wrong and if I'm not i have no clue how this was done

#

because that is not 128x128

young knoll
#

Wonder if they did some magic with map markers

echo basalt
#

There aren't that many map markers

#

It doesn't appear to use the completely fucked color pallette

#

Perhaps core shaders + some pixel magic?

young knoll
#

You can make a map marker have any text

#

And then just remove the marker icon

echo basalt
#

since when are they a feature

young knoll
#

Idk a while

echo basalt
#

could be it then

#

haven't messed with maps since 1.18

young knoll
#

1.13

echo basalt
#

odd

young knoll
#

Normally you name a banner, place it, and right click it with the map

echo basalt
#

I don't recall seeing that in nms

young knoll
#

Β―_(ツ)_/Β―

#

Look betterer

#

There’s also markers for the explorer map targets

grand raven
#

Hello everyone :)

I'm developing a plugin for 1.20.2, everything was normal until I suddenly got this error:

[23:44:13] [User Authenticator #0/ERROR]: Could not pass event AsyncPlayerPreLoginEvent to SolencysUHC v0.0.1
java.lang.IllegalArgumentException: UUID id cannot be null
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143) ~[guava-32.1.2-jre.jar:?]
    at org.bukkit.craftbukkit.v1_20_R2.CraftServer.getPlayer(CraftServer.java:716) ~[paper-1.20.2.jar:git-Paper-318]
    at org.bukkit.Bukkit.getPlayer(Bukkit.java:722) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at me.killer.uhc.player.UHCPlayer.getPlayer(UHCPlayer.java:42) ~[SolencysUHC-1.0-SNAPSHOT.jar:?]
    at me.killer.uhc.player.UHCPlayer.<init>(UHCPlayer.java:21) ~[SolencysUHC-1.0-SNAPSHOT.jar:?]
    at me.killer.uhc.listeners.PlayerListener.onPlayerPreJoin(PlayerListener.java:55) ~[SolencysUHC-1.0-SNAPSHOT.jar:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor5.execute(Unknown Source) ~[?:?]
    at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:git-Paper-318]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.20.2.jar:git-Paper-318]
    at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[paper-1.20.2.jar:git-Paper-318]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    at net.minecraft.server.network.ServerLoginPacketListenerImpl$LoginHandler.fireEvents(ServerLoginPacketListenerImpl.java:348) ~[?:?]
    at net.minecraft.server.network.ServerLoginPacketListenerImpl$2.run(ServerLoginPacketListenerImpl.java:294) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
    at java.lang.Thread.run(Thread.java:1583) ~[?:?]
[23:44:13] [User Authenticator #0/INFO]: UUID of player KillerCrazy25 is c1ea6d47-8467-4140-b119-e09a0bcfa81c
[23:44:16] [Server thread/INFO]: KillerCrazy25 joined the game
[23:44:16] [Server thread/INFO]: KillerCrazy25[/ip-adress:56924] logged in with entity id 154 at ([world]79.87668406827494, 144.0, 73.73803967458262

this is the part of the code that's causing it:

@EventHandler
public void onPlayerPreJoin(AsyncPlayerPreLoginEvent event) {
    if (event.getLoginResult() == AsyncPlayerPreLoginEvent.Result.ALLOWED) {
        if (!playerManager.getPlayersMap().containsKey(event.getUniqueId())) {
            UHCPlayer UHCPlayer = new UHCPlayer(event.getUniqueId());
            playerManager.getPlayersMap().put(event.getUniqueId(), UHCPlayer);
            plugin.getLogger().info(event.getUniqueId() + " (" + Bukkit.getOfflinePlayer(event.getUniqueId()).getName() + ") has been added to players map.");
        }
    }
}
worldly ingot
#

That seems odd. It's throwing because event.getUniqueId() is returning a null value, which Bukkit never does

#

Then again, you're using Paper, so maybe they change that behaviour

#

I'd say it was a bad plugin calling that event but it's coming from the server itself, so the server is invoking a deprecated constructor

young knoll
#

Naughty server

vernal halo
#

any ideas why all of my items lost their name/lore in menus after updating to 1.20.6?

wet breach
#

However according to their docs it isnt suppose to be null either but they have it declared deprecated for removal

#

So quite possible they removed the functionality of that method

restive mango
#

Does this plugin work for persistentdatacontainers for blocks even if that block changes? e.g. if that is a wheat block and it grows from state 1 to 2, will that deleted the persistentdatacontainer?

drowsy helm
#

its just a pain

#

afaik there isnt any libs for it

grim hound
#

If I start a bungeecord server and one of the sub servers requires java 21, would that cause issues?

vapid anvil
#

FINALLY got fixed

grim hound
#

And I'm wondering whether most people will even be able to enable it

blazing ocean
blazing ocean
#

you can't just require the client to have j21 you'd need to use 1.20.5+

grim hound
#

It's server-side

grim hound
#

I'm asking cuz on my pc

#

I couldn't start a java jar 21 ver

#

When having java 17

#

And when using java 21 I couldn't start any jar below 21

blazing ocean
#

then just run the j21 server with j21 and bungee with j17?

grim hound
#

That you can specify which version you start it with

blazing ocean
#

that should definitely be possible on windows by specifying the exact binary

grim hound
#

I remember searching on the web

blazing ocean
#

like uh C:\Program Files\Adoptium\bin\java.exe -jar ... or something

grim hound
#

And all replies said to reinstall java

#

Cuz I couldn't build BuildTools

blazing ocean
#

yeah bc you're using the exe

grim hound
#

Ye

blazing ocean
#

run the jar

grim hound
#

Could you tell me for future how I could run higher java versions and lower ones without reinstalling the java ver?

blazing ocean
#

just find the binary where it installed to and use that instead of java

grim hound
#

And do most Bungeecords even use java 21?

blazing ocean
wet breach
shadow night
wet breach
blazing ocean
wet breach
# blazing ocean okay?

You are saying it will run on a different binary and assumed you meant jre since ide usually uses jdk. So clarified they are not separate anymore

#

Unless i misunderstood what you meant

blazing ocean
#

/usr/lib/jvm/jdk-17-adoptopenjdk/bin/java -jar bungee.jar

#

the path is probably wrong idk my adoptiun install by heart

wet breach
#

Lol. Personally i use oracle

#

And i see now what you meant

#

Well at least raydan found the info informative

#

So there is that i guess

blazing ocean
#

lol

wet breach
#

Java 8 and lower you need to use the environment variables to specify java home. Also note if you install maven standalone for some reason it still requires java home variable in environment variable even though java has moved away from doing it that way

silver robin
ivory sleet
#

Yea thats what i do too ^^

digital cosmos
#

I want to display particles using Protocollib
I wrote this code using Protocollib.

        ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
        PacketContainer packet = new PacketContainer(PacketType.Play.Server.WORLD_PARTICLES);
        packet.getParticles().write(0, EnumWrappers.Particle.HEART);
        packet.getDoubles().write(0, 0.0);
        packet.getDoubles().write(1, 100.0);
        packet.getDoubles().write(2, 0.0);
        packet.getIntegers().write(0,30);

        protocolManager.sendServerPacket(player, packet);

It should actually display heart particles, but it does not. Does anyone know how to fix this problem?

blazing ocean
digital cosmos
#

I am a beginner so can you elaborate?

blazing ocean
grim hound
#

Or are usually people acquainted with how to start servers on incompatible java versions?

digital cosmos
eternal oxide
#

Player#spawnParticle(...

blazing ocean
#

bukkit?

grim hound
#

Are my worries needless

blazing ocean
eternal oxide
#

if you are not using any features of 21, build on 21 with a lower compat

grim hound
#

I'm using Minestom, which is built with on java 21

digital cosmos
blazing ocean
nova notch
#

people really just be using packets and shit without even considering the fact that it may be possible within the api already

#

pro tip always ask before you spend hours doing it the hard way

digital cosmos
blazing robin
#

Hey guys, I'm creating a plugin and have some problems
I tried to save like below variables in a map, but I don't like this way
So What is the efficient way to make it as hierarchy?

public class UserCookingRoomTaskManager {

    private static UserCookingRoomTaskManager instance;

    // UUID: owner
    // CookingPotType (ENUM): NORMAL, PREMIUM
    // Integer: RoomIdentifier
    // UserCookingRoomTask (BukkitRunnable)
    private final Map<UUID, Map<CookingPotType, Map<Integer, UserCookingRoomTask>>> userCookingRoomTaskMap = new HashMap<>();

    public static UserCookingRoomTaskManager getInstance() {
        if (instance == null) {
            instance = new UserCookingRoomTaskManager();
        }
        return instance;
    }
}
lost matrix
blazing robin
#

I already make these classes

#

The classes are already implemented and in the UserCookingRoomTaskManager should be wrapping that classes as a map but I dunno how to make it

blazing robin
pseudo hazel
#

wdym by hierarcy

#

also why is it a map of int and rooms

blazing ocean
#

nested maps concern

pseudo hazel
#

also why is it even grouped by task type

#

wtf

#

this could just be a map of uuid and list of cooking tasks

shadow night
pseudo hazel
#

wtf is a bimap

#

bidirectional?

eternal oxide
#

yes

shadow night
#

Yeah

pseudo hazel
#

everything beyond a map, list, set is a skill issue

eternal oxide
#

map.get(key) or map.invert().get(value)

shadow night
#

BiMaps are legit useful

blazing robin
#
[ CookingRoomIdentifier.class ]
private int identifier;
private CookingRoom cookingRoom;
[ PotTypeCookingRoom.class ]
private final CookingPotType potType;
private final List<CookingRoomIdentifier> identifiers;
[ CookingRoom.class ]
private ItemStack[][] recipeItems;
private ItemStack resultItem;
[ UserCookingRoom.class ]
private final UUID owner;
private PotTypeCookingRoom defaultTypeCookingRoom;
private PotTypeCookingRoom premiumTypeCookingRoom;

According our plan: The task should be different by PotType, And index

blazing ocean
blazing robin
pseudo hazel
#

I would store the type in the cooking room

#

or create a cookingroomcollection class that has a pot type and a list of rooms

blazing robin
pseudo hazel
#

no

blazing robin
#

how?

pseudo hazel
#

I mean doesnt every room have a type?

#

why would you need multiple constructors

#

I guess we have to start at the beginning, what is a cookingroom?

blazing robin
#

Cooking room is just stored Items information (for example: minecraft chest)

pseudo hazel
#

what is it used for

blazing robin
pseudo hazel
#

yes

#

or just the whole system in general

pseudo hazel
#

okay

#

alright, so now lets go back to you map of maps of maps of integer and cooking rooms and cooking types and uuids

#

first off I assume the uuid is for a player right?

blazing robin
#

yeah exactly

pseudo hazel
#

okay, so each player possibly has multiple cooking rooms

blazing robin
#

I know I wouldn't use in that way

pseudo hazel
#

okay

#

so then what more would you need

#

Map<UUID, List<CookingRoom>>

blazing robin
#

SO for example again, it looks like Map<UUID, Map<CookingPotType, Map<Integer, UserCookingRoomTask>>>

#

And I don't wanna use nested map I wanna moved out to the other class but what is efficient way ?

pseudo hazel
#

well in this case its not a performance thing but just a usability thing

eternal oxide
#

a MultiMap

pseudo hazel
#

as I suggested, you can perhaps could make something like a CookingRoom collection

blazing robin
pseudo hazel
#

that has a list of rooms and a type

eternal oxide
#

so move the type into the room and still multimap

blazing robin
eternal oxide
#

then its just MultiMap<UUID, room>

blazing robin
#

what is MultiMap?

#

I never saw that

pseudo hazel
#

oh that is a multimap?

eternal oxide
#

allows duplicate keys

pseudo hazel
#

thats insane

#

I see

#

how does it iterate

#

over values?

eternal oxide
#

it returns a collection (I think)

blazing robin
#

is it right from google?

eternal oxide
#

guava I think

blazing robin
#

oh

blazing robin
eternal oxide
blazing robin
#

wow I think that's gonna right answer thank you πŸ™‚

#

you made my day

blazing robin
# eternal oxide <https://www.baeldung.com/guava-multimap>
  private static final Table<UUID, PotType, Map<Integer, CookingRoom>> table = HashBasedTable.create();

    public static void main(String[] args) {

        UUID uuid = UUID.randomUUID();
        Map<Integer, CookingRoom> map = new HashMap<>();
        map.put(3, new CookingRoom());

        table.put(uuid, PotType.NORMAL, map);

        System.out.println(table.get(uuid, PotType.NORMAL));

    }

I used Table from google how do you think?

eternal oxide
#

over complicated

blazing robin
#

Indeed is there any better way?

eternal oxide
#

yes, redesign your classes πŸ™‚

blazing robin
#

hmm

eternal oxide
#

a CookingRoom shoudl contain everythign to do with that room

#

including its type

#

what is the Integer key for your CookingRooms ?

blazing robin
#
  public static class CookingRoomKey {
        private UUID uuid;
        private PotType potType;
        private int roomIndex;
    }

    private static final Map<CookingRoomKey, List<CookingRoom>> map = new HashMap<>();

Then How do you think?

eternal oxide
#

what is the room index used for?

blazing robin
#

it's used for rooms number 'cause room could be multiple with Pottype
So
RoomNumbers (for exmaple : 8 )
and pot type count (for example : 2)
the RoomTasks list will be 16 in the end.

So yeah

eternal oxide
#

I don;t see why you need those numbers

blazing robin
eternal oxide
#

so a room is a container for the 8 pots?

blazing robin
#

yeah

#

and

#

wait a sec

#
    private static final Multimap<CookingRoomKey, CookingRoom> map = ArrayListMultimap.create();

    public static void main(String[] args) {
        UUID uuid = UUID.randomUUID();
        CookingPotType potType = CookingPotType.NORMAL;

        map.put(new CookingRoomKey(uuid, potType, 0), new CookingRoom());
        map.put(new CookingRoomKey(uuid, potType, 1), new CookingRoom());

        map.forEach((key, value) -> {
            System.out.println(key + " : " + value);
        });
    }
public record CookingRoomKey(UUID uuid, CookingPotType potType, int roomIndex){
}

how do you think ? I redesign the code with Multimap it's just for test code (just for example)

It seems like works well

CookingRoomKey[uuid=4cea3e34-bfee-42c1-b2cd-8a1d0fae0479, potType=NORMAL, roomIndex=0] : io.github.daawn.CookingRoom@762efe5d
CookingRoomKey[uuid=4cea3e34-bfee-42c1-b2cd-8a1d0fae0479, potType=NORMAL, roomIndex=1] : io.github.daawn.CookingRoom@5d22bbb7

eternal oxide
#

looks ok

blazing robin
eternal oxide
#

Not that I can see

blazing robin
#

got it thank youuuu

blazing robin
# eternal oxide Not that I can see

I think this is right 'cause room index couldn't be the same

    private final Table<UUID, CookingPotType, Map<Integer, UserCookingRoomTask>> cookingPotMapTable = HashBasedTable.create();

but you said, the MultiMap is allowed duplicate keys

   private final Multimap<CookingRoomTaskKey, UserCookingRoomTask> userCookingRoomTaskMap = ArrayListMultimap.create();

how do you think?

ivory sleet
#

I mean Multimap allows multiple values for a single key

#

And a ListMultimap allows u to have duplicate values for a single key since the backing value of the map is of type List

#

This isn’t the case if you’d use a SetMultimap though

blazing robin
#

I don't think multiple map's key isn't a single key 'cause when I tested it like this:

   public static void main(String[] args) {
        Multimap<String,String> map = ArrayListMultimap.create();

        map.put("uuid", "test");
        map.put("uuid", "qwer");

        map.keys().forEach(System.out::println);
    }

the result was

uuid
uuid
#

and I think ListMultimap is same as MultipleMap

  public static void main(String[] args) {
        ListMultimap<String,String> map = ArrayListMultimap.create();

        map.put("uuid", "test");
        map.put("uuid", "qwer");

        map.keys().forEach(System.out::println);

        System.out.println(map.keys().size());
    }

result:

uuid
uuid
2
pseudo hazel
#

well yeah it is

eternal oxide
#

use a single string

pseudo hazel
#

you both use an arraylistmultimap

#

so its gonna do the same thing

eternal oxide
#

String key = "uuid";
map.put(...

blazing robin
pseudo hazel
#

the list part is just about the implementation thats different

#

idk

#

i dont know the difference

#

just use a normal multimap

eternal oxide
#

map.put("UUID"
map.put("UUID"
two different keys

pseudo hazel
#

also a different approwch is just to create a cookingroom and add a cooking type and uuid in that class

#

and then just have a list of rooms

dawn valley
#

Hey guy can anyone help pls ? i am trying to make a plugin that makes item invisbible when held in hand using packets protocole lib but its not working i have no idea why
here is me code
https://mclo.gs/2I5YiJS

nova notch
#

I may be wrong but wouldn't that be a client side thing and therefore not be able to be modified with packets?

silver robin
acoustic pendant
#

Hey, does someone when did the way on making custom enchantments change?
I found a resource from january this year but don't think it works for my version (using 1.20.1)

#

I'm looking on how to do it but don't know if I should check a 1.15 guide

silver robin
#

custom enchantments in what sense?
if you add some nbt tags to a tool (pickaxe) and then listen to events (block break) in which you check if that tool is enchanted with whatever, and if so, then you do some crazy stuff, the version shouldn't matter
if you want to put enchantments into bukkit's registry, then it's a bigger deal

acoustic pendant
smoky anchor
#

Custom enchantments will probably change a bit with 1.21 (since enchantments are now data not code)
There may be a better way to do them then all the ways before.

lean pumice
sleek estuary
#

its possible check if player is with a worlddownloader mod?
if not send nothing on join server (worddownloader modified)

smoky anchor
quaint mantle
#

Proxy

sleek estuary
#

mod for forge

smoky anchor
#

iirc you can somehow query the mods
or they are sent when joining a server

smoky anchor
#

If I recall correctly

sleek estuary
#

How do I get the mods? Just change the name

#

and bypass

smoky anchor
#

well ye
you have no guaranteed way of fully blocking ppl
how do you think hacked clients exist

#

you can maybe block the normal user

chrome beacon
#

What the client can see they can save

#

There's nothing you can do about it

brisk estuary
#

Does anybody here use WSL? (linux subsystem for windows)

chrome beacon
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

sleek estuary
#

that is the problem

upper hazel
#

i have problem were i can find HoloBroadcast api

#

i was not found this in internet

shadow night
#

You sending the world to the player anyways

#

If somebody reallly wants to download ur world they could as well just write a script to intercept packets and recostrunct the chunks from that

smoky anchor
upper hazel
#

By the way, I was interested in 1 point. How do servers filter banned mods? Through anti-cheat?

shadow night
#

Doubt anything can really prevent it, maybe if you filter out what you send to only be what the player can see, but that's too much effort and too inefficient for a price too low

upper hazel
#

but technically the anti-cheat allows you to do this without allowing the player to fly in survival mode, for example

shadow night
#

But it doesn't intercept packets, it just communicates by itself I think