#help-development

1 messages · Page 195 of 1

sterile token
#

Why?

fluid river
#
@EventHandler
public void onPickup(PlayerPickupItemEvent event) {
    Item item = event.getItem();
    if (item.getItemStack().getType() != Material.CARROT_ON_A_STICK) return;
    Player near = null;
    for (var entity : item.getNearbyEntities(1, 1, 1)) {
    if (!(entity instanceof Player player)) continue;
    if (near == null) {
        near = player;
        continue;
    }
    if (player.getLocation().distanceSquared(item.getLocaiton()) < near.getLocation().distanceSquared(item.getLocation())) near = entity;
    }
 }```
echo basalt
#

The amount of nesting and unecessary checks just to get the closest player to a location

sterile token
#

I would just make a custom user object, based on their uuid and then add a properties to that object

sterile token
echo basalt
#
private Entity getNearestEntity(Entity source, double minRange) {
  Entity result = null;
  double resultDistance = minRange*minRange;

  for(Entity other : source.getNearbyEntities(minRange, minRange, minRange)) {
    double distanceSquared = other.getLocation().distanceSquared(source.getLocation());

    if(distanceSquared < resultDistance) {
      resultDistance = distanceSquared;
      result = other;
    }
  }

  return result;
}
#

Player PDC is a thing

sterile token
echo basalt
#

sounds like a you problem

fluid river
#

true

wet breach
#

technically players have always had variables

fluid river
sterile token
fluid river
#

but without external distance variable

echo basalt
sterile token
brittle fjord
#

Hello, I'm trying to create a "god entity" for our server. We would like to be able to type into the chat as the god entity. Is there a way to type into chat as some other alias other than yourself and is it possible to create a script where this god entity would have a conversation with some other entity in chat? Feel free to ask more questions if somethings unclear

sterile token
#

And now im having amazing zip issues with maven

echo basalt
#

only differences between 1.8 and 1.19 are:

  • no magic values anymore (1.13)
  • sendTitle and bossbar api
  • PDC
  • easy nms
eternal oxide
fluid river
sterile token
#

U were talking about that before

fluid river
#

you can send messages to players who pass near your entity

cobalt thorn
eternal oxide
#

if you are including zipped files in your jar you must include them unfiltered ie.```xml
<resource>
<directory>resources</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
</includes>
</resource>

        <resource>
            <directory>resources</directory>
            <filtering>false</filtering>
            <includes>
                <include>*.nbt</include>
            </includes>
        </resource>```
brittle fjord
fluid river
#

just use player.sendMessage("[God] Hello");

kind hatch
fluid river
#

i changed the code

sterile token
fluid river
#

bro what

#

player.sendMessage

#

just send player a plugin message

woven tide
kind hatch
fluid river
#

probably

sterile token
#

idk there was a guy asking that

fluid river
#

it can't have any playername

#

it's sent by plugin

sterile token
#

What could be? File data/regions.yml could not be reloaded. Reason unacceptable code point '' (0x0) special characters are not allowed in "'reader'", position 0

#

And the file is empty that the best part

#

🤦‍♂️

fluid river
#

@cobalt thorn is it working now

#

with changed code

eternal oxide
sterile token
#

i dont think there is anything in it

tardy delta
#

pass it thro yamllint

sterile token
#

ok

tardy delta
#

its a site btw

sterile token
#

ohh lmao

#

i thought it was smth like jUnit

#

🤣

sterile token
#

But the file is empty

#

Doesnt have any content

#

🤔

#

how would i pass it thru there if its empty?

#

Doesnt make sense

tardy delta
#

idk ctrl a it and press delete or smth

sterile token
#

I mean im just loadingan empty file

#

Fucking spigot file system that is what i can say haha

brittle fjord
tardy delta
#

snakeyaml isnt related to spigot afaik

sterile token
#

I mean also the host where im testing, doesnt even allow me to open the file

#

😂

#

Im trying to open it via the ptedactyl file system and doesnt allow me to see the content

#

So smth weird in the file

eternal oxide
#

delete it and make a new file

#

as its empty

sterile token
lilac cobalt
#

I'm getting the error message "Unhandled exception executing command" and I can't figure out what's causing it. Is there something wrong with my formatting here?

  hotpotato:
    description: kill command
tardy delta
#

?paste whole stacktrace

undone axleBOT
sterile token
lilac cobalt
tardy delta
#

paste the whole error thing so we can see

lilac cobalt
#
[12:15:45 INFO]: TheWendigo_ issued server command: /hotpotato
[12:15:45 ERROR]: null
#

Did you mean everything below this? Because i'll flood the chat lol

sterile token
lilac cobalt
#
org.bukkit.command.CommandException: Unhandled exception executing command 'hotpotato' in plugin HotPotato v1.0-SNAPSHOT        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:916) ~[paper-1.19.2.jar:git-Paper-232]
        at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.2.jar:git-Paper-232]
        at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.2.jar:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:305) ~[?:?]
        at net.minecraft.commands.Commands.performCommand(Commands.java:289) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2294) ~[?:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
        at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-232]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.2.jar:git-Paper-232]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-232]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-232]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-232]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.2.jar:git-Paper-232]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.2.jar:git-Paper-232]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-232]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
        at me.jacky.hotpotato.HotPotato.onCommand(HotPotato.kt) ~[HotPotato.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        ... 23 more
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:177) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:124) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
        at me.jacky.hotpotato.HotPotato.onCommand(HotPotato.kt) ~[HotPotato.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        ... 23 more
fluid river
#

Caused by: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics

#

bro what

tardy delta
#

java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics

#

kotlin :/

fluid river
#

you coding minecraft plguins on kotlin

lilac cobalt
#

Yee

fluid river
#

why

lilac cobalt
#

Legitimoose

eternal night
#

you'll have to shade the kotlin standard library

fluid river
#

are you sure

#

that you added kotlin lib

#

and blah blah blah

sterile token
#

oh koltlin 🤢

lilac cobalt
#

Koltin is bad?

sterile token
lilac cobalt
#

Reminds me of lua, which I'm very familiar with

sterile token
#

I just like the syntax from C#, Java and TS

sterile token
tardy delta
#

kotlin is a very funny language

#
private fun doSomething() {}```
lilac cobalt
sterile token
tardy delta
#

you have to shade the kotlin library, meaning including it at runtime and not only at compiletime

lilac cobalt
#

I don't know what that means

sterile token
#

Like how the lang works (atleast the basic and important things) and many other things

lilac cobalt
#

I'm moving from data packs to plugins now because of how annoying they are to work with lol

sterile token
#

Wait dont comapare JavaScript with Java, they are not similar but now because you know javascript means you cant code directly into Java

#

Its a common mistake done by lot of people

