#help-development

1 messages · Page 346 of 1

sterile token
#

I thought You where coding your own Command framework

#

So forget about what ive said

devout shell
#

okay

#

say you saying I should firt learn complete java right?

sterile token
#

I would suggest

upbeat hornet
#

I found this
is it true? is data really fast to store in a json file? is sqlite better?

brave sparrow
#

CommandSender not Commandsender

sterile token
#

Because it's really important when You need for asking for help because they Will explain You really technnical the things and You wont understand

#

But learn the básics

devout shell
#

okay

devout shell
brave sparrow
#

But not compared to a proper data store or storing as binary for example

upbeat hornet
#

ok so sqlite is better
?

sterile token
#

Also You should know when You should use Sq and NoSql, there are áreas where one is faster than the other. But all depend on the encironent You are You are using

ivory sleet
brave sparrow
#

What are you looking for

brave sparrow
upbeat hornet
#

rapidity in querying a lot of information in a database

devout shell
brave sparrow
upbeat hornet
#

size isn't that big of a deal

brave sparrow
sterile token
#

@upbeat hornet You cannot said that a database is better without context, because some database are better for some enviroments

devout shell
brave sparrow
upbeat hornet
#

well that's why i'm asking in spigotmc instead of java

devout shell
#

oay

brave sparrow
#

Now that you’ve fixed the error

devout shell
#
package de.hardy.test;

import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

public final class Test extends JavaPlugin {

    @Override
    public void onEnable() {
        getLogger().info("onEnable is called!");
        this.getCommand("kit").setExecutor(new CommandKit());
    }

    @Override
    public void onDisable() {
        getLogger().info("onDisable is called!");
    }


}

public class CommandKit implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player) {
            Player player = (Player) sender;
            // Here we need to give items to our player

            // Create a new ItemStack (type: diamond)
            ItemStack diamond = new ItemStack(Material.DIAMOND);

            // Create a new ItemStack (type: brick)
            ItemStack bricks = new ItemStack(Material.BRICK, 20);


            // Give the player our items (comma-seperated list of all ItemStack)
            player.getInventory().addItem(bricks, diamond);

        }

        return false;
    }
}


short canopy
#

how do i change the ram on the spigot server

brave sparrow
#

But if you want to query large amounts of data any database will be better than storing it as json files

upbeat hornet
#

I'm looking to store 1K+ dict(or hashmaps whatever) but all of them with relatively small size, and they need to be changed quite regurlaly

brave sparrow
devout shell
#

Class 'CommandKit' is public, should be declared in a file named 'CommandKit.java'
Class 'Test' is never used

#

so can i move the class to CommandKit.java?

hazy parrot
hazy parrot
undone axleBOT
sterile token
#

Please i need recommendations for creating a custom tab completer for a command framework i'm creating

rotund ravine
#

?

nimble void
#

hello, can someone please help me how can I fix this problem in bungeecord minecraft server

#