dry forum
#

if i wanted to make a bungee plugin do i need to use a database? or can i just use files like a regular plugin

kind hatch
#

If you want to share data between servers, use a database. Otherwise, you can just rely on the local databases that your plugins provide.

dry forum
#

i just need to allow commands to be used in all servers and store based on that, so that would be fine?

sterile token
#

If you want to make global commands and dont want to mess with a spigot plugin on each sever, bungee is perfect

#

So in your case a Bungee plugin will be the best option and you can either use flatfile or database storage

dry forum
#

ok thanks

sterile token
#

Because bungee commands can use on every sever and you dont need to sync the storage, meaning that if u do a spigot plugin u will have to sync the storage

wet breach
#

if its data that needs to be stored, this works

#

but if its data that doesn't need to persist, better off just using sockets

honest badge
#

any way to check which entity launched a projectile using projectile launch event?

wet breach
#

it should have a method to see shooter?

#

think its getShooter() or something to that effect

native ruin
#

event.getentity or somth

honest badge
#

that returns the projectile

wet breach
#

wel getEntity gets the projectile

honest badge
#

according to the docs

native ruin
#

getshooter?

#

getentity.getshoother

wet breach
#

there it is

honest badge
#

thanks

native ruin
#

is there an event of some sorts that triggers when you look at another entity?

#

or a way to do something like it

#

without having to loop through every playre every tick

honest badge
#

maybe theres something in the location data?

#

not 100% sure tho

wet breach
#

you could use the playermove event

#

and then from there trigger a timer to activate a task to loop through players that are not moving

#

to see where they are looking

#

once they start moving again, halt the task

native ruin
#

i can't use that for its purpose

wet breach
#

not sure why you couldn't

quaint mantle
#

hello, I'm creating a core for a skyblock .... I want to create an island that is not already occupied by another island, what do you recommend? use external plugins? if so, which ones?

native ruin
wet breach
#

I never said to cancel the event

#

you can just simply use it because it is always ran

#

anytime they stop moving, which doesn't cause a playermove event to happen

#

you have a task to fill that gap

#

but since players are moving constantly you shouldn't have many tasks 🙂

native ruin
#

hmm like taht

#

yea ill go look into it

#

thanks

quaint mantle
fluid river
#

?di

undone axleBOT
eternal oxide
#

passing a ThreadPool as an executor its never going to end

#

you are running it on every executor, which gets renewed

bright cedar
#

Hey, how could I bump a player 100 blocks in the direction he is looking ?

wet breach
#

make them hover a bit off the ground and change their velocity to 100 in the direction

#

and they will zoom away

bright cedar
#

Yes but I don't know how to do that

wet breach
#

fun fact if you could slow the server down, when players teleport they just run really really fast

round finch
#

java guava looks so complicated e_joedead

analog folio
#

Hey does the BlockSpreadEvent also apply to water?

chrome beacon
#

?jd-s

undone axleBOT
analog folio
chrome beacon
#

ah

#

then yes I believe it does

analog folio
chrome beacon
#

What do you need to detect water spread for?

analog folio
#

Like for 4 Blocks

round finch
#

code [software / extensions] for clean and suggestions?

rough oriole
#

Hello, im having a little problem, im using spigot 1.19 and when Someone equip something in the shield slot they can not unequip it, does anyone know if this is a Vanilla bug?

chrome beacon
#

Probably a plugin

nimble lichen
#
            val packetContainer = protocolManager.createPacket(PacketType.Play.Server.ENTITY_DESTROY)
            packetContainer.integers.write(0, 1)//size of entities array
            packetContainer.integerArrays.write(0, intArrayOf(event.entity.entityId))

I get "Field index 0 is out of bounds for length 0" on both write lines. What am I doing wrong? (ProtocolLib)

#

It's Kotlin but everything works the same

chrome beacon
#

Are you sure that's the correct packet format?

nimble lichen
#

I've tried not setting the count value

#

both lines make it seem like I shouldn't write to those places

chrome beacon
#

Is there a reason why you can't use the api

nimble lichen
#

which api

chrome beacon
#

Spigot

nimble lichen
#

version compatibillity

#

You mean nms?

chrome beacon
#

No

nimble lichen
#

how would I hide an entity from a player using spigot api

chrome beacon
#

?jd-s

undone axleBOT
chrome beacon
#

1 sec

nimble lichen
#

I've already looked and I personally couldn't find anything. Perhaps something new that I dont know of like attributes ?

nimble lichen
#

o

#

its in the player class

#

thx!

chrome beacon
#

It's quite new

#

So you might still have to use packets for older versions

nimble lichen
#

no this is perfect

#

thanks!

grim oak
#

How could i make a larger array from 2 smaller arrays, for example like this:
ItemStack[] updatedItems = { oldItems, newItems }; but ofc that doesnt work, how else would i do it

fresh timber
#

I am trying to turn a player's gamemode to adventure when they join and I have some very strange problems. I have this code and it uses player.setGameMode(GameMode.ADVENTURE). This only works when the player is in a rank (on my luckperms permissions plugin) that has the permission *. If they are OP it also does not work. I have some Sysouts to test and right after I set their gamemode, I print their gamemode and it says their gamemode is ADVENTURE although when they join the server, they are in survival. If the player is in a rank with perm*, however; it does set their gamemode to adventure. The gamemode in server.properties is adventure and force-gamemode is set to true. If anyone could help me with this that would be amazing, I just can't seem to figure it out.

@EventHandler
public void onJoin(PlayerJoinEvent event) {
    System.out.println("1");
    Player player = event.getPlayer();
    System.out.println("2");
    UUID pUUID = event.getPlayer().getUniqueId();
    System.out.println("3");
    final Location location = new Location(Bukkit.getWorld("hub"), -0.5, 65, -0.5);
    System.out.println("4");
    player.teleport(location);
    System.out.println("5");
    player.setGameMode(GameMode.ADVENTURE);
    System.out.println(player.getGameMode());
    if (player.hasPermission("wildgames.fly")) {
        player.setAllowFlight(true);
        player.setFlying(true);
    }
    System.out.println("7");
    BuildModeMap.remove(pUUID);
    System.out.println("8");
    player.getInventory().clear();
    System.out.println("9");
    ItemStack item1 = new ItemStack(getItem(new ItemStack(Material.ENDER_EYE), "§a§lGame Selector", "§7Click to open the Game Selector (/gameselector)"));
    System.out.println("10");
    Inventory inv = player.getInventory();
    System.out.println("11");
    inv.setItem(4, item1);
    System.out.println(player.getGameMode());
    player.getInventory().setHeldItemSlot(4);
}
drowsy helm
#

Use a runnable and delay it a tick

fresh timber
#

hm

#

do I do that in the onEnable or in the class?

#

like when I register the listener

drowsy helm
#

In the event handler

fresh timber
#

ok

drowsy helm
#

Just since it’s player join it might be iffy

fresh timber
#

yea

#

wait what do I put for the second input of .runTaskLater

grave plover
#

First the javaplugin, then runnable, then delay in ticks

fresh timber
#

hm ok

quaint mantle
#

would there be a better way of doing this

#
public void enchant(Location loc1, Location loc2) {

        double minX = Math.min(loc1.getX(), loc2.getX());
        double minY = Math.min(loc1.getY(), loc2.getY());
        double minZ = Math.min(loc1.getZ(), loc2.getZ());
        double maxX = Math.max(loc1.getX(), loc2.getX());
        double maxY = Math.max(loc1.getY(), loc2.getY());
        double maxZ = Math.max(loc1.getZ(), loc2.getZ());

        for (int x = (int) minX; x <= maxX; x++) {
            for (int y = (int) minY; y <= maxY; y++) {
                for (int z = (int) minZ; z <= maxZ; z++) {
                    if (!mats.contains(loc1.getWorld().getBlockAt(x, y, z).getType())) continue;
                    setBlock(x, y, z, Material.AIR, loc1.getWorld());
                }
            }
        }
    }```
#

optimization wise

thorny marsh
#

Hey sorry but i got a question. When will a block get maximum level?

fresh timber
# drowsy helm Use a runnable and delay it a tick

I tried this and I'm still getting the same errors:

    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        Bukkit.getScheduler().runTaskLater(WildGamesHub.getInstance(), () -> {
            System.out.println("1");
            Player player = event.getPlayer();
            System.out.println("2");
            UUID pUUID = event.getPlayer().getUniqueId();
            System.out.println("3");
            final Location location = new Location(Bukkit.getWorld("hub"), -0.5, 65, -0.5);
            System.out.println("4");
            player.teleport(location);
            System.out.println("5");
            player.setGameMode(GameMode.ADVENTURE);
            System.out.println(player.getGameMode());
            if (player.hasPermission("wildgames.fly")) {
                player.setAllowFlight(true);
                player.setFlying(true);
            }
            System.out.println("7");
            BuildModeMap.remove(pUUID);
            System.out.println("8");
            player.getInventory().clear();
            System.out.println("9");
            ItemStack item1 = new ItemStack(getItem(new ItemStack(Material.ENDER_EYE), "§a§lGame Selector", "§7Click to open the Game Selector (/gameselector)"));
            System.out.println("10");
            Inventory inv = player.getInventory();
            System.out.println("11");
            inv.setItem(4, item1);
            System.out.println(player.getGameMode());
            player.getInventory().setHeldItemSlot(4);
        }, 1);
    }
fluid river
#

if (data.getLevel() == data.getMaximumLevel())

errant snow
#

Can anyone think of a reason why some methods would only get the initial value of a variable (upon class instantiation), but other methods can change it and get the new correct value without issue

#

I'm going crazy over this

thorny marsh
raw prairie
#

@eternal oxide

#

Dammit

fluid river
#

i guess weird design patterns are the reason

errant snow
#

page is the problem child, in the increment method i'm just adding 1 to it, both messages print the correct value of page

private var page = 1

fun increment() {
    Chat.broadcast("&cIncrement page before: $page")
    page += 1
    if (page > pages.size - 1) page -= 1
    Chat.broadcast("&cIncrement page after: $page")
}

This is the problematic method render, it also uses the exact same page variable, it's in the same class and everything, but no matter what the page variable is set to it only reads the initial value of 1, all of the print messages also show 1

override fun render(inventory: Inventory) {
    if (preCheck()) return

    Chat.broadcast("Pages size: ${pages.size}, Rendering page $page")
    pages[page].render(inventory)
    Chat.broadcast("Rendered page $page")
}
#

Some sample output

#

The expected output would be the white messages show the latest value of page, the value printed in "Increment page after: <num>"

#

I can't for the life of me wrap my head around it, I tried changing the initial value of page to 0 and the render method uses 0 instead, but it never gets the accurate value of page

fluid river
#

you mean you are rendering page 1

#

but should render page 12

#

on the screenshot

#

your increment and render have no connection tho

#

paste the whole class

fresh timber
errant snow
#

the increment and render methods are called outside of the class, but they both access the same variable, or at least they should

#

I checked the compiled java code just to be sure there isn't a weird issue there, but there aren't any discrepancies that I noticed

echo basalt
#

I mean

#

there are some ways you can optimize it

#

but it's really specific and depends on how big the volume is

quaint mantle
#
  • like 30 players
#

So around 18k loops every 2 seconds

#

Which i dont like

echo basalt
#

You could... make a weird queue and process chunk snapshots async instead

quaint mantle
#

My set blocn function is rock solid but the looping on the other hand, i could make a different thread, but again. Thats like 18k threads which isn't good either

echo basalt
#

thread pool

quaint mantle
#

True..

quaint mantle
echo basalt
#

Let's start with a queue / deque of the locations to be broken

#

Which should be concurrent so we can add in 1 thread and loop in another at the same time

#

You can use synchronized blocks or just look for a concurrent queue implementation

#
Deque<Location> breakableLocations = new ConcurrentLinkedDeque<>();
quaint mantle
#

Okay..

echo basalt
#

and either break like 50k blocks per second (random number) or limit it to a ms/t variant

quaint mantle
#

Sorry looking up deque because i actually haven't used it before

#

So would i loop the deque?

echo basalt
#

Variant A:

private static final int BLOCKS_PER_TICK = 50000;

public void processQueue() {
  int iterations = 0;
  
  while(iterations < BLOCKS_PER_TICK && !breakableLocations.isEmpty()) {
    Location location = breakableLocations.pollFirst();
    ...
  }
}

Variant B:

private static final double MAX_MILLIS_PER_TICK = 15;
private static final int MAX_NANOS_PER_TICK = (int) (MAX_MILLIS_PER_TICK * 100000);

public void processQueue() {
  long endTime = System.nanoTime() + MAX_NANOS_PER_TICK;

  Location next = null;
  while(System.nanoTime() <= endTime && (next = breakableLocations.poll()) != null) {
    next...
  }
}
#

run processQueue sync on each tick

quaint mantle
#

Okay i see, where would i put this or do i need to implement anything?

echo basalt
#

So now we have the structure to:

  • Add elements concurrently to a list, that-
  • Get processed sync, on the next thread, without ever having TPS drops
quaint mantle
#

I can see me using this alot

echo basalt
#

And now we need to:

  • Create a snapshot, process it on the thread pool, and populate the deque
#

This is just a dumbed down version of

quaint mantle
#

Lol

echo basalt
#

fuckin ell

#

this

quaint mantle
#

Okay awesome

#

I'll check this out, thanks

echo basalt
#

I wonder what 7smile7 is up to

#

haven't seem him in a while

quaint mantle
#

Me neither

quaint mantle
#

Mhm

dry forum
#

how can i schedule something to run in x seconds using bungeecord? ive only found how to do it every x seconds

pearl glade
# quaint mantle Mhm

why don't you update the chunk?, it will be much faster than updating block by block

radiant umbra
#

Hello, does anyone know how i can convert a skull value to a skull url?

echo basalt
#

pretty sure

#

the stull value is just a base64 serialized json tag that contains the url

quaint mantle
#

Like what do i add to my code already to make the deque and all that work

#

I probably missed something in the tutorial

#

Oh, i kinda see how he did it in the github

worldly ingot
#

There was no particle API in 1.8

#

So... no.

#

In 1.9 (and even present day) you can spawn particles via Player or World, the latter being for any nearby players

quaint mantle
#

Packets? 🤷‍♂️

worldly ingot
#

Yes

quaint mantle
#

Yep

worldly ingot
#

There was a popular library back in the day. Forget who it was that made it

#

Darkbladde13, that's the guy

#

You basically just copy/paste those two classes into your project and use that as the API. Though really, you should just be updating to a version that isn't 7 years old

quaint mantle
#

Easy fix, dont use 1.8 🤯

dry forum
#

run once in x seconds - bungee

golden turret
#

how do I set a custom block in the world

#

how do I set in the world now

fluid river
#

?

#

you just take a world, take a location

#

and set the type to what you need

#

and then apply blockdata

#

if that's for plugin tho

golden turret
#

you missed the custom block part

fluid river
#

what makes your block custom tho

#

it has NMS part?

#

or just block data

golden turret
#

nms

fluid river
#

i guess you need CraftWorld or what is it rn

#

NMSWorld

#

and BlockPosition

#

and then IBlockData

golden turret
#

ik

#

i want to know how to create the blockdata

hasty prawn
#

You can't set custom blocks like that

#

Or, you can't make them like that at all.

#

The client would have absolutely no idea what you're doing

fluid river
#

NMS World should have methods for setting blocks

golden turret
fluid river
#

with light update and info sending

hasty prawn
#

I mean maybe? No idea how the client would respond honestly. You for sure can't change the texture of it.

#

Not like that anyways you can't

fluid river
#

performs light update and stuff

#

but idk what is used in 1.19

stuck flax
#

Does Material.WHEAT represent both the block and item?

fluid river
#

this is for older version

atomic swift
#

EntityDeathEvent including players?

fluid river
fluid river
#

it even has blockdata ageable

stuck flax
#

aight, ty

atomic swift
#

is there a mob deathevent

fluid river
#

you have PlayerDeathEvent

atomic swift
#

ik

fluid river
#

no need for entity i guess

atomic swift
#

i need entity

fluid river
#

alr

atomic swift
#

but i also want player

stuck flax
atomic swift
#

will this work if (event.getEntity() instanceof Player) {

remote swallow
#

Should do

atomic swift
#

also does EntityDeathEvent get what the entity died by?

#

bc it doesnt look like it

glad prawn
atomic swift
remote swallow
#

Whats a mob, its an entity

south snow
#

Hey! I'm not entirely sure if this goes here but I'm looking for someone to help me create a really simple minecraft plugin, I can do graphic design and I already have the concept designed, I just need someone to do the coding, and modeling message me if you're interested!

remote swallow
#

?services

undone axleBOT
golden turret
#

at least I am in the right way

south snow
fluid river
golden turret
#

fixing it

fluid river
#

maybe you need uppercase AIR

#

LOL WHAT

#
System.out.println("J\u0061va".charAt(1));```
#