02:06:46 [SEVERE] [
<-> Initia
lHandler - encountered exception: net.md_5. bungee.u til. QuietException: Unexpected packet received duri ng login process! 0a0d0a000d0a515549540a2111

rotund ravine
sterile token
#

JanTuck, I was planning something like:

Completer completer = Completer.Empty();

completer.register(0, List.of("suggest-1", "suggest-2"));

completer.register(1, List.of("true", "false'));

completer.complete(args);

rotund ravine
#

Look at what ACF does.

sterile token
#

Oh ok

hazy parrot
#
abstract class CommandBase<T>(name: String) where T : SlashCommandData, T : SubcommandData

Can i even do smth like this in kotlin

#

according to docs, i should be able

#

is this just ij being goofy or what

remote swallow
#

@rotund ravine kotlin

hazy parrot
#

yeah, looks like i misread docs smh

hazy parrot
#

jda

sterile token
#

Oh nice

#

Sorry for tagging

hazy parrot
#

hate that SlashCommandData and SubcommandData doesn't have common interface

rotund ravine
#

Haven't played much with generics.

sterile token
hazy parrot
#

or smth like CommandData as common interface and both SlashCommandData and SubcommandData implementing it

sterile token
#

Yeah

#

True

hazy parrot
#

or even abstract class

sterile token
#

Yes

#

Goksi is there is any diff between using interface or abstract for this usage?

#

I always asked My self when i really should use interface or abs class

hazy parrot
#

no need to write it two times

#

also both have description

#

and ig json payload for discord api looks same, so it can be same impl

#

just assumption tho, there is probably reason they haven't done that ¯_(ツ)_/¯

sterile token
#

Idk

#

Also take in café that the discord api integratiom saant done by discord

quaint mantle
#

hi

#

i am trying to change the display name of an item but it just won't work and i cannot figure out why

#
    private ItemStack createRenderItem (boolean bool, ItemStack item) {
        ItemMeta meta = item.getItemMeta();
        String displayName = meta.getDisplayName();

        meta.setDisplayName((bool ? "§a" : "§4") + displayName);

        item.setItemMeta(meta);
        return item;
    }```
#
        boolean currentBoolean = ChunkData.getBoolean(boolIndex.intValue(), this.booleansBitmask);
        Bukkit.broadcastMessage(currentBoolean ? "true" : "false");

        ItemStack renderItem = createRenderItem(currentBoolean, this.inventory.getItem(inventorySlot));

        Bukkit.getScheduler().runTask(ChunkClaimsPlugin.getThisPlugin(), () -> {
            setGUIItem(inventorySlot, renderItem);
        });```
#

How do i change the display name of an item in an inventory?

#

it works when i try to change the item itself, i tried doing setGUIItem(inventorySlot, createItem(Material.CAKE, 1, "test"); and it was changing the actual item in that case.

#

but

untold patio
#

Hey, has anyone created a plugin that allows users to add an object from a yml file in the console, to an arraylist and from in-game

quaint mantle
#

it does not seem to update when i just change the display name.

vapid latch
#

does your thing write §a or the color doesnt change at all?

untold patio
#

I tried creating that but not working as expected

quaint mantle
#

the boolean changes

vapid latch
#

try with the chatcolor enum

quaint mantle
#

i am printing the boolean in the bukkit.broadcastMessage thing

#

it changes so the boolean is not at fault

quaint mantle
vapid latch
#

bool ? ChatColor.GREEN + "" : ChatColor.DARK_RED + ""

quaint mantle
#

okay.

vapid latch
#

does anyone here happen to know if the itemstack serialization on spigot support the new goat horns?

sterile token
quaint mantle
#

the item display name color still won't change!

#

i dont even understand why

#

this is like

#

i have written code that is supposed to what i want it to do but it wont

#

and it is causing me an actual headache at this point

remote swallow
#

do you set the meta again

quaint mantle
#
    public static ItemStack createItem (Material material, int count, String name, String... lore) {
        final ItemStack item = new ItemStack(material, count);
        final ItemMeta meta = item.getItemMeta();

        meta.setDisplayName(name);
        meta.setLore(Arrays.asList(lore));

        item.setItemMeta(meta);

        return item;
    }```
sterile token
#

If you dont update the meta, the data you are updating wont change

quaint mantle
#

yep, i am updating the meta.

remote swallow
#

make item meta not final

quaint mantle
#

..

#

you are right.

sterile token
#

final Is used I'm Java to tell that a field Will be initialized and wont change

quaint mantle
#

it still wont update the display name!

#

this may look like a simple problem but i had a really tough time narrowing down what the problem was

#

and it turned to be minecraft not updating display names

#

because i had sql operations running in the background and internal values updating.

#

and it was a pain to finally figure out that minecraft was screwing me away.

fossil lily
#

Anyone know why whenever I install a dependency it's always missing the dependencies of that dependency?

#

does that make sense

hazy parrot
fossil lily
#

Like when I use Redisson its always missing EPoll classes and other stuff

quaint mantle
#

i never do that.

#
        if (this.chunkData == null) {
            if (chunksTable == null) {
                chunksTable = new ChunksTable();
            }

            this.booleansBitmask = ChunkData.changeBoolean(boolIndex.intValue(), this.booleansBitmask);
            chunksTable.setBooleans(this.booleansBitmask, this.chunkCoordX, this.chunkCoordZ);
        } else {
            this.booleansBitmask = chunkData.changeBoolean(boolIndex.intValue());
        }

        boolean currentBoolean = ChunkData.getBoolean(boolIndex.intValue(), this.booleansBitmask);
        Bukkit.broadcastMessage(currentBoolean ? "true" : "false");

        ItemStack renderItem = createRenderItem(currentBoolean, this.inventory.getItem(inventorySlot));

        Bukkit.getScheduler().runTask(ChunkClaimsPlugin.getThisPlugin(), () -> {
            setGUIItem(inventorySlot, renderItem);
        });```
hazy parrot
hazy parrot
quaint mantle
#

that is why you see the Bukkit.getScheduler().runTask(); function here, everything before that ran in an async function.

#
    public void setGUIItem (final int index, final Material material, final String name, final int count, final String... lore) {
        ItemStack item = createItem(material, count, name, lore);
        this.inventory.setItem(index, item);
    }```
hazy parrot
#

FYI, runTask is used for running code on main thread

quaint mantle
#
    public void setGUIItem (int index, ItemStack item) {
        this.inventory.setItem(index, item);
    }```
#

this is the one

#

i have a function overload of that function name, that is it.

sterile token
quaint mantle
fossil lily
#

I'm also using Kotlin with Groovy if that makes a difference

umbral vortex
#

anyone need software or website development services?

quaint mantle
#

i am using Bukkit.getScheduler().runTask() to push the task to the main game thread from the async thread.

umbral vortex
#

saas specialist here folks

sterile token
#

Jim this Is a comm

#

You shouldnt post that

umbral vortex
#

yes

sterile token
#

That should be posted a spiot blog

umbral vortex
#

im a spigot veteran

#

10 years

hazy parrot
#

Who

sterile token
#

I dont understand that doesn't make a diff

quaint mantle
#

bruh, how do i update the display name..????

sterile token
#

And of you want to change spigot site name, you have to Donate

sterile token
#

Ohhj

#

lmao

#

🤦‍♂️🤦‍♂️

quaint mantle
#

okay i just realised something

remote swallow
undone axleBOT
hazy parrot
quaint mantle
#

nope!

#

bruh i just dont see it

#

what did i even do that makes it not do what i want it to do why

#
    private ItemStack createRenderItem (boolean bool, ItemStack item) {
        ItemMeta meta = item.getItemMeta();
        String displayName = meta.getDisplayName();

        meta.setDisplayName((bool ? ChatColor.GREEN : ChatColor.RED) + displayName);
        Bukkit.broadcastMessage((bool ? ChatColor.GREEN : ChatColor.RED) + displayName);
        
        item.setItemMeta(meta);
        return item;
    }```
#

lets see what this prints.

#

btw

#

i wanted to ask this for a while

#

but did not ask it yet idk why

#

but

#

is there a way to like compile the plugin and launch minecraft or just not have to launch minecraft?

#

so the way i am doing it is that i am compiling the plugin, copying the .jar file over to a server.jar plugin directory and restarting the server

#

everytime i compile

#

is there a better way to do this?

#

okay i think i found my problem

#

it is the createRenderItem() method.

delicate obsidian
#

You can compile the plugin directly on the plugins folder of your server

sterile token
#

I would configure an IJ enviroment so whenever you compile, your compiled jar ks put inside the plugins directory and also configure the Sever, so you can Start it from IJ

quaint mantle
#
        boolean currentBoolean = ChunkData.getBoolean(boolIndex.intValue(), this.booleansBitmask);
        Bukkit.broadcastMessage(currentBoolean ? "true" : "false");

        ItemStack renderItem = createRenderItem(currentBoolean, this.inventory.getItem(inventorySlot));```
#
    private ItemStack createRenderItem (boolean bool, ItemStack item) {
        ItemMeta meta = item.getItemMeta();
        String displayName = meta.getDisplayName();

        meta.setDisplayName((bool ? ChatColor.GREEN : ChatColor.RED) + displayName);
        Bukkit.broadcastMessage((bool ? ChatColor.GREEN : ChatColor.RED) + displayName);

        item.setItemMeta(meta);
        return item;
    }```
sterile token
#

?paste

undone axleBOT
hazy parrot
#

You can use String.valueOf for boolean instead of ternary

quaint mantle
#

ik

#

okay but watch this.

hazy parrot
#

I just don't understand why name isn't changing for you, if all methods are called correctly

quaint mantle
#

what the heck is java doing here?

dry yacht
#

:-:

#

Dude, like, chill out for a second, I'm already searching your bug... Let's bet that "iT is JaVa beINg WroNG" won't hold till the end...

quaint mantle
#

sorry

#

ok in hindsight this is not the place where i should be throwing a fit, sorry for being a nuisance.

dry yacht
#

Your problem is pretty messed up, if I'm right.

quaint mantle
#

it is indeed.

dry yacht
#

You get the existing displayname, append a leading color-change and set it again. All while operating on the same item all the time. You probably keep on appending more and more color-codes to the head of the displayname which all get overriden by the last color code (first call).

Print something like displayName.replace('§', '&') to check if that's right.

quaint mantle
#

i am very blind

#

it all shows up

dry yacht
#

You could solve that by stripping colors first, but I think that you should just have the vanilla string without colors somewhere else

sterile token
#

That why i prefer working eith menús using a menú api, so them i dlnt have mostly this issues. Because you dont really mess with thousans of lunes for menús

dry yacht
#

Well, it kind of requires you to simulate the code in your head, xD. I'm not sure if you're used to doing this while writing it, as most people just like to relay that part to the actual computer.

sterile token
#

Sorry for Ting but cellphone it's a mess corrdct what ever write

quaint mantle
#

ok i am sorry i am indeed very blind, i will go back to fixing the problem. Sorry for wasting everyone's time.

dry yacht
quaint mantle
#

its so obvious yet so well camouflouged in one's plain sight.

delicate obsidian
#

what a conversation

sterile token
#

I'm my case beforr writing, i take around 30m-1h to think the lógics/models i can follows for doing that

#

It's pretty help a Lot

.

#

Lmao i thinking I'm really useless i have 30m actually trying to write my tab completaron logic, till haven't write a class Imagine tho

#

😡💀😂

dry yacht
#

I'm really wondering whether compression could speed up my video streaming process, or slow it down, xD. There's only one way to find out, I guess.

delicate obsidian
#

So, I'm trying to constantly spawn a particle when a player is nearby a location and I want to stop it if the player is no longer nearby the location, all works fine except that the BukkitRunnable doesn't stop. This is my code:

Location particleloc = new Location(world, -46.5, 111.5, 51.5);
        
if(loc.distance(particleloc) < 12) {
  new BukkitRunnable() {
    public void run() {
      if (loc.distance(particleloc) >= 12) {
        this.cancel();
        return;
        }
     
 p.spawnParticle(Particle.END_ROD, particleloc, 5, 0, 1, 1, 0);
      }
    }.runTaskTimer(plugin, 0, 20);
  }```

Probably is because the `loc.distance(particleloc) >= 12)` condition can't be reached at all, but I don't know how to do it right.
#

Also, if there's a better way to do this tell me :)

wet breach
#

but what you should do for your task is to instead reverse the condition

#

if the condition is met, then spawn particle

#

otherwise if not, it will won't hit the if statement and will return anyways

quaint mantle
#

how do i check if a chunk is loaded or not?

wet breach
#

isLoaded()

tender shard
#

well well

#

if they already have a Chunk object, it's probably loaded

#

since getChunk() loads it

#

World#isChunkLoaded(...)

#

x and z are chunk coordinates

#

so basically chunk X = blockX / 16

wet breach
#

depends in how they are obtaining chunk object that is

vagrant stratus
#

Ah @dry yacht you still have to help w/ the hologram positioning stuff lmao

desert tinsel
#

How can I get the shield item from player inventory?

tender shard
tender shard
desert tinsel
#

how to get inventoryMoveItemEvent for a custom inventory, not the player inventory

icy beacon
#

check if the inventory in question is not instance of player inventory

#

but if you want a specific inventory you might check its title or use custom inventoryholders (even though it's a bukkit API misuse)

wet breach
#

you shouldn't use inventory titles

#

for such purposes

hushed pawn
#

How usually people send players to empty server from a pool? Have i parse bungeecord api response?

#

I hope someone knows

icy monolith
#

How do i check on rightclick if players heald item is horse armor
#do stuff

hushed pawn
#

ChatGPT says i have to install bungeecord api plugin to my server

#

But i cant find it

#

Xd

chrome beacon
#

Well it doesn't exist

hushed pawn
kind hatch
#

Seems straight forward enough. Just get all the servers, check the player count, and if empty, send them there.

hushed pawn
wet breach
#

do you not know the ip addresses of your servers?

kind hatch
#

Depends. Is this part of a plugin for the server or is this supposed to be a bungeecord plugin?

wet breach
#

well they have a lobby server

#

wouldn't recommend a plugin on the bungee

#

all they need is a plugin on the lobby server to do this

kind hatch
#

Oh, fair enough. Then the messaging channel is what you'll need to use.

wet breach
#

you can use messaging channel or you can use server list ping

#

server list ping won't work if you have firewall rules, but you can just use a vpn for it to still keep things secure, if the lobby server and mc servers are on the same host, its a non-issue anyways

kind hatch
hushed pawn
#

Okay ChatGPT says i have to get player count via parsing http request

wet breach
#

chagpt is referring to what I said

kind hatch
#

Doubt that you can actually do that. lol

wet breach
#

server list ping

kind hatch
#

You mean through the query port?

wet breach
#

or you can do that too

#

anyways, just go with which ever you like better 🙂

#

we are not here to tell you which you should use, all three things are valid

kind hatch
#

I'd recommend the messaging channel as it's the most reliable.

wet breach
#

not sure about most reliable, its probably the most documented with examples

hushed pawn
#

Oaky thanks

wet breach
#

so your choices are query port with http request, server list ping, or plugin message channel

#

its always good to have options 😄

kind hatch
#

Hey frost, do you remember a while ago when you and itzdlg were helping me make that mysql table for hug interactions?

#

Well, I think I kinda screwed up and actually needed that 3 table setup. I got it made, but I was wondering about inserting data.

#

It seems that I would need multiple queries and I wasn't sure if that was the right approach.

icy beacon
#

why is playervelocityevent barely ever called

#

i started falling, and for the duration of the fall only one pve was called

#

i'd assume it were called every tick?

#

i'm trying to detect a fall (so i'm seeing if velY = 0)

#

are there any other ways to do it

icy monolith
#
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            ItemStack item = player.getInventory().getItemInMainHand();
            if (item.getType() == Material.IRON_HORSE_ARMOR) {
                player.sendMessage("hey");
            }
        }
    }```
Can eny one help me with this on right click event? I want to make a gun that shoots snowballs, but i cant get it to send the "Hey" when i right click an iron horse armor. It dosnt send it
icy beacon
#

looks good to me, are you sure you've registered the event?

icy monolith
#

i think yeah

icy beacon
#

try to debug step by step then

icy monolith
#

Why does it say a warning on my main class

#

Class <main class name> is not used

icy beacon
#

don't worry about it

kind hatch
#

Cause it's not called anywhere in the project. That check is for project use. It doesn't take into account that it will be used by something else.

reef acorn
#

How can I get player heads without lag?

wet breach
icy beacon
#

hey frostalf

icy beacon
icy monolith
wet breach
icy beacon
#

should i make a per-tick scheduler 🤔

#

it gets called at the start of the fall unfortunately

wet breach
#

so to get around this you need to make your own task called every tick or if you want to save on cpu, you could make use of vectors to pre-determine where they will land and in how much time

icy monolith
#

ohhhhh

#

my plugin is disabled

icy beacon
#

sounds like pain :sip:

icy beacon
#

xD

wet breach
#

so, caveat for those who decide to not head my infinite wisdom sometimes XD

#

jk, don't have infinite wisdom but the warning part still valid lmao

icy monolith
# icy beacon bruh
[11:38:29] [Server thread/ERROR]: Error occurred while enabling Moul v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Plugin already initialized!
    at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:255) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:53) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at me.roustytousty.moul.Gun.<init>(Gun.java:12) ~[Moul-1.0-SNAPSHOT.jar:?]
    at me.roustytousty.moul.Moul.onEnable(Moul.java:13) ~[Moul-1.0-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:371) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:544) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugin(CraftServer.java:578) ~[paper-1.19.3.jar:git-Paper-386]
    at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugins(CraftServer.java:492) ~[paper-1.19.3.jar:git-Paper-386]
    at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635) ~[paper-1.19.3.jar:git-Paper-386]
    at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434) ~[paper-1.19.3.jar:git-Paper-386]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:301) ~[paper-1.19.3.jar:git-Paper-386]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1101) ~[paper-1.19.3.jar:git-Paper-386]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-386]
    at java.lang.Thread.run(Unknown Source) ~[?:?]
Caused by: java.lang.IllegalStateException: Initial initialization
    at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:258) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:53) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at me.roustytousty.moul.Moul.<init>(Moul.java:7) ~[Moul-1.0-SNAPSHOT.jar:?]
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
    at java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) ~[?:?]
    at java.lang.reflect.ReflectAccess.newInstance(Unknown Source) ~[?:?]
    at jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source) ~[?:?]
    at java.lang.Class.newInstance(Unknown Source) ~[?:?]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:83) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:154) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:413) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:321) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R2.CraftServer.loadPlugins(CraftServer.java:436) ~[paper-1.19.3.jar:git-Paper-386]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:273) ~[paper-1.19.3.jar:git-Paper-386]
    ... 3 more```
kind hatch
icy beacon
#

are you creating a new instance of your main class

wet breach
#

something something keys

#

I need to re-look at the chat for then XD

icy monolith
#

idk i have only 2 classes

wet breach
#

oh no I remember now

kind hatch
wet breach
#

you needed a function

icy beacon
kind hatch
#

This is what I interpreted from your original example.

wet breach
#

you need to create a function to populate the table for you so you don't have to manually send the query everytime to obtain the information

icy monolith
#

    @Override
    public void onEnable() {
        System.out.println("[Moul] We are online!");
        Bukkit.getPluginManager().registerEvents(this, this);
        Bukkit.getServer().getPluginManager().registerEvents(new Gun(), this);
    }

    @Override
    public void onDisable() {
        System.out.println("[Moul] We are out!");
    }
}```
Main class
kind hatch
wet breach
wet breach
icy beacon
wet breach
#

just have to ensure the user for the connection has appropriate perms to create functions

icy monolith
#

its asking me to safe delete my main class for some reason as a warning

icy beacon
#

ignore it

#

plz

#

intellij is not versed in terms of spigot plugins

wet breach
kind hatch
icy beacon
#

it does not know that the class is used

#

e.g. plugin.yml uses it

#

and generally deleting your main class sounds like a bad idea

wet breach
kind hatch
#

Yea, that's annoying and seems like an area for data integrity issues.

wet breach
#

well you don't have to do it manually

#

you just create a function to do it for you

icy monolith
#

well idk still same error

wet breach
#

which is why functions in mysql exist >>

#

its their sole purpose

kind hatch
#

I see. Guess I gotta go down that rabbit hole now. :3

icy beacon
wet breach
#

yeah, well I guess sometimes you have to learn the hard way

#

XD

icy beacon
#

the error is indicated at

at me.roustytousty.moul.Gun.<init>(Gun.java:12) ~[Moul-1.0-SNAPSHOT.jar:?]
at me.roustytousty.moul.Moul.onEnable(Moul.java:13) ~[Moul-1.0-SNAPSHOT.jar:?]
at me.roustytousty.moul.Moul.<init>(Moul.java:7) ~[Moul-1.0-SNAPSHOT.jar:?]

https://www.spigotmc.org/threads/tutorial-how-to-read-stacktraces-solve-most-of-your-plugin-problems-by-yourself.48121/ @icy monolith

wet breach
#

it was a nice discussion that day though I will admit 😛

icy monolith
#

Oh you wanted the other class

kind hatch
#

It could have ended better though. :/

icy monolith
#
public class Gun extends JavaPlugin implements Listener {

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        player.sendMessage("hey1");
        if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            ItemStack item = player.getInventory().getItemInMainHand();
            player.sendMessage("hey2");
            if (item.getType() == Material.IRON_HORSE_ARMOR) {
                player.sendMessage("hey3");
            }
        }
    }
}```
kind hatch
#

But it is what it is.

wet breach
icy beacon
wet breach
#

I don't remember that 🤔

icy beacon
#

extends javaplugin means that it's the main class of your plugin

#

there only should be one per plugin

icy monolith
#

oh

kind hatch
wet breach
#

oh

#

oh oh right

#

I didn't know it ended badly at the end

#

anyways, whatever its the past now XD

kind hatch
#

Yea, it was kinda my fault. I just couldn't explain what I was trying to go for properly.

wet breach
#

I suffer from random memory loss, so sometimes I remember and other times I don't but regardless I have stopped trying to fight it and just go with it 😛

#

amazingly my super long term memory is great

#

so in like 1 year from now

#

I will probably remember that discussion at length for some stupid reason because my brain said it was finally important to remember it

icy beacon
#

please remember that i have to take out the chicken out of the refrigerator in 7 years

#

remind me if you feel like it, too

quiet ice
#

I rarely remember discussions I have on the net

warm light
#

I am trying to make a different API jar for my plugin.
By googling, I got this(ss)

but the problem is my main plugin is obfuscated. thats why I am getting "cannot find symbol" error from API module

wet breach
#

so don't obfuscate

#

no reason to do so

#

problem solved

quiet ice
#

How that is done depends on the obfuscator itself

icy beacon
#

obfuscating java is pointless

#

because pretty much anything can be deobfuscated and you'll look like a fool

quiet ice
#

there is one obfuscator that does work decently

#

but obfuscation in java is pretty much a case of "don't copy & paste my code"

icy beacon
#

if someone wants to steal your code they will

kind hatch
icy beacon
#

yeah

quiet ice
#

if you want to go to court over that chances are you may loose

#

so naturally you don't

wet breach
quiet ice
#

Thus making the license useless

icy beacon
#

but obfuscating to make your code inaccessible is silly

wet breach
#

Well, there is things like hardware that uses java, embedded systems and all that

#

well you don't have infinite room

quiet ice
#

Most obfuscators absolutely annihilate performance and readability

#

And size constraints

wet breach
#

So, an obfuscator is really good at reducing size

warm light
wet breach
#

readability isn't important once its on the embedded system

#

and decent obfuscators like proguard don't sacrifice too much in way of performance albeit depends which settings you use

quiet ice
#

I'd hardly consider proguard an obfuscator.

knotty meteor
#
                PlayerInventory inventory = p.getInventory();
                int coalAmount = inventory.all(Material.COAL).size();```
Someone knows how i can check for charcoal?
Because in 1.12.2 Material.CHARCOAL doesnt exist
quiet ice
#

I don't use any.

wet breach
#

Most of us here don't use obfuscators

knotty meteor
#

I use skidfuscator premium but it is in beta so sometimes things dont work as it should

icy beacon
#

mfnalex uses some obfuscator maybe he'll answer

#

but he needs to somehow be summoned

wet breach
#

as I explained above there is really only some niche reasons to use them, and if your use case is because you want to stop someone from stealing code well an obfuscator has never stopped that ever. Look at minecraft, we been making custom server jars since version 1.0.0 of minecraft which is way before they were giving mappings

#

@tender shard your knowledge is required on this niche thing

quiet ice
#

That being said proguard does work. Getting stuff to a readable state can take hours and automatic tools are few are rare beyond. For some reason I have one of the few actually working deobfuscators for proguard

#

Mfnalex uses his own obf

#

I don't think that it is public

icy beacon
knotty meteor
#

Thanks, i will try it. I think its (short)1 as durability

quiet ice
#

would make sense though - you don't want it [the obfuscation] to be reverse-engineerd

icy beacon
wet breach
quiet ice
#

Yes with tools such as SSVM it's inevitable but you won't see tools such as java-deobfuscator picking it up automatically

#

ZKM as far as I heard does work nicely

#

But with callsite obfuscation and stuff you first need to run an deobfuscator for it to be readable

wet breach
#

well then again, us more knowledgeable peeps don't really have a use to reverse engineer something anyways because we usually have a pretty good understanding of how it works to just make it ourselves

#

Like, I could care less about some random plugin on the spigot site that realistically it isn't even worth my time to mess with it XD

quiet ice
#

Yeah - the only use for that are nefarious reasons. For other uses proguard does the job just as well

torn shuttle
#

does messing with item nbt still required using nms code?

quiet ice
#

depends on which NBT

kind hatch
#

AFAIK, yes if you don't want to use an api like NBTAPI.

#

There is the PDC, but I'm assuming you need to modify other specific aspects.

quiet ice
#

there is stuff that can be modified with the API, others where technically you can use the API but you wouldn't want to and then there is stuff you cannot do

torn shuttle
#

alright thanks for the info

quiet ice
#

Like the UnsafeValues class allows modification, and item attributes can be read and written rather easily. Then there is also the PDC. For the rest I am not aware of workarounds that purely work on the bukkit api

quaint mantle
#

Does anyone know a good voting plugin?
Like if you vote for the server on a website you get a reqward

mortal hare
#

have anyone tried new Intellij IDEA UI yet?

#

looks cool

icy beacon
#

is it an update?

mortal hare
icy beacon
#

and i'm a bit concerned about the fact that your plugin does bjobs

#

but you do you

icy beacon
mortal hare
#

i get what you mean rn

#

lol

#

i should change it

icy beacon
#

lmao yeah

#

my plugin had (or still has?) an action called "player-give-head"

#

when i created it i wasn't aware of what it meant

#

omfg

#

this ui is so good

#

thank you dude you're godly

#

oh my god

mortal hare
#

fortunately i've set up my gradle in that way i can change the name by only changing one field

#

gradle ftw

icy beacon
#

haha

#

i wanna do my next project in gradle because the syntax is funny

mortal hare
#

i wonder if themes would work with this new layout

icy beacon
#

i don't even care anymore

#

this is too cool

#

atom material icons and this

#

and i'm fully set

#

has a mac-like feel lol

#

sorta

mortal hare
#

i like new fonts

#

it truly feels like uwp shit

icy beacon
#

true

mortal hare
#

it so smooth

icy beacon
#

bold font is overrated

#

this is perfect

#

the font weight is right between the ugly bold and ugly thin

mortal hare
#

my icons are different

#

this means custom icon support is working

mellow pebble
#

does anybody have idea how slot plugin in inventory can be done like items in inventory go down each 10ms or so and after 1 seconds spining stops and the player gets items

mortal hare
#

slot machine type?

mellow pebble
mellow pebble
#

im not sure how should i make that spining animation

icy beacon
#

but if you are fine with 50 you can do schedulers

mortal hare
#

Create a new BukkitRunnable task

#

and in it calculate new slot

#

by adding 9

mellow pebble
#

like this

mortal hare
#

if it overflows the inventory size

#

reset it

wet breach
#

anyways, the slots have id's

#

you would group the slots that are in line with each other

#

and then ever so many ticks, you would change the item from being in the slot it is in, the slot below it

#

and so forth

#

but you would do this for the entire row at once

#

or if you wanted slot wheels

#

at different intervals for the columns

#

this gives the appearance of spinning

quiet ice
#

i.e. decrement/increment the item's slot id by 9

wet breach
#

^

#

thank you geol I couldn't remember the number for it

mellow pebble
#

yeah but like i would need to reopen the inventory for the item in slot to be changed or ?

wet breach
#

no

quiet ice
#

Nope, bukkit resends inventories automatically

#

or well it only sends deltas

wet breach
#

you can always call updateInventory()

#

if its still there

mellow pebble
#

yeah i see fine ty

wet breach
#

have fun to creating your slot machine 😄

mortal hare
#

man i hate those dramas with mod loaders

#

and minecraft launcher

#

PolyMC was a fork of MultiMC that implemented mod support integration with curseforge and modrinth

buoyant viper
#

like how Quilt has no reason to exist and adds nothing beneficial to its API?

#

oh

mortal hare
#

and then came its own owner by banning all maintainers from the project

quiet ice
#

Modlauncher/LegacyLauncher is stupid, agreed

mortal hare
#

for "left wing" propaganda

#

no one fucking cares which side you're on

quiet ice
mortal hare
#

they maintain the project

#

not your beliefs

wet breach
#

I am not entirely sure what mod loaders have to do with spigot o.O

mortal hare
#

soz

#

wrong channel to talk about

quiet ice
eternal oxide
#

I use MultiMC as the Vanilla MC launcher is totally broken on Win 7

wet breach
mortal hare
#

I use PrismLauncher which is a fork of PolyMC which is a fork of MultiMC

#

its actually cool

formal bear
#

why utf8 works from config files but not directly from compiled class?

mortal hare
#

integrated fabric, forge, quilt and mod support right away from launcher

eternal oxide
wet breach
mortal hare
#

one click to download whole fps optimized modpack

#

one click for to install mod from modrinth or curse

quiet ice
#

If you are using Java 17 or beyond it likely is your IDE

mortal hare
wet breach
formal bear
#

understood

wet breach
#

but I am on win 10

mortal hare
#

im on win 10 too, but modified to suit my needs

#

i hate how win 11 doesnt allow to move the taskbar

eternal oxide
buoyant viper
#

which old launcher

mortal hare
#

the main reason im not upgrading it

wet breach
desert tinsel
#

how can you see and edit a player inventory in real time?

buoyant viper
#

the last .jar launcher?

mortal hare
#

and open it

#

with openInventory() method

wet breach
eternal oxide
#

I actually prefer MultiMC now. The vanilla Launcher had a bad habit of forgetting login info when you used multiple accounts.

mortal hare
#

it works i've tried

desert tinsel
buoyant viper
#

is it just like a java swing app with a webview

wet breach
#

but the exe is just basically a wrapper for that I suppose

mortal hare
quiet ice
#

the old launcher is the launcher that is launched in old windows compatibility mode

mortal hare
#

there's no way to see inventory UI

buoyant viper
#

that version... shouldnt work anymore though? lolwtf

mortal hare
#

by invoking code from the server

buoyant viper
#

it has no msa auth and at some point they redid the jsons

#

are u using a modified one?

mortal hare
#

unless you want to map armor slots to some kind of other container UI

desert tinsel
#

cant create a custom inventory and listening to events?

wet breach
buoyant viper
#

ohh

wet breach
#

that is the one I use, not sure if it still uses jar for it as I never really checked

quiet ice
#

yeah - then it's the windows compat launcher

wet breach
#

but I never updated the launcher after that

#

🙂

mortal hare
#

you can, but i think you would need some NMS to sync the opened gui, with player's inventory, since you need to fake it

buoyant viper
#

oh that one like right before they updated made the microsoft store one i think

mortal hare
#

idk how to explain it properly

#

its not supported feature of API

mortal hare
#

you would need to work around

#

of minecraft's limit

#

to make it work

wet breach
#

seems there is too many launcher versions XD

buoyant viper
#

there really are lol

wet breach
#

anyways once I had the nice profile stuff though I never saw the reason to keep updating the launcher

buoyant viper
#

bc then theres the one before the last JAVA launcher that i remember was used up to like 1.5.2

mortal hare
#

best way to open inventory gui with armor slots, is to invoke Custom relfected NMS 4x9 Notchian container, in which the last row is reserved for other inventory slots (offset, armor, etc.)

wet breach
#

I remember that one

buoyant viper
#

and god knows how many more before that one

wet breach
#

oh, lets not forget the launcher from twitch too

mortal hare
#

you cant invoke this inventory

#

from the server

#

its clientside

desert tinsel
#

hmm, thx you

quiet ice
#

yeah those are for packets

wet breach
#

that confused me for a while when people were always asking me how to use the twitch launcher

buoyant viper
#

lets not forget when Minecraft had twitch integration AbsoluteHalal

#

still wish they didnt remove it, was kinda cool

wet breach
quiet ice
#

licensing issues in a nutshell

wet breach
#

I liked that it was there too

buoyant viper
mortal hare
#

although you can do something like this

#

with NMS

#

by mirroring NMS player's inventory to custom NMS inventory view

#

with spoofed packet container type

wet breach
#

you don't need nms for that

mortal hare
#

you would need to sync it with player's container

wet breach
#

sure, not hard to do API side

mortal hare
#

but its already built in NMS

#

i wouldnt bother by creating bugs which you would need to fix, if prompted

wet breach
#

Just grab players inventory object, mirror it to the containers inventory object

#

is how you do it from API

#

not all that hard and not sure why that would create bugs

mortal hare
#

what about if you want to pickup items

#

or remove them

wet breach
#

you still could?

mortal hare
#

you would need to sync both containers

#

ofc you could

#

but i would be too lazy, i would let the server do that 😄

#

with some reflection wizardry

wet breach
#

that is basically the hard way

#

the way I described, the server does it for you without reflection or packets or anything else

mortal hare
#

but i could be safe that i haven't made dupe bugs

#

myself

wet breach
#

not sure how the API would create a dupe bug with that

mortal hare
#

you need to manually sync containers

#

you could miss some inventory actions

#

etc

#

and items could be duped

wet breach
icy monolith
#

What do i need to do to add a command? I want a command that saves players location to a list. and then a command to teleport player to a random element of that location. I just dont know how to do the command part. ive never made a command before xd

wet breach
#

objects are very versatile in Java

#

you are making it sound like copying an object in Java is some trivial thing

mortal hare
#

Inventory Types are different

wet breach
#

type doesn't matter

mortal hare
#

it does, slot numbers are different

buoyant viper
#

actually is there a command to it

#

?commands

#

probably exists but idk

mortal hare
#

for me personally digging up NMS is easier than to map all the slots to new places, and manually sync them,

#

ofc multiversion support is done

#

but still

wet breach
#

chest inventory is larger then the players so, you are good

mortal hare
#

and you're saying that the slots would end up in correct places?

#

at least linearly?

icy monolith
mortal hare
#

wait no

wet breach
#

as long as you count the inventory slots in the player slot appropriately, not hard to map it to a chest inventory slot numbers

mortal hare
#

yea you can, you cant extend two classes tho

buoyant viper
#

ie. YourCommand implements CommandExecutor, TabCompleter

mortal hare
#

i mismatched it

buoyant viper
wet breach
mortal hare
wet breach
#

just separate the classes with ,

kind hatch
buoyant viper
#

didnt know that class existed

wet breach
#

just an example

#

but yeah

kind hatch
#

I know you were talking about examples, but I just wanted to drop that.

icy beacon
#

can this code be shorter?

public boolean sameTeam(final Player player, final Player other) {
    final List<Team> teams = player
      .getScoreboard()
      .getTeams()
      .stream()
      .filter(t -> t.hasEntry(player.getName()))
      .toList();
    
    if (teams.isEmpty()) return false;
    return teams.stream().anyMatch(t -> t.hasEntry(other.getName()));
  }
#

i feel like i'm reinventing the wheel

mortal hare
#

i dont think so

#

its short already

#

writing this without stream api would be way bigger

austere cove
#

there's no point to call #toList though

icy beacon
#

true

#

i'll do that

#
public boolean sameTeam(final Player player, final Player other) {
    return player
      .getScoreboard()
      .getTeams()
      .stream()
      .filter(t -> t.hasEntry(player.getName()))
      .anyMatch(t -> t.hasEntry(other.getName()));
  }
#

well that def looks much cleaner

austere cove
#

ackchually

public boolean sameTeam(final Player player, final Player other) {
    return player
      .getScoreboard()
      .getTeams()
      .stream()
      .anyMatch(t -> t.hasEntry(player.getName()) && t.hasEntry(other.getName()));
}
icy beacon
#

yeah that's even better

#

thanks 😄

mortal hare
#

this could be probably further optimized by writing this with for loops or digging up the implementation of bukkit api, but this seems clean and cross compatible

icy beacon
#

btw i'm a bit confused on "default" values of the config - say I have this in my onEnable:

this.getConfig().addDefault("aoe-radius", 3);
[...]
this.getConfig().addDefault("friendly-fire", false);

what do I have to call to make sure that all default fields are present in the configuration?

austere cove
#

ConfigurationOptions#copyDefaults(boolean)
FileConfiguration#save(File)

icy beacon
#

oh i haven't been calling save, that's why

#

isn't that the same as calling saveConfig()?

#

seems like it

mortal hare
#

im so happy that intellij removed that pesky gradle tasks sidebar

austere cove
#

yea I never use the built in config methods cos I want to be able to handle the exceptions myself and know when they are thrown

icy beacon
#

is saveDefaultConfig necessary or does it have another purpose? i'm confused on the docs

mortal hare
#

and added this

icy beacon
austere cove
#

#saveDefaultConfig() only copies the config.yml from inside your jar file to your data folder iff there is no config file there

icy beacon
#

big thanks, i'll try it now

mortal hare
#

i mean it still there

#

but its way cleaner

icy beacon
#

is there a tryitandsee in cafebabe

#

?tryitandsee

#

ah

mortal hare
#

youtube should add glowing effect from dark theme to white too

green prism
#

Hello everyone,
I am making a bedwars minigame plugin.
What do you think is the most effective way to reset the maps once the game is over?
And in your opinion, what is the way to prevent players from breaking blocks belonging to the base map but still being able to break those placed by them?

icy monolith
#

I have a list of locations, How do i select a random location out of the list?

quiet ice
tired star
#

Hey, I'm having problems in creating a plugin. I followed this instruction https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-vs-code/ to see how it works in a nutshell. After "installing" (as said in the instructions) the plugin my server is saying "Could not load 'plugins\demo-1.0-SNAPSHOT.jar' in folder 'plugins'. Anyone know what could've gone wrong? I quite literally just followed the instructions and can't figure out what I did wrong

tardy delta
#

why vscode

undone axleBOT
undone axleBOT
kind hatch
#

Damn, we straight up sniped each other.

hazy parrot
tardy delta
#

list.get(ThreadLocalRandom.current().nextInt(0, list.size()))

quiet ice
#

Why size - 1?

hazy parrot
#

Nah, latter is exclusive

quiet ice
#

^

tired star
#

Hey I m having problems in creating a

green prism
#

I can't handle that by this way

quiet ice
#

Resetting worlds is a bit difficult but I'd use the slime world format which probably has some way of doing it

quiet ice
# green prism I can't handle that by this way

oh sure you can. Have a gigantic bitmask to mark natural blocks, another bitmask to mark breakable blocks and the rest could be used to identify team allegiance (i.e. beds can only be broken by one team, etc.)

#

Alternatively you could use the whole byte to mark which teams can break which blocks - probably wiser approach

#

And if you need more than 8 teams use int, which supports up to 32 bits and thus teams

green prism
#

I was thinking of creating a copy of the world map once the game gets started, but...
Maybe it might become too heavy as task?

quiet ice
#

If even that isn't enough use longs which should defo be enough.
But at that point the map would be so large that such an approach is nonsensical

quiet ice
quiet ice
#

clone the (unmodified) world, transfer the players to it and delete the old (already used and useless) world

#

Do note that this is not anvil but rather the slime world format

wet breach
#

and if you need multiple worlds for multiple games, just append a unique id to the end of the world folder on each copy

green prism
icy monolith
# hazy parrot Just generate random number from 0 to list size - 1

ok but how would i do that?

    @Override
    public void run() {
        Location map = playerLocations[random.nextInt(0, list.size(playerLocations))]
        for (Player player : Bukkit.getOnlinePlayers()) {
            player.teleport(map);
        }
    }```
Like this? well it sends error for ``random`` and ``list.size``
quiet ice
#

SWM uses a different world format which is meant for smaller worlds as far as I know

green prism
quiet ice
#

copying worlds through the folder brings up the issue of having duplicate world UUIDs

green prism
wet breach
#

elaborate?

green prism
#

so prevent them from breaking map blocks

wet breach
icy beacon
#

oh

quiet ice
#

I thought it would store it in the uid.dat file

icy beacon
#

i thought tas would stand for something else lol

quiet ice
#

what is the purpose of uid.dat then?

eternal night
#

no the uid.dat is randomly generated if it does not exist

green prism
wet breach
undone axleBOT
quiet ice
#

Either check if there is already a block in the original world which you keep loaded at all times or you just have a boolean for each block to note whether they can be broken or not

wet breach
#

easier option then that

icy beacon
kind hatch
#

lmao, that needs to either be added to the ?learnjava command or we need another command for just that.

tardy delta
#

?learnjava!

undone axleBOT
icy beacon
#

yeah probably should be merged

#

let's do a pr

#

imajin do your thing

green prism
wet breach
#

load up a test server with your map, create the regions you want with worldguard, copy the world guard data to the game server. Just because you are loading/unloading worlds doesn't mean you have to delete the plugin data too 😛

tardy delta
icy beacon
quiet ice
icy beacon
green prism
#

mhmhm... Isn't it too heavy?

icy beacon
quiet ice
wet breach
quiet ice
#

The tremendous size is the location

wet breach
#

its like 200mb if anything

green prism
icy beacon
#

oh ok

quiet ice
#

Plus your worlds are likely not 256 blocks in height and you could use lazy allocations to reduce passive memory consumption

wet breach
#

probably not going to be at y 0 either possibly

icy beacon
#

if you are going to use locations, not blocks, you can create a lighter location class without yaw & pitch

wet breach
#

so you could clamp the locations as well

quiet ice
#

YOU GOTTA BE KIDDING ME

green prism
#

instead of storing locations

#

ahahah sorry

wet breach
quiet ice
icy beacon
#

is LinkedHashMap better than HashMap in terms of performance?

#

oops

wet breach
wet breach
#

it really depends on your use case

tardy delta
#

what do they mean by next()?

quiet ice
#

LinkedX was more performant ages ago, but now it's slower

green prism
#

I don't see anything wrong with using the method I had mentioned earlier anyway

#

hmhm

quiet ice
#

CPUs are faster than RAM, linkedX was useful when RAM was faster than CPU

wet breach
#

for example, while something might be O(1) and something else might be O(N) the latter could still be just fine because CPUs are insanely fast that it wouldn't matter anyways

#

the only time you really need to take this into consideration is when you are dealing with really large data sets

#

on small data sets it just doesn't matter

quiet ice
#

Also note that k/n should generally be near 1

wet breach
#

^

#

I had a youtube video where someone explained this really well

#

where they made something and people kept complaining they didn't make use of the most efficient thing

#

but in the end it didn't matter because the difference was like microseconds

icy beacon
#

alrighty thanks guys

tardy delta
#

i was wondering about the vid too

#

probably another one

wet breach
#

let me see if I can find it

tardy delta
#

wait thats 2 hours

#

not that one

quiet ice
#

There are also algorithms that are O(2^n) while another that does the same stuff is like O(n^1024+n^1023+...). The O(2^n) may be faster for small sets (purely looking at the big-O-notation), but for larger ones the polynomial algorithm fares better

#

(or was it the other way around? Idk.)

#

Too lazy to compute such large numbers

wet breach
green prism
#

wait geol

#

So... I need to install in the plugins folder SlimeWorld to use its API

#

right?

quiet ice
#

yep. also note that this is NOT ANVIL

#

I cannot stress this enough since I know that you think that it is anvil

wet breach
green prism
#

damn, I can't install third-party plug-ins, I was asked to do a "core"

quiet ice
#

then just depends on Slimeworldpaper

#

Ah no, it's called AdvancedSlimePaper

wet breach
#

that video I linked is really good to watch for those that like to always ask about most efficient methods XD

quiet ice
#

Fun fact: Hypixel uses that world format - in fact they developed it

wet breach
#

Indeed, they simply didn't need all that extra data

#

I recommend people to just create their own sometimes though

#

as use cases vary

green prism
charred blaze
#

why isnt this ^ code kicking me after 2 seconds of unactive?

quiet ice
#

Well I'm telling you that you should sacrifice running on yatopia in favour of running some other experimental paper fork

#

shudders

wet breach
#

TimeUnit.MILLISECONDS maybe this is the issue

quiet ice
#

Most unstable paper fork to exist. Was abandoned a few months ago (perhaps even a year ago by now)

wet breach
#

must have not been notable enough for me to hear about it

quiet ice
#

It basically combined all patches of many paper forks into a paper fork

#

without any QA testing

chrome beacon
#

I've seen a few Yatopia forks on mcm (bbb)

#

I can only imagine the amount of issues they must contain

#

at least Yatopia was free

charred blaze
charred blaze
green prism
chrome beacon
#

^^

wet breach
#

if it was me

#

I would just record blocks placed

green prism
#

I am also interested to know your opinion, I'm still in the planning stage

wet breach
#

store all blocks placed in memory

chrome beacon
#

Yeah just track all placed blocks

wet breach
#

your players are not going to place a million of htem

tardy delta
wet breach
#

easier to track what they placed, then what the map already has 😛

green prism
#

I
want
to
prevent
them
from
breaking
MAP
blocks...

So just as worldguard does

charred blaze
wet breach
green prism
#

Im not talking about resetting the map

wet breach
#

they don't get to break it

green prism
#

oh

#

that's AN IDEA.

tardy delta
#

easiest way: make them only be able to place and break wool

wet breach
#

there is more blocks in the map then there is of players placing them

#

and since you are only concerned about them placing, just only track that

green prism
#

thank y'all 🙂

charred blaze
#

why inst this working

green prism
#

you are kinder than you should be, thank you for you patience frost

wet breach
#

np

orchid gazelle
#

hi. how do I get the exact block the player is looking at here?

#

I am using Location distBlock = player.getEyeLocation().add(player.getEyeLocation().getDirection().multiply(5 + (selection.depth + selection.width)/4)); but it seems to be hella inaccurate

kind hatch
#

Player#getTargetBlock()

tardy delta
#

raytracing?

#

ah

charred blaze
#

geteyelocation actually gets where your eye is

orchid gazelle
kind hatch
#

What about Player#getTargetBlockExact(int maxDistance)?

charred blaze
#

can anyone see my messages?

#

looks like not

orchid gazelle
#

well, I think I have explained that bad. These blocks do not exist really, I want to get (air)block the player is looking at xy blocks far away

icy beacon
charred blaze
wet breach
icy beacon
#

@charred blaze

charred blaze
#

^

icy beacon
#

also ?cba

#

?cba

undone axleBOT
#

Pluggg#5737 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.

wet breach
#

since the former would yield air after like 5 or so blocks

tardy delta
#

tf is cba

kind hatch
#

Probably should have started with that one yea...

charred blaze
kind hatch
#

Can't be asked

icy beacon
tardy delta
#

looks like spam that command

wet breach
#

also, remember some things in the API are not thread safe

charred blaze
orchid gazelle
#

I do not want to care about anything in the world. Just set the block x blocks away from the player in the direction it is looking at

charred blaze
wet breach
#

first

#

remove all the statics

charred blaze
#

ok

wet breach
#

second, have you tried using execute?

tardy delta
#

oh no no no

charred blaze
charred blaze
tardy delta
#

put overwrites it so no need to remove

wet breach
#

doesn't mean you are using static appropriately and it just may be that static is your issue lol

charred blaze
wet breach
#

since you don't seem to understand its repercussions

tardy delta
#

so many things wrong there

charred blaze
#

i thought about that

#

thx

charred blaze
charred blaze
wet breach
#

its a synonym for consequence

#
re·per·cus·sion
/ˌrēpərˈkəSH(ə)n,ˌrepərˈkəSH(ə)n/
Learn to pronounce
noun
plural noun: repercussions

    1.
    an unintended consequence occurring some time after an event or action, especially an unwelcome one.
    "the move would have grave repercussions for the entire region"```
charred blaze
#

what is exactly wrong in the code?

wet breach
#

is there a particular reason why you are not using bukkit scheduler?

tardy delta
#

youre poorly making use of a hashmap

#

exposing collections

charred blaze
#

can i cancel bukkit_s scheduled thing if i want after some time?

wet breach
#

yes

charred blaze
#

how

wet breach
#

when you schedule the task you can store the task id for later

#

you can also cancel tasks inside themselves too

tardy delta
#

or store the whole task

charred blaze
wet breach
#

just depends how you are wanting to cancel the task

wet breach
kind hatch
charred blaze
tardy delta
#

?scheduling

undone axleBOT
wet breach
#

int taskId = (scheduler code)```
charred blaze
wet breach
#

then you invoke the scheduler api methods using that task id

#

to do things

#

like checking if the task has been executed yet

#

or cancelling

paper viper
#

which event is fired if i rightclick a firework?

orchid gazelle
echo basalt
#

I'd probably call that lens distortion

#

blocks are tiled but your camera is not

#

so innacuracies pile up

#

I'd use a BlockIterator

#

and just get the last element

wet breach
orchid gazelle
#

just a needed part of my system

wet breach
#

that doesn't really add any more context then what I have now

#

but ok

orchid gazelle
#

I want to get the block instantly when going over the edge of the block visually in first-person

wet breach
#

so you want to know the block the player can see regardless of distance?

orchid gazelle
#

distance should always be a variable that I can change

#

im using player.getEyeLocation().getDirection().multiply(5 + (selection.depth + selection.width)/4) for that, but yeah as I said thats HELLA inaccurate

wet breach
#

obviously

quiet ice
#

could it be something with integer division?

#

or is just the direction invalid?

orchid gazelle
#

depth and width are ints

quiet ice
#

Yeah, then you have the issue of integer division - should it not be intended

wet breach
#

when combined are probably not a multiple of 4

orchid gazelle
#

so I cast it to double?

quiet ice
#

or divide by 4D

wet breach
#

therefore for you are probably getting a floating point and its being cast to int thus loss of precision

mortal hare
#

it could be that integer division floors down the floating point values

orchid gazelle
#

just like that?: 5 + (selection.depth + selection.width)/4D

quiet ice
#

yep

#

everything else will be cast to doubles as-needed

orchid gazelle
#

1sec imma try that out real quick

mortal hare
#

you could ceil or use double or float

quiet ice
#

but that shouldn't solve anything outside of distance not matching

orchid gazelle
#

nop still the same

mortal hare
#

man my internet suddendly feels so slow

charred blaze
#

getServer().getPluginManager().registerEvents(new AFKListener(new AFKManager(this)), this);
can i do this? getting instance of class in another class

mortal hare
#

its not as if my download speed is bad, ping is hella bad, its like 10k ms

quiet ice
#

Use JavaPlugin.getPlugin(AFKListener.class) instead

#

Unless you are ABSOLUTELY sure that this is what you intend

charred blaze
#

uhm no?

quiet ice
#

no to what?

wet breach
charred blaze
#

someone told me to remove statics from AFKManager i did but i cant use the methods from another class

wet breach
#

so I can't help all that much

quiet ice