prints a

#

cuz \u0061 is a

#

and charAt 2 is v

#

so all chars from \ to 1 are one char

golden turret
quaint mantle
#

Woah

golden turret
#

now i just need to fix some exceptions

dreamy dove
#

Hey guys I try to use the Set Block Destroy Stage packet with Protocollib and I was wondering what Packet Type I should use for it I mean PacketType.Play.Client is obvious but what to use after that? I tryed PacketType.Play.Client.BLOCK_DIG but this wasn't working for me. Anyone know what to use instead?
https://wiki.vg/Protocol#Acknowledge_Block_Change

worldly ingot
#

(just so you're aware, there's API for this)

ocean ginkgo
#

how should I go about getting the players mouse direction 10 ticks ago? ik how to get mouse direction but cant figure out how to do the 10 ticks ago part. ik schedulers alr

mighty pier
tranquil ferry
#

someone help me psl

round finch
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!

dense fjord
#

Ok so i started learning java and i tried making a simple fly plugins

#

But

#
package org.bukkit.command;

import org.jetbrains.annotations.NotNull;

/**
 * Represents a class which contains a single method for executing commands
 */
public interface CommandExecutor {

    /**
     * Executes the given command, returning its success.
     * <br>
     * If false is returned, then the "usage" plugin.yml entry for this command
     * (if defined) will be sent to the player.
     *
     * @param sender Source of the command
     * @param command Command which was executed
     * @param label Alias of the command which was used
     * @param args Passed command arguments
     * @return true if a valid command, otherwise false
     */
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args);
}

#

Yes

#

i cant edit it

#

and

#

It sasy cant resolve symbol NotNull and jetbrains

#

what do?

fluid river
#

bruh

#

dm me

#

you don't need to use commandExecutor itself

#

and @NotNull annotation from jetbrains should be in your IDE already

#

shit

tall dragon
#

yea that guy is popular

#

😮

fluid river
#

tagging him for 10th time already

tall dragon
#

woops

#

sorry ahaha

#

why the frik it even do that

fluid river
opal juniper
#

i’m pretty certain that they aren’t in the jdk

fluid river
#

yeah i meant IDE

#

just shot my leg when said JDK

frail gale
#

Hey guys

#

does someone know if there’s a way I can view all my Java Compiled Classes size? If there’s a program to view your classes size?

fluid river
#

why don't you just look inside the jar

frail gale
#

Yeah this is a way too

fluid river
#

to see size of each .class file

#

or if you don't have winrar

#

go to the folder with your .java file

frail gale
#

imagine you don’t have WinRaR in Windows it has a Infinity Free Trial

fluid river
#

and run javac YourClass.java in powershell in that folder

#

it will compile your code and generate .class file for you

frail gale
#

yeah that’s good thanks but also is there a way to see each line of your code how much size it takes?

fluid river
#

it's useless

#

java compiler turns it to another line anyways

tall dragon
#

yeaa its turned into bytecode

fluid river
#

i mean

frail gale
#

that’s for sure yea

tall dragon
#

you could do a heapdump on your program to view object size though

#

thats usefull

fluid river
#

java compiler simplifies your for(string s : list)

#

to for(int i = 0; i < list.size(); i++)

tall dragon
#

well ur making a spigot plugin right?

#

you could download the plugin spark

#

to generate a dump for you

frail gale
fluid river
#

not as actual file

tall dragon
fluid river
#

idk if he wants that

tall dragon
#

but as actual file is not really relevant

fluid river
#

is there even a reason to check your class file size

tall dragon
#

i cant think of one. but eh

fluid river
#

like it's gonna be something around 1kilo or 50kilo

#

no other options

#

or it's super small

#

or it's super giant

tall dragon
#

cough Material class

#

cough

fluid river
#

yeah we are all rewriting Material class

#

here on spigotmc

frail gale
#

My Plugin’s size for right now is 150KBs

fluid river
frail gale
#

and I want to find a way to reduce it if I can

fluid river
#

i guess you just have spaghetti

#

boilerplate

tall dragon
fluid river
#

a lot of repeating code

tall dragon
#

could look that up

fluid river
frail gale
#

I mean it will be really big plugin

#

Maybe the size is bigger because it has a lot of Utils classes

fluid river
#

we didn't see it

#

use winrar

#

or well

frail gale
#

yeah I’ll do that

fluid river
#

you can write a program

#

in java

#

give it a folder

#

it will loop through all files in the folder

#

and sysoutprintln their size

#

🙂

frail gale
#

that’s also good idea

fluid river
#

i bet half of spigotmc don't know how to write main method in java

tall dragon
#

u legit just have to type "main" and click enter

fluid river
#

trueeee

#

same as i always use sysout and eclipse autocompletes it to println for me

tall dragon
#

for entellij enjoyers ofcourse

frail gale
fluid river
tall dragon
#

i have no idea bout that

#

i got eclipse once

#

threw it away after 1 hour

fluid river
#

for intellij it's sout i guess

frail gale
fluid river
#

it's too much for me

tall dragon
#

eh its perfect for me

fluid river
#

i guess i'm average asceticism enjoyer

#

eclipse is like super lightweight

#

install archive unpack to folder run and forget

tall dragon
#

i do agree that testing standalone programs on eclipse is way faster

#

idk how tbh

#

they dont recompile or something

fluid river
#

well afair IntellIJ has option to download JDK for you

#

or is it VS Code

fierce whale
#

Is there any way to get name of inventory in InventoryCloseEvent
I can't find that method 😦

Please help me..

fluid river
#

inventory.getView().getName()

#

i guess

vocal cloud
#

Intellij may use 8GB of memory at all times but it's got a lot of fun stuff under the hood that makes it worth it

frail gale
fluid river
#

which is not in eclipse

vocal cloud
#

Better refactoring,easy integrated JDKs, integrated database support with automatic SQL query detection in strings. I could go on forever. I used to use eclipse and thought I hated java. Turns out I just hated eclipse.

fluid river
#

Eclipse also provieds integrated jdks

#

but i still prefer downloading manually

#

database support is part of JDBC

#

not IDE

vocal cloud
#

Not sure if eclipse can but intellij can search comments and strings when refactoring. That with the ability to refactor a variable across the entire project is really nice.

#

Database support means I don't need a separate application to do anything related to the database. I can create,update,view,delete tables in-house without the need for a program or tests. I can run queries and everything else as well

frail gale
#

One thing I really hate in Eclipse is for example if you want to have IntelliJ Auto-Completion there’s no good way to have it

frail gale
#

For example in Eclipse you add all the keybinds to AutoCompletion and after that when you type it’s good right yeah but when declaring a new variable and adding “;” at the end it changes the name to the suggested one which is very annoying

vocal cloud
vocal cloud
#

I mean I have complete control over a db

#

I don't need 3rd party software to do anything

fluid river
#

eclipse have autocompletion

#

highly configurable

#

same as intellij

tall dragon
frail gale
fluid river
#

oh you mean that

frail gale
#

no need to Ctrl Space or hit “.”

fluid river
#

i hate it tho

#

as i said

vocal cloud
frail gale
#

When I used IntelliJ Idea I really liked it

fluid river
#

average ascetism enjoyer

#

same as when i coded for c and c++

vocal cloud
#

Works on every modern db though

fluid river
#

well i host db manually

frail gale
#

I tried to implement it in Eclipse but it wasn’t perfect and I removed it

fluid river
#

Postgre ❤️

vocal cloud
#

Dude it's not about hosting

frail gale
#

both IDEs are good I will say

vocal cloud
#

It's about control

fluid river
#

wdym control

#

you just do a statement

#

CREATE TABLE IF NOT EXIST

#

done

frail gale
#

I like them both and I will try to use them both

vocal cloud
#

You can store all of it in intellij rather than needing external software

fluid river
#

all of what

#

the only external software i have is PostgreSQL

vocal cloud
#

SQL, ideas, etc.

fluid river
#

For like creating dbs for me

vocal cloud
#

It's all within the ide

#

Intellij is superior in features

#

Doesn't make eclipse bad

fluid river
#

well yeah IntellIJ has more features

#

but from what i can see some features are just implementations of external things

#

if i would develop an ide i would only add maven/gradle and git support

#

dark theme and auto-complete on hotkey

#

nothing else

vocal cloud
#

Well yeah, but productivity-wise that's never going to fly

fluid river
#

i mean these are the only things i use in eclipse

#

and i don't really need anything else

#

git support just highlights classes with blue to show that they are changed but changes are not commited yet

#

maven support is like default

#

dark theme is necessary

vocal cloud
#

Sure, you don't need it but it'd be nice to have

fluid river
#

well i'm not fan of integrated external things

vocal cloud
#

You're the odd one out

fluid river
#

guess just my experience wants me to learn software

#

which would probably be on the job

#

so now i know Postgre

#

Some git commands

#

some linux commands

fluid river
vocal cloud
#

Intellij as pretty much all the features of desktop built in as well lmfao

#

You don't need to switch applications to handle that

fluid river
#

and well eclipse still eats memory but at least i'm able to run server + minecraft + IDE + browser on my laptop

#

with intellij it just dies 🙂

vocal cloud
#

Yeah, but that's cause your dev environment is on the low end.

fluid river
#

some of the features of intellij are just in running state even if i don't use them

vocal cloud
#

Causal 6GB KEKLEO

fluid river
#

my laptop has 8

#

well my pc has 16 but i have eclipse there too

vocal cloud
#

I'm using it for rust rn with the linter on constantly so it eats ram

fluid river
#

linter?

vocal cloud
#
Lint, or a linter, is a static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious constructs. The term originates from a Unix utility that examined C language source code.
fluid river
#

umm

#

i guess every ide flags errors?

vocal cloud
#

Yeah, but with Rust I use an external linter

#

and that uses more memory

fluid river
#

🙂

vocal cloud
fluid river
#

the best option i found in eclipse

#

is own code formats

#

by default if you have one-line if action it still goes to the next line

#
if (a)
    b();```
#

but i changed it to java if (a) b();

vocal cloud
#

That's different lol but okay

fluid river
#

wdym?

#

that's exactly the same

vocal cloud
#

You're talking formatter I'm talking linter

fluid river
#

i said

#

not connected to linter

#

when i typed linter in browser it gave me russian database ЛИНТЕР(LINTER) hehe

vocal cloud
#

Yeah, but that's a universal thing. Every basic tool has that

fluid river
#

yeah, but the simplicity of it is just 🔥

vocal cloud
#

Yeah, works the exact same on Intellij

fluid river
#

like through VS code, VS, IntellIJ, Eclipse i find eclipse most lightweight in size, small in RAM and fast in executing what i need

#

small features list just makes it easier to find option you need

vocal cloud
#

Yeah, as I said before. Eclipse is fine it just lacks a lot of features that I use in intellij

fluid river
#

and execution is hella fast

#

tho there is one thing which i don't understand in intellij

vocal cloud
#

I mean higher learning curve intellij means that eventually you'll know enough that small feature list becomes irrelevant

fluid river
#

why can you only work with one project in one tab

#

i dislike it

vocal cloud
#

You can have multiple

fluid river
#

when you open a project there is a window

#

Open new tab

#

or open project in existing tab

#

which is iirc closing your current project

#

and switching to one you selected

#

like that's so nice that when i'm creating a new plugin i can just open one random plugin i coded before

#

and copypaste pom.xml contents

#

i guess main reason why i'm in eclipse

#

is that i prefer copypasting over coding

vocal cloud
#

Well if you spend most of your time copypasting lmfao

#

you can open multiple in intellij too I just don't cause that's messy

jagged monolith
#

The only real multi-project support Intellij has is if you're adding other projects as modules to one over-arching project.

vocal cloud
#

Yeah, but imo it's fine because each project should be it's own window

jagged monolith
#

Otherwise, you'll need to use different windows.

fluid river
jagged monolith
fluid river
vocal cloud
#

Unless you're a coder who uses a lot of bad practice it shouldn't be that big of an issue

fluid river
#

so it closes all of the project's tabs

#

and doesn't check it's errors/warnings

jagged monolith
#

Each to their own really. Intellij and Eclipse both have their good and bad. It really comes down to use case and personal preference.

fluid river
#

i guess it comes more to pc specs

frail gale
#

@fluid river Do you know a good Decompiler plugin for Eclipse?

fluid river
#

i guess good is not to use decompiler

frail gale
#

Decompiler plugin for Java classes

dense fjord
frail gale
#

I want to decompile some NMS

fluid river
#

tho you can just open the class from api

#

if included

vocal cloud
#

Intellij has fernflower happy

fluid river
#

idk never used decompilers

#

except JD-GUI

#

once in my life

frail gale
#

I mean it’s telling me source not found

fluid river
#

maybe eclipse has it

#

maybe not

jagged monolith
frail gale
worn tundra
#

What about JD-GUI

frail gale
#

I have it

fluid river
#

what about not decompiling

frail gale
#

I also have Luyten

#

but I asked for integrated

frail gale
fluid river
#

tho you can just use sources downloaded with buildtools

vocal cloud
fluid river
#

they are all .java iirc

frail gale
vocal cloud
#

Built into intellij FeelsHappyMan

fluid river
#

eclipse has same two buttons tho

vocal cloud
#

Including fernflower

fluid river
#

update project

frail gale
#

Can I customize the IntelliJ UI?

jagged monolith
#

Of course

vocal cloud
#

Depends what you mean by customize but yeah

frail gale
#

I wanna rearrange the buttons

bright cedar
#

Hey, I still don't understand how I can bump a player a 100 blocs forward, can anyone help me please ?

jagged monolith
frail gale
#

you mean teleport them 100 blocks forward?

fluid river
#

ez

bright cedar
frail gale
jagged monolith
frail gale
#

Velocities are cool

#

I think

jagged monolith
#

Haven't mess with them personally haha

frail gale
#

same

bright cedar
#

Yes but I don't know how 😕 I tried to play with velocities but I always push me in diagonal

frail gale
#

You can google some tutorial for Velocities

#

also I can send you a video about a JumpPad Plugin

bright cedar
#

Yes I'd like to please

frail gale
#

the channel is called SyntaxError

#

you can see his videos

#

he has tutorials for plugins with unique ideas

bright cedar
#

Okay thx

frail gale
#

also please don’t skip and copy-paste instead watch the entire video just a tip don’t take is as offending

vocal cloud
#

99% of code tutorials should be text. Can't change my mind

warm mica
fluid river
#

in russian

#

sometimes i link pictures of what's happening

#

but that's console app so not really necessary

brisk estuary
#

i know it's not related to spigot development, but could someone help with c? pm

mighty pier
#

knitter

thorny marsh
#

Do someone know if the blockspreadevent count for water?

fluid river
#

water is BlockFromToEvent

thorny marsh
# fluid river water is BlockFromToEvent

Well i limit the water for x Blocks with the BlockFromToEvent but if the water flow to the ground its spread and the limit dont work for All sides thats why i thought maybe BlockSpreadEvent would help

normal loom
#

Hello guys, is there a way to check if an event is running?
For example let's say you ran a command like "/givespeedtoeveryone" with a speed duration of 5mins, so all online players receive speed, but if a player joins the server after the command is executed does not receive it, how can i check if the event givespeedtoeveryone is still active and give the speed to the player who has logged in?

eternal oxide
echo basalt
#

that's more of a OOP question

vocal cloud
#

Make a cache that contains active effects and their end time stored as a long. When a player joins do the math to determine how long it has left based on that.

echo basalt
#

And data structures

normal loom
vocal cloud
#

When a player joins you check if they've received this exact buff by using a unique id per command usage. If they have not you apply either the full effector if you want it to be based on duration left, you give them the amount left based on a stored expiry time.

normal loom
#

Alright, understood ❤️

eternal oxide
#

a search result 🙂

tender shard
#

using a timer for every cooldown?!

#

that must be a joke lol

eternal oxide
#

I didn;t read it, just searched

echo basalt
#

Would it be possible to make a plugin that uses Unsafe to inject into worldmanager and just make worlds fully thread safe

#

🤔

eternal oxide
#

The timestamp method looks fine

echo basalt
#

then minecraft updates and it breaks everything

tender shard
#

that's why I called the post a joke

#

yeah a runnable only makes sense to show a timer or sth

fierce whale
#

is there any fancy way to serialize custom java Object which contains Bukkit Object?

crimson terrace
eternal oxide
#

and what Bukkit Object?

crimson terrace
#

that too

fierce whale
#

I tried save it into .yml by String

fierce whale
crimson terrace
#

use ConfigurationSerializable

eternal oxide
#

ItemStacks are already serializable

crimson terrace
#

since ItemStack is already that

fierce whale
#

umm..

crimson terrace
#

google

tender shard
#

just do myYaml.set("mylist",myList); lol

fierce whale
#

Is there any tutorial for ConfigurationSerializable?

tender shard
#

the javadocs explain everything you need to know

#

`jd

tender shard
#

?jd

fierce whale
#

I tried to find information about that but It was so hard 😦

#

Okay Thanks I'll tried that

crimson terrace
#

ima send you an example of a ConfigurationSerializable class hold on

fierce whale
#

Oh thanks! 🙂

crimson terrace
#

got like 50 here

fierce whale
#

Wow...

crimson terrace
#

its really useful

#

?paste

undone axleBOT
crimson terrace
#

it implements ConfigurationSerializable at its core

fierce whale
#

Okay really thank you! 👍

crimson terrace
#

the main things are the deserialize and serialize methods, aswell as the @SerializableAs("") at the top

fierce whale
#

Okay I gonna check it right now with document you sent 🙂

tender shard
#
public class Person implements ConfigurationSerializable {
    
    private final String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public Map<String, Object> serialize() {
        Map<String,Object> map = new HashMap<>();
        map.put("name", name);
        map.put("age", age);
        return map;
    }
    
    public static Person deserialize(Map<String,Object> map) {
        String name = (String) map.get("name");
        int age = (int) map.get("age");
        return new Person(name, age);
    }
}
crimson terrace
#

I usually use static final strings for the keys of each attribute, makes it easier to edit

fierce whale
#

Oh I got it thanks for your help!

native ruin
#

does the nether have time ticks like the overworld?

crimson terrace
#

the whole server does

#

thats what times the spreading of lava and water for example

native ruin
#

ok ty

#

oh no i meant day night cycle time

#

but yea

#

the nether doesn't

quaint mantle
#

No

#

It dont

fierce whale
#

I saved custom java object which implements ConfigureSerializable.
But I don't know how to load that object again

I tried to use config.get(path) method but it doesn't work 😢

how to get object from configuration file?

eternal oxide
#

did you register the class?

crimson terrace
#

you can use the deserialize method for that.

crimson terrace
#

best time for that imo is onLoad()

fierce whale
#

yes I registered it
But when I use config.get(path). it invoke deserialize method automagically?

crimson terrace
#

basically. you can do "CustomObject customObject = (CustomObject) config.get(path)"

dreamy dove
fierce whale
#

hmm.. I used that method...

crimson terrace
#

well, did you register the serializable class?

fierce whale
#

yeah I will show you my code

crimson terrace
#

are there any errors in console?

fierce whale
#
public class sertest implements ConfigurationSerializable {
    {
        ConfigurationSerialization.registerClass(sertest.class);
    }
#

ummm... just a moment plz

eternal oxide
#

that won;t work.

fierce whale
#

org.yaml.snakeyaml.error.YAMLException: Could not deserialize object

crimson terrace
#

thats my thought too, should be tthat exact error

eternal oxide
#

it only registers it when you instance the class. You need to register it before accessing the config

crimson terrace
#

use the onLoad() method in your main class

#

override it

fierce whale
#

in main method?

#

onEnable?

crimson terrace
#

main class extends JavaPlugin right?

eternal oxide
#

plugins have no main method

fierce whale
#

yeah

crimson terrace
#

just make a new method onLoad()

#

and put that code there

fierce whale
#

like registering event?

crimson terrace
#

what?

#

you put a new method in the main class

@Override
public void onLoad(){
}

fierce whale
#

Aha

#

Oh I got it!

crimson terrace
#

and register the ConfigurationSerializable class there

fierce whale
#

Okay Let me try

crimson terrace
#

that method is used before the onEnable() method so you can prepare stuff like that

fierce whale
#
    @Override
    public void onLoad() {
        ConfigurationSerialization.registerClass(sertest.class);
    }

Is it right?

crimson terrace
#

yeah

#

that should fix your earlier error

fierce whale
#

Thanks 😀

#

OOHHHHH It works...!
thank you so much! 🙂

crimson terrace
#

🙂

#

dont forget the SerializableAs annotation so you get rid of the path for a class name

#

paths are ugly in config

fierce whale
#

Okay I got it!

quaint mantle
#
@Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player p = (Player) sender;

        NamespacedKey key = new NamespacedKey(Housing.inst, "playerData." + p.getUniqueId() + ".testNum");
        p.getPersistentDataContainer().set(key, PersistentDataType.DOUBLE, 0.0);

        return false;
    }
``` Would this be the correct way to set data for a player?
#

And if I restart the server would it keep this data?

#

I just wanted to make sure it works

#

and I just realised

#

I won't ened the getuniqueid

#

because its p.getPersistentDataContainer()

#

belongs to that player

#

I set up this

#

but it's not outputting to that directory

tender shard
#

you must specify an execution

quaint mantle
#

it works in my other plguins like that

tender shard
#

btw you you should never use the shade plugin to change the output directory

quaint mantle
#

shade?

tender shard
#

it will not do anything

#

what are you trying to achieve?

quaint mantle
#

i just realised in my old plugins it uses maven-jar-plugin

#

not shade

#

i didnt set it to shade that was the default

tender shard
#

shade and jar are two totally different plugins

#

anyway, yeah, the maven-jar-plugin is the correct one to change the output dir

quaint mantle
#

I just use this thing

#

idk why it used shade

#

:/

#

well it works now

#

so im happy

fierce whale
#

which one is better way to save data?
using internal variable like HashMap and saving it into yml file in every 5 minutes (every fixed period)
or
every time access to yml file and change some of data.

eternal oxide
#

So long as saving is async it makes no difference

fierce whale
#

so... it's same speed?

eternal oxide
#

File access is slow, so do it async

fierce whale
#

hmm.. how can i use async?

eternal oxide
#

Scheduler or Futures

fierce whale
#

aha I got it

#

thank you!

vivid cave
#

hello

#

I remember that in snapshot 20w14infinity nether portal frames could have different colours

#

Is it possible in 1.19? (no datapack, no texture pack)

#

Like is it possible (from plugin) to place down a nether portal block in specific colour?

#

Or does it necessarily need a texture/data pack?

#

Cuz 20w14infinity didn't store all the portal blocks as texture i guess but just generated a random colour

hasty prawn
#

It probably did that client side though

#

So I doubt there's a way for the server to tell the client what color to render it as.

vivid cave
#

alrightie

#

thx

hasty prawn
#

You'd have to do some NMS digging to really see how they did it and then check if they left code (which I doubt) in 1.19

vivid cave
#

oki

dreamy dove
fresh timber
#

in a bungeecord plugin ServerConnectedEvent event, how can I get the size of the players on the server that the event occurred on

golden turret
#

how to create custom block using the NMS?

naive bolt
#

how do i get sound from block data

worn tundra
river oracle
#

Probably easier that way with world gen and all

worn tundra
golden turret
vocal cloud
#

It won't persist so doing so can be pointless

#

Depends on what you want it for

worn tundra
#

But if you're going for the world gen, you should just simply set the blockdata while generating the world

vocal cloud
#

What version of MC is that for? Modern versions have access to custom model data

worn tundra
#

Custom model data is for items

vocal cloud
#

And blocks

worn tundra
#

Nope

vocal cloud
#

Yup

worn tundra
#

Otherwise all those complicated plugins wouldn't exist

#

Mind showing where I can set a placed blocks custom model data?

hasty prawn
#

Yeah custom model data only exists for items not blocks

worn tundra
#

^

hasty prawn
#

Generally you have to use like block states for custom blocks

tender shard
#

"custom blocks" are usually done through mushroom blocks or noteblocks with "not avilable in vanilla" blockstates

vocal cloud
#

I thought they did something. Huh I'll have to look through my bookmarks

hasty prawn
#

Hey man I want you to be right LMAO

worn tundra
#

Trueee

hasty prawn
#

I wish they had custom model data for blocks

worn tundra
#

Haha

vocal cloud
#

Oh it's the item frame method. I guess I didn't look too much into it. My bad

frail gale
#

actually you can add Custom Model Data to blocks with modding

worn tundra
#

Well modding just goes over the point of it doesn't it

frail gale
#

what is better?

vocal cloud
#

If you're like me and making a modded server mods are better than the item frame method

frail gale
#

Having multiple Runnable Anonymous Inner Classes or making a outer class which extends Runnable and then doing it from the class

vocal cloud
#

Depends if you're reusing the code a lot. If you are then making a class is superior

frail gale
#

At some point I use it a lot

worn tundra
eternal oxide
#

pass it a single executor not teh whole pool

vocal cloud
worn tundra
#

Means that a user can join / find out your server by just pasting the IP in and voila

#

For mods peeps have to download extra stuff which raises the bar for potentially joining

#

Can't argue with this tbh

vocal cloud
#

Ah that's not an issue per-se. The lobby is vanilla and explains everything

#

They can decide from there

worn tundra
#

Well that's more like a workaround

vocal cloud
#

I mean mods allow a unique experience you can't experience in vanilla

shadow gate
#

Can you tell me what type of click event to use, that when clicked, a new message was sent from the plugin to the player?

vocal cloud
#

I don't understand your message? What's being clicked

hoary wing
#

how can i put an actionbar in a game ?

worn tundra
vocal cloud
worn tundra
shadow gate
worn tundra
#

Custom player animations.
https://www.youtube.com/watch?v=_4-pdYOqfPg
And ItemsAdder for ex adds player emotes

Tonnes of custom blocks with custom break sounds.
This is the most basic thing. Up to like a 1000+ custom blocks can be added through block states and infinite custom sounds.

Custom GUIs with easy scrollable UIs
Yeah this ones a little of a workaround, but Mineclub for example has you click those arrows on the right (it's a dynamic scroll thingy)

vocal cloud
#

Yeah but it'd be a nightmare to manage the state for all that

#

It looks a lot more natural when modded

worn tundra
#

But the upside being being

  • No external downloads
  • Under 10 mb resource pack
  • Easier to join the server and experience the stuff right away
vocal cloud
#

Again, that's not an issue

worn tundra
vocal cloud
#

Not nitpicking. It's one of many reasons

worn tundra
#

For which you're ready to sacrifice hundreds of potential players?

#

There's a reason why all large upcoming servers are using these mechanics

#

and not mods

vocal cloud
#

Like I said it's not an issue

#

Rarely has anyone mentioned modded as being a reason they'd rather not play

worn tundra
#

What's the most popular modded server?

vocal cloud
#

No clue. Doesn't matter either

worn tundra
#

Aight

vocal cloud
#

We have 7000 people in our discord with 0 advertising

worn tundra
#

That's nice

tender shard
#

does anyone know a good CLI argument parser for java, similar to getopts in bash?

civic wind
vocal cloud
tender shard
#

idk, what's it called? 😄

worn tundra
tender shard
#

thx, that looks promising

#

yeah that's exactly what I was looking for, thx

naive bolt
#

how do i get all the blocks in an area when i have the leftMark and the rightMark

#

sorta like worldedit

chrome beacon
#

You loop them

quaint mantle
#

hello, I'm creating a core for a skyblock .... I want to create an island that is not already occupied by another island, what do you recommend? use external plugins? if so, which ones?

fresh timber
#

How do I change the name above a player's head in a Spigot plugin?

eternal oxide
#

PlayerProfile and NMS/packets

worn tundra
quaint mantle
worn tundra
#

WorldEdit api

#

Or similar

eternal oxide
#

Use teh Structure API

#

A part of Bukkit

quaint mantle
#

with these API can I avoid the two islands being close?

eternal oxide
#

thats upto your code

quaint mantle
#

k

#

thanks

fickle mist
#

Hi everyone! I have a question here I have like int c = 6
and I need in if what if what if the number of diamonds is equal to c then some actions take place then how to find out how many diamonds the player has in the inventory

tardy delta
#

might use a for loop cuz idk if this is what youre looking for

quaint mantle
#

hey

#

this is prob super basic

#

but um

#

what does
(int i = 0; i < args.length; i++) this mean

#

in particalarly

#

what does ++ do ?

#

oh

#

so

#

Can you give me an example like where its used

#

because i see it used a lot with args/strings and idk if i will need one for my custom enchants plugin

tardy delta
#

?learnjava

undone axleBOT
quaint mantle
#

kk tysm

grim ice
#

there's a much easier way

#

just in case you're not using a command, instead the asyncchat event

eternal oxide
#

String.join args

grim ice
#

then split the message like this:
message.split("sendmessage");
this will return an array, just do ur checks then get the [1] index in the array

#

itll return everything after /sendmessage

serene sigil
#

hi, how do u check if the itemstack u dropped is a shulkerbox with an item inside?

#

and in Item from?

serene sigil
#

bruh there must be a way

eternal oxide
#

did you bother searching?

serene sigil
#

ye

#

i searched