#development

1 messages · Page 126 of 1

dark garnet
#

well im a new developer getting started with sql lmao

icy grail
#

Yeah don't use this

#

Find something better

#

This appears to be hot garbage

dark garnet
#

o alr

icy grail
#

Like it's a library that's also a plugin

#

Sure, that's fine

#

But it can only support one connection?

#

What is this

#

What happens if you have multiple plugins trying to use it?

#

It boasts "used by spartan anticheat" but it's made by the same guy lol

#

And spartan is also hot garbage

dark garnet
#

i needa learn more about mysql lmao

#

have any recommended resources where i can?

icy grail
#

Connections aren't exactly per-database

#

One connection may interact with multiple databases, though that is rare

#

A connection is just something that lets you interact with a sql server

#

You may have multiple per plugin

#

Or you may have only one

trail burrow
#

for some reason age on beetroots is 3 not 7 like carrots, wheat and potatoes

dense drift
#

Im pretty sure there's a method to get the max age

#

Or to check if it is an adult

dusty frost
trail burrow
#

isAdult(); is for Entity not crop blocks

pulsar ferry
#

For crops you need to cast the meta to Ageable

trail burrow
#

done that but to check you need to check age and some are fully grown at 7 or 3

lyric gyro
formal crane
#

Is it possible to stop a server from the bungeecord? (in a plugin)

broken elbow
#

d;bungee ProxyServer#stop

uneven lanternBOT
broken elbow
#

^^

lyric gyro
#

Uh

#

Blitz that will stop the proxy

broken elbow
#

ah he meant spigot server

#

right

lyric gyro
#

lol

trail burrow
broken elbow
broken elbow
#

you have to host your own instance

hoary scarab
broken elbow
#

what is subservers?

broken elbow
#

ah. a plugin

#

yeah found it

hoary scarab
junior shard
#
        <repository>
            <id>central</id>
            <name>Maven Central</name>
            <layout>default</layout>
            <url>https://repo1.maven.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.4</version>
            <scope>provided</scope>
        </dependency>

I have both of these in my POM.xml, it isnt finding the LuckPerms API for whatever reason

#

Any idea? The LP API Wiki says repo is in Maven Central and to use that exact snipet for the dependency

lyric gyro
#

You don't need to add the central repo, maven already does that

#

And what do you mean by "it isn't finding it"? Do you have a log error somewhere during build or something?

junior shard
#

sec

#

@lyric gyro

lyric gyro
#

Did you hit the reload button in IJ?

junior shard
#

Yes

#

Maybe if I just save and re-open the project?

#

idk sometimes that shit works

lyric gyro
#

You should be getting an error log somewhere if you're hitting the reload button but try restarting IJ I suppose

junior shard
#

Now the error is gone Shrug

#

Java confuses me sometimes.

lyric gyro
#

It's IJ's doings

junior shard
#

well, yeah

#

still better than eclipse

dark garnet
#

how can i get boolean for if a value exists in a sql table

pulsar ferry
#

Select count of the table you want where the value is the one you want, if 0 it doesn't exist

lyric gyro
#
@EventHandler
public void onBreak(BlockBreakEvent e) {
  Block block = e.getBlock();
  if(block.getType() == Material.TNT) {
    e.setCancelled(true);
    block.setType(Material.AIR);
    
    Player player = e.getPlayer();
    PlayerInventory playerInventory = player.getInventory();
    playerInventory.addItems(new ItemStack(Material.TNT, 1));
  }
}
#

I want it to come when I break any block

#

but i don't want it to give tnt

dark garnet
dark garnet
pulsar ferry
#

If you do count yes

lyric gyro
#

I don't understand, can you send the code sample please

#

this is my code can you write how to do it?

dark garnet
pulsar ferry
#

If you do SELECT name FROM table WHERE value = ? and the value isn't there then the resultset will be empty
If you do SELECT COUNT(name) FROM table WHERE VALUE = ? and the value isn't there then the resultset will have a 0 in it

lyric gyro
#

can you edit my code?

junior shard
#

@lyric gyro nobody even knows what you’re asking for help on

#

What do you want to happen when you break any block

lyric gyro
#

my problem is that when i break a block it should come to my inventory automatically

#

I want tnt not to come

#

In the code I wrote, when I break the block, tnt comes to my inventory.

junior shard
#

But it’s only happening when you break a tnt block

pulsar ferry
#

What?

#

That wasn't replying to you

lyric gyro
#

When I break any block, I want it to come directly to my inventory so I want a code sample that works

fiery pollen
#
public void onBreak(BlockBreakEvent e) {
  Block block = e.getBlock();
  if(block.getType() == Material.TNT) {
    e.setCancelled(true);
    block.setType(Material.AIR);
    
    Player player = e.getPlayer();
    player.getInventory().addItem(new ItemStack(Material.TNT, 1));
  }
}```
dark garnet
junior shard
lyric gyro
junior shard
#

Mhm

pulsar ferry
lyric gyro
dark garnet
dark garnet
lyric gyro
junior shard
#

He wants to get the block material on block break and place it in the players inventory

#

Essentially

lyric gyro
#

No one is stingy like you

dark garnet
#

... what

junior shard
#

Chill…

fiery pollen
pulsar ferry
lyric gyro
#

yes, but when you break a block, it should come to your inventory automatically, it already comes to my inventory, but I don't want it as tnt, I want it for all blocks

fiery pollen
#

Okay, so try coding that

#

you can get the type, store it and then use it to give it to a player

lyric gyro
junior shard
#

You obviously have it set up right now to give tnt on the break of tnt

#

So when a player breaks tnt, they get tnt

lyric gyro
junior shard
#

But if they break other blocks it won’t do that

dark garnet
#
  1. cancel event
  2. set block to air
  3. get broken block material
  4. add material to player's inventory as an itemstack
    i think thats right
fiery pollen
#

This is basic java-knowledge

lyric gyro
#

i need code sample i can't code so i asked for help

dark garnet
#

i can't code
bruh

lyric gyro
fiery pollen
#

?learn-java

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

fiery pollen
#

@lyric gyro i suggest you take a look at this

junior shard
#

just get the block and material onBreak and save as variables

then in your if statement change the tnt to your material variable and same for the itemstack

#

Obviously if you only check if they break tnt, give them tnt, you will have to replicate that code for every single block in the game

lyric gyro
#

why does no one want to help i am turkish i don't understand english very much

junior shard
#

Literally IntelliJ or eclipse will do all that for you just hit enter

#

Read the Java docs for onBreak event

lyric gyro
#

I really don't understand thanks

fiery pollen
#

srnyx litterly explained what you have to do

#
2. set block to air
3. get broken block material
4. add material to player's inventory as an itemstack```
lyric gyro
#

I don't know how to edit the code

fiery pollen
#

You already cancelled the event using e.setCancelled(true);

junior shard
#

You already set to air and added a material to the players inv as itemstack too

#

You just have to get the broken blocks material

fiery pollen
#

Get the material of the block

lyric gyro
#

yes but when i break any block i want it to come to my inventory i don't want tnt just

fiery pollen
#

You already have the block, now get the type

junior shard
#

Yes that’s what we’re saying

lyric gyro
#

you can write the code

junior shard
#

Instead of tnt, you use the variable that contains your block’s material

fiery pollen
#

yes we can, but what would you learn of it?

lyric gyro
#

ooohh

#

😦

#

thx

junior shard
#

In your code the material is not “block”

#

That’s the block object

#

You need the material

#

So use that

#

And get the type

lyric gyro
#

ok how do we do this as code

junior shard
fiery pollen
#

bruh

#

Search on google, "How to get a type of a block spigot"

junior shard
#

@lyric gyro

leaden sinew
#

I would instead recommend at least the basics of

#

Yes I did mean that thank you

#

?learn-java

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

queen plank
#

I want to store a date (year, month...seconds) in a cfg file, then read it again later. What is the best way to do this? I've tried ZonedDateTime and Calendar but have not gotten it to work. Is this a good approach or is there something better?

past ibex
#

I prefer storing System.currentTimeMillis

#

that's your epoch time

#

humans don't like reading epoch time though, 1647134642 being the current epoch time is quite meaningless to us

#

but computers can easily convert epoch back to a date

queen plank
#

Is it capable of storing years though? Idk how many millis in a year but I assume a lot lol

past ibex
#

9,223,372,036,854,775,807 is long max value

lyric gyro
#

that's definitely long :^)

past ibex
#

292,471,208 years

lyric gyro
#

That's definitely a lot

queen plank
#

Enough then lol

#

Ok thanks :))

robust flower
#

I'm creating an user script (JS) to slightly modify a page's behavior. There are some buttons on the page that I wanted to set their href to the actual link, but currently they have no link, instead what they have is a Laravel backend function that is called through wire:click HTML tag. This is an example of a button that is present in the page.

<button class="btn btn-primary btn-control btn-md mr-1" wire:click="generateDownload('free_fhd')">Get FHD File</button>```
So my plan was to, for each button on the page:

- Get these buttons through CSS Selector and call `click()` on them, one by one.
- Somehow listen to redirect, grab the generated link (of `window.location.href` or something), and cancel the redirect.
- Remove all click listeners for that button.
- Set that grabbed link on the buttons as their `href`.

I would like to know if that is possible.
trail burrow
#

I got this error spammed for each table and not I get no errors when I run command but data still will not transfer I changed nothing in code for the error to go away https://paste.helpch.at/lihilakedu.sql

#

I have tried Spigot and Paper each does the same

icy shadow
#

Is this a plugin you've made?

trail burrow
#

no staartvin did and trying to update it

icy shadow
#

i dont know who that is but

#

it looks like you arent creating the tables in the database

#

cant help more without seeing code

trail burrow
#

sqlite has the tables, and if you start with SQL it works fine, just when you try to transfer data from sqLite to SQL it don't transfer says it transfered 0 db records

icy shadow
#

please show me where it has the tables

trail burrow
dense drift
#

damn

#

varN, is that decompiled code?

icy shadow
#

this is so cursed

trail burrow
#

could be why I don't understand it

dark garnet
trail burrow
#

that code works, not sure why the sqLite name needs to be the same as SQL db name

formal crane
#

Why do i get this when selecting java 17 openjdk ?

dense drift
#

you need gradle 7 for java 17 iirc

hushed badge
#

might be 7.3

#

latest is 7.4.1, just use that

icy shadow
#

AND...?

#

also please do not make queries like that, you're leaving yourself vulnerable to SQL injection

#

you should be using ? and then setting the parameters later

atomic trail
#

Matt u there? I want to add an event to method parameter for asGuiItem() in your GUI API, but not sure how

    public void addItem(Gui gui, ItemStack item, int slot, GuiAction<InventoryClickEvent> action) {
        GuiItem guiItem = ItemBuilder.from(item).asGuiItem(action);

        gui.setItem(slot, guiItem);
    }

would it just be that?

#

If so, how would the addItem method I created, be used?

tight junco
#

probably

#
addItem(gui, new ItemStack(Material.STONE), 0,  event -> {
  // func
});
dusky harness
#

since it doesn't use any variables/method besides the parameters

dusky harness
#

or you could pr ```java
public void addItem(Gui gui, int slot, GuiAction<InventoryClickEvent> action) {
GuiItem guiItem = ItemBuilder.from(build()).asGuiItem(action);
gui.setItem(slot, guiItem);
}

// ItemBuilder.java

dusky harness
#

converts ItemBuilder -> ItemStack

atomic trail
#

Ah, but the method should work with different kinds of items though, that will be specified

dusky harness
atomic trail
dark garnet
dark garnet
# icy shadow `AND`...?

thought about that, but it would have to be a set number of conditions and not "dynamic" or whatever

#

hm maybe i could append AND

warm steppe
#

preparestatement

#

or preparedstatement

dark garnet
dark garnet
# warm steppe this

no ik that, but when i sorround the ? in '' it says Cannot resolve query parameter '4' (4 being whatever the parameter index is)

warm steppe
#

what is your query

dark garnet
#

...

warm steppe
#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

dark garnet
#

"select ? from ? where ? = '?'"

warm steppe
#

iirc it starts from 0

#

so the last parameter would be 3

#

i might be wrong tho

dark garnet
#

no it starts at 1

#

just tried 0

#

removing the '' fixes it, but i think i need them

tight junco
#

you dont need them

warm steppe
#

if it works it works

dark garnet
#

o alr

dark garnet
#
public boolean valueExists(String column, String value, String[] conditions) {
    StringBuilder result = new StringBuilder(30);
    for (String condition : conditions) {
        result.append(" AND (").append(condition).append(")");
    }
}```alright so i have this ^, but it requires one of the conditions to be specified separately (`column` and `value`), how can i fix that by just having the `String[] conditions` parameter?
#

so basically i dont want the result thing to affect the first string in conditions

#

well actually i still wanna do something to the first string (add () around it), so how could i do that?

sterile hinge
#

you shouldn't build such dynamic sql queries normally. Writing the exact queries you need is recommended, otherwise you're running in a lot of issues with sql injections and stuff

dusty frost
#

prepared statements 😌

warm steppe
#

I think that it's not an sql query

#

even if it was, why would you want to make something like this

#

it doesn't even run any sql code

dusty frost
#

I mean I bet it is eventually

#

right now it doesn't even return the boolean it needs

warm steppe
#

💀

formal crane
#

So i am working with a @Getter & @Setter in my code but i can't build my plugin, it will just give this error (see screenshot below).

I have this in my main: private static @Getter @Setter HashMap<UUID, Integer> kills = new HashMap<>(); and i have this in a other class: int currentKills = KitPVP.getKills().get(p.getUniqueId());

neon wren
#

Could I see your shadowJar configuration/ as that means it cannot find the method/variable, or misspelling.

#

@formal crane If you haven't solved it yet.

formal crane
neon wren
#

As you didn't provide any classes, except a screenshot regarding the error.

#

My presumption was that based on KitPvP [shadowJar]: failed and compileJava there is misconfiguration in your build configuration.

formal crane
#

The hashmap is in my main and i am trying to acces (read & write to it) the hashmap from a other class called PlayerData

night ice
pulsar ferry
#

Looks to be a lombok issue

neon wren
pulsar ferry
#

Possible issues: lombok not configured in the build tools correct, missing the lombok IDE plugin, just lombok being lombok
My main recommendation is to not use it, but if you want to, make sure it's sertup correctly

tight junco
#

this isnt the place

#

and also

urban field
#

ok
got it

median glen
#

Hey guys, how can I store custom data for an ItemStack? So e.g. I want to make a specialized hopper behavior, and store some extra data in the hopper object, is that possible?

pulsar ferry
#

You want to store the data in the hopper item or hopper block? As in only inside inventory or after being placed

pulsar ferry
#

You need to add lombok as annotationProcessor as well

#

annotationProcessor 'org.projectlombok:lombok:1.18.20'

formal crane
#

so an implementation & a annotationProcessor?

pulsar ferry
#

Yeah

formal crane
#

ty

atomic trail
#

How would I get a specific player from the playerdata collection?

#

This doesn't work

    public PlayerData deserializePlayerData(UUID uuid) {

        // Deserializing - getting an object from json in the database
        for (Document playerDataDocument : database.getCollection("playerdata_" + uuid).find()) {
            PlayerData dbPlayerData = GSON.fromJson(playerDataDocument.toJson(), PlayerData.class);
            return dbPlayerData;
        }
        return null;
    }
#

Not sure why

twilit delta
#
public class CancelUnload implements Listener {
    @EventHandler
    public void onChunkUnload(ChunkUnloadEvent e){

        for(Entity entity : e.getChunk().getEntities()) {
            if (entity instanceof Horse) {
                e.getChunk().load();
                Player owner = (Player) ((Horse) entity).getOwner();

                Bukkit.broadcastMessage("Unloading");
                assert owner != null;
                entity.teleport(owner.getLocation());
                Bukkit.getScheduler().runTaskLater(instance, new Runnable() {
                    @Override
                    public void run() {
                        e.getChunk().unload();
                    }
                }, 40L);


            }
        }
    }
}

So im trying to teleport the players horse to them when the chunk is unloading, it says "Unloading" when a chunk with a horse gets unloaded, but the horse doesnt teleport to me. Any idea why?

lyric gyro
#

Does it make it under unloading?

median glen
#

How do I print a color formatted message using Component?
getServer().broadcast(Component.text("&8[&aACH&8] &1Hopper1"));
This broadcasts the text as it is.
(the value comes from configuration so I can't use the color overload or .color() and so on.)

pulsar ferry
#

If you're using legacy format you need to use the LegacyComponentSerializer, but I recommend you use Minimessage instead of legacy

proud pebble
#

what would be a decent way to update the block type of around 775k blocks without lagging every time the for loop ran?

#
for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
                for (int y = min.getBlockY(); y <= max.getBlockY(); ++y) {
                    for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
                        Block b = world.getBlockAt(x, y, z);
                        switch (new Random().nextInt(2) + 1) {
                            case 1 -> b.setType(Material.STONE);
                            case 2 -> b.setType(Material.DIORITE);
                        }
                    }
                }

currently im doing this,
but ive updated it so i do it like this

int counter = 0;
            for (int y = min.getBlockY(); y <= max.getBlockY(); ++y) {
                if (counter % 5 == 0) {
                    int finalY = y;
                    Bukkit.getScheduler().runTask(LunixPrison.getPlugin(), () -> {
                        for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
                            for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
                                Block b = world.getBlockAt(x, finalY, z);
                                switch (new Random().nextInt(2) + 1) {
                                    case 1 -> b.setType(Material.STONE,false);
                                    case 2 -> b.setType(Material.DIORITE,false);
                                }
                            }
                        }
                    });
                }
                counter++;
sterile hinge
#

first of all, reuse a Random instance

#

and if you only have two cases, use nextBoolean and a simple if else

proud pebble
#

wouldnt reusing the same random instance make the blocks just stone or just diorite?

#

i wanted to have random mines that have random blocks.

#

well a random spread of blocks

dense drift
#

He meant to create a single Random object.

proud pebble
#

i just realized that

dense drift
#

Also, what about worldedit?

proud pebble
#

its why i have the +1

#

so it cant return 0

proud pebble
hoary scarab
dense drift
#

Why does it matter if the result is 0

#

Could as well use nextBoolean

proud pebble
#

according to intellij it cant and its not a massive deal if a few blocks are air or not

hoary scarab
dense drift
#

d;jdk random#nextint(int)

uneven lanternBOT
#
default int nextInt(int bound)
throws IllegalArgumentException```
Description:

Returns a pseudorandomly chosen int value between zero (inclusive) and the specified bound (exclusive).

Parameters:

bound - the upper bound (exclusive) for the returned value. Must be positive.

Throws:

IllegalArgumentException - if bound is not positive

Returns:

a pseudorandomly chosen int value between zero (inclusive) and the bound (exclusive)

dense drift
#

With that +1 the result will be 1 or 2

proud pebble
#

my current method seems to have reduced lag from 80% tps loss to 20 then down to 4-5% tps loss on reset.

#

and resets would probably not be so often in 1 second.

#

ill have a look at the first or second nms methods

#

i want to implement graduel resets so that lag doesnt hit so hard

errant pawn
#

With the ChatEvent event in Bungeecord, is there a way to get the player who sent the chat message?

neon wren
#
@EventHandler
public void onChat(ChatEvent e) {
  if (e.isCommand()) return;
  if (!(e.getSender() instanceof ProxidedPlayer)) return;

  ProxiedPlayer player = ((ProxiedPlayer) e.getSender());
}
errant pawn
#

Thank you! For some reason I just didn't see it in the documentation :)

lyric gyro
#

How to fix?
[18:51:40 WARN]: Unexpected exception while parsing console command "dm help"
org.bukkit.command.CommandException: Cannot execute command 'dm' in plugin DeluxeMenus v1.13.3-Release - plugin is disabled.
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:761) ~[spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchServerCommand(CraftServer.java:746) [spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.DedicatedServer.handleCommandQueue(DedicatedServer.java:426) [spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:395) [spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1127) [spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:966) [spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) [spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at net.minecraft.server.v1_16_R3.MinecraftServer$$Lambda$3168/623059508.run(Unknown Source) [spigot-1.16.5.jar:3096a-Spigot-9fb885e-af1a232]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_51]

proud pebble
proud pebble
#

i had the idea to schedule a task to run after every 3 y levels have been reset, so it would be setting 30k blocks every tick, not sure if it would actually be better or not.

#

but not sure how to actually get it to run

#

and i crashed my test server

#

what a suprise

sterile hinge
#

you can also measure the time spent placing blocks and only do like 40ms per tick or something like that

neon wren
proud pebble
neon wren
#

I usually broke placements up to make it easier for the system.

proud pebble
#

decreasing the amount per tick

neon wren
#

Well how many blocks are you trying to place per tick

proud pebble
#

101x101x50

#

so around 510k

neon wren
#

As there is 20 ticks/second

proud pebble
#

i tried to decrease it to do around 30k in a tick

neon wren
#

With or without FAWE.

proud pebble
#

which was around 3 y levels of blocks

#

i dont touch fawe anymore

neon wren
#

Decrease the amount of blocks.

proud pebble
#

i tried and crashed the server doing it

neon wren
#

I assume this is for a prison mine?

proud pebble
#

yep

#

i also looked at what other plugins did, they are all doing the same thing as i was originally doing

neon wren
#

Let me see if I can find my old code for a old project that could do 500k/4s in a prison mine plugin I made.

proud pebble
#

im currently trying to implement an nms method of doing it

#

that i found on the spigot forums

neon wren
#

Be careful as you'll need to update the light for the individual blocks, or update it on the server end first and then update it for the clients.

proud pebble
#

im not updating the light levels

#

dont really need to

#

or atleast im not doing that rn

neon wren
#

What version of Minecraft.

proud pebble
#

1.17.1

#

thats what the version of the server im working for is using

#

EntityPlayer apparently had a chunkX and ChunkY value somewhere yet i cant find any reference to it

#

and trying to figure out what the obfuscated variable names mean is something else

neon wren
proud pebble
#

thjats what im trying to do

#

number 2

#

i dont touch nms unless i have to

neon wren
#

You'll still have to update the light levels at some point, otherwise players need to relog if you use NMS.

proud pebble
#

i sorta just assumed that i wouldnt have to touch light levels rn atleast

neon wren
#

Well if you read the second method they specify it is best for stuff such as minigame regeneration, where you would usually expect it in a server that may restart in my opinion.

#

As it says Does not send updated blocks to player (requires a relog)

#

So you are currently just trying to get the method to work I assume and don't care about the light levels until you get the placement towork itself @proud pebble?

proud pebble
#

basically

#

i just needed something faster then block.setType(Material);

#

something that wouldnt break the server

neon wren
#

Well it won't break the server if you don't place that many blocks that quickly.

#

That's why plugins on the forums have stuff such as "timed" where it takes a period of time before it places blocks.

proud pebble
#

and im completely out of my depth when it comes to nms 😅

neon wren
#

So how many blocks are you trying to place per tick again? out of the 101x101 (height 50) mine I presume it is measured for?

proud pebble
#

i was going to place atleast the first layer, so atleast 10k in a tick

neon wren
#

Reduce man that's too quick.

proud pebble
#

so then it doesnt look weird when updating

neon wren
#

That means you want to place 200k blocks/second.

#

Which is over 3x even what the thread mentions as there is 20 ticks/second.

proud pebble
#

ive seen other servers do it that fast

neon wren
#

I'd expect them to implement NMS or a system to help reduce the amount of TPS drop.

proud pebble
#

then again they have many devs and devs that probably know their way around nms

neon wren
#

If you want it to look somewhat nice, then do it from the top to bottom layer if you are using strictly setType.

proud pebble
#

im guessing thats probably why not many private mine plugins exist publicly

neon wren
#

?

proud pebble
#

because of the restrictions of how many blocks/second can be updated with just settype and setblock

#

without going into nms

#

i had considered setting blocks in chunks rather then setting them all at once

spiral prairie
past ibex
#

FAWE has an API

#

just use their API, no point of writing new code

spiral prairie
#

yea

#

that too, but i thought they wanted dependency free because it was suggested a long time ago

small arrow
#

what would be the best way to store a Player, a String, and an integer, and be able to increase or decrease the value of the integer?

kind granite
#

depends on the context

winged pebble
proud pebble
#

and thats what im doing, using nms

pure crater
#

dont recommend anyone to use FAWE please 💀

#

use WorldEdit instead

proud pebble
#

id somehow use AWE if it has an api

pure crater
#

nah AWE isn't good either

proud pebble
#

huh, resetting the 101x101x50 mine doesnt lag.

#

well it doesnt lower tps

#

it didnt lower it before either

#

maybe i can edit that many blocks a second

graceful hedge
west socket
#

Anyone know if it’s possible to assign ItemMeta to a Material.AIR ItemStack using packets?

#

I’m trying to utilize the Item Name line that appears underneath the Action Bar by using the EntityEquipment packet to send fake item renames

#

The issue though is I want it to work when the player is not holding an item

pulsar ferry
#

You can't

#

Air can't have anything at all

west socket
#

Interesting

#

I wonder if there’s another way to do this

#

Actually it might work

#

If I just send the packet with a normal ItemStack

#

Because the physical item should never actually appear in the hotbar

#

Hopefully it’s able to fool whatever controls the text under the action bar though

shell moon
winged pebble
shell moon
#

cant you simply use action bar?

#

there must be a really good reason to use something no one else in the world would use

west socket
west socket
#

My plugin already uses a lot of chat messages and uses the action bar a lot for other things

#

And I don’t really have the time to code my own bossbar API, even though it doesn’t seem that hard

#

It wouldn’t really be appropriate for the data I’m trying to display

shell moon
#

1.13 has method to create boss bar

#

anyways

west socket
#

Yup, 1.8 lol

shell moon
#

if your plugin requires so much text

#

something is wrong

west socket
#

Well it’s skywars

#

The chat is used for a lot of kill messages/perk proc messages

#

Action bar is used for damage indicator

#

I’m implementing a gold system

shell moon
#

skywars = text
hit indicator = action bar

#

that's it

#

no more text fields are required

#

honestly, no more

west socket
#

I’m adding a system where players get gold from chests that they can use during the match

#

And I need a good way to display that

#

You need to be able to easily see how much you have left while attacking

#

Which is why bossbar/scoreboard wouldn’t work

shell moon
#

action bar

#

gg

west socket
#

I guess I could append it to the end of the damage indicator

#

Would look a little unclean though

shell moon
#

thats what

#

normal people do

#

dont get me wrong but

#

overcomplicating simple stuff

#

is bad

west socket
#

I mean code wise it may be over complicating

#

But not with the final product if it ends up working

#

I wonder if that would looks aids with a subtitle

shell moon
#

indeed

#

it will

#

thats why normal people use action bar

#

for everything

#

or even scoreboard

#

adding a (+5 gold)

#

as ThePit used to do

#

i think

#

i dont remember

west socket
#

Haha that’s funny

#

My entire server is a pit parody

#

The pit used chat for kills and assists

shell moon
#

as normal

#

to be able to click recap

west socket
#

But this is something that’s going to be subtracting gold on a per hit basis

#

I don’t know, I’m going to give the item name thing a shot

#

And if it doesn’t work I’ll just append to action bar

shell moon
#

dont send packets to client without a good reason, always causes issues

#

if you plan to give real items, then be ready to intercept and prevent players from throwing and do stuff with it

west socket
#

Pain

hoary scarab
#

@west socket why not just send an actionbar message?

dark garnet
#
public String[] getAll(String[] columns) {
    StringBuilder result = new StringBuilder(30);
    if (columns.length < 1) {
        for (String column : columns) {
            if (!Objects.equals(column, column.split(",")[0])) {
                result.append(", ").append(column);
            }
        }
    }
}```why am i getting this? https://srnyx-needs.to-sleep.xyz/IzrituE4n2.png
i think ik y but im not sure how to fix it
shell moon
#

@dark garnet because columns

#

is always empty

#

**Clue: **||do u know any number lower than 1 has is greater than 0?||

hoary scarab
shell moon
dark garnet
#

there are 2 strings, "UUID" and "USERNAME", right?

shell moon
#

do you understand

#

what i said?

#

"columns" is always

#

read: always empty

#

if columns.length is lower than 1

#

get the idea?

#

its like saying

#

if(integer < 1) {
if(integer > 10) { //IDEA will say: "statment is always false"
//this will never run
}
}

dark garnet
#

omg

#

im so stupid

#

bro i thought that < 1 meant greater than 1 😭

shell moon
dark garnet
#

what would result parse if the loop is never run?

#

would it just be like ""

shell moon
#

what?

dark garnet
#

like if used result.toString() later what would that come out to if columns.length == 1

shell moon
#

why would use it result toString

#

if its an array

dark garnet
#

result is a StringBuilder

shell moon
#

ahh i meant columns lmao

#

empty string builder is

dark garnet
#

with the space or without? (i assume without)

shell moon
#

yes, without

#

at least, afaik it should

#

return empty

dark garnet
#

alright and what about Arrays.toString(columns).split(",")[0] (if columns.length == 1)?

shell moon
#

wtf

#

man what are you even trying to do

#

this is an xyproblem

dark garnet
shell moon
#

question was

#

what are you trying to do

#

i seriously see no point

#

to do that

#

lol

dark garnet
#

im trying to get all values in all of the columns

so i have to append , to each column for it to work in the mysql statement
but i cant append it to first string or else it'd be SELECT , column1, column2, column3 FROM ? which would be invalid syntax
so i only append it to every string except the first one
but then result doesnt include the first string, so i have to input it manually which is what ps.setString(1, Arrays.toString(columns).split(",")[0]); is for

but i also want the method to support single strings (ex: new String[]{"PLAYER"})
so if there is only one string, i want result.toString() to output (nothing)
and i wanna know what Arrays.toString(columns).split(",")[0] would output if there is only one string
cause if there are is only one string, there are no ,, so im not sure if it'd be able to split

oh also another question, is new String[]{"PLAYER", "UUID"} the same as new String[]{"PLAYER","UUID"}?
or would i have to account for the space in Arrays.toString(columns).split(",") (so it'd have to be Arrays.toString(columns).split(", "))?

west socket
#

So I’m attempting the item name stuff lol, so far the issue I’ve ran into is that despite the documentation saying that slot 0 is your main hand, it puts it on the boots lol

edgy wedge
west socket
#
 public static void sendItemName(Player player, String text) {
        ItemStack item = new ItemStack(Material.SIGN);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(text);
        item.setItemMeta(meta);

        PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment(player.getEntityId(), (short) 0, CraftItemStack.asNMSCopy(item));
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
    }```
bold ridge
west socket
#

According to this protocol, slot 0 should be the item in your hand

#

It seems that 0 is boots though

edgy wedge
bold ridge
#

1.8.8

#

:/

#

Thanks for telling me about that

#

Oops, not a 1.8 method. Funny 10 year old version of minecraft moment

edgy wedge
#

Can't help you much then other than telling you to consider to upgrade to a newer MC version or play around with it until you get what you desire, but expect support for old versions to be scarce

surreal lynx
#

How come I can't get the color after creating this try statement?

bold ridge
edgy wedge
lyric gyro
#

Try monad 😌

surreal lynx
dark garnet
#

another question lmao
when i use ps.setString (ps is a PreparedStatement) it always surrounds it with '' when setting the string, how can i prevent that?

#

example:java String name = "hello"; PreparedStatement ps = Main.SQL.getConnection().prepareStatement("?"); ps.setString(1, name);would come out to 'hello', but i instead just want hello

lyric gyro
#

well yeah because a string is defined by quotations

#

that's how the sql engine handles it

dark garnet
#

how do i fix it?

lyric gyro
#

there is nothing to "fix"

dark garnet
#

how do i remove the '' around the string then

lyric gyro
#

you're telling sql "I want a string with this content" and that's what it produces

#

what are you trying to achieve here?

#

why do you so need it without the quotations?

dark garnet
#

cause with the apostrophes it makes the statement invalid

night ice
dark garnet
night ice
dark garnet
lyric gyro
#

Table names are not values, ? is a value placeholder for things like insert and update

night ice
lyric gyro
#

Table and column names go as-is or surrounded by backticks `

dark garnet
night ice
#

Also please don’t complicate things by using StringBuilder…while you can just add it by normal queries

night ice
# dark garnet wdym?

There is no need of using the StringBuilder There to just add them to to table name…you can just do it regularly….

dark garnet
#

its meant to like be dynamic

#

so if i wanna create a new table i can just do new GetSQL("table_name").createTable(new String[]{"POINTS", "XP"}) or something

night ice
#

Then instead of setString() concat it directly…as u know what would be the use case there right….

Bcs as Emilly said, table name isn’t a value there

dark garnet
#

wdym by not a value?

#

what makes something a value?

night ice
dark garnet
#

so instead of something like this:

PreparedStatement ps = Main.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS ? (ID INT(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID))");
ps.setString(1, name);```it'd just be this?```java
PreparedStatement ps = Main.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS " + name + " (ID INT(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID))");```
night ice
#

Yeah

dark garnet
#

what about sql injection? when should i be concerned about it?

night ice
dark garnet
junior shard
#

https://pastebin.com/5FnQhQDB

When I right click on the sign

[Exam]
Exam1

It is not sending my debug message in chat. Anyone know why this is happening?

Config is as follows:

Exams:
  Exam1: # // You can name each exam whatever you'd like \\
    permission: 'cityrp.exam.take' # // (Prerequisite) - Set this to "cityrp.exam.take" to not require a prerequisite permission. \\
    Questions:
      question1:
        a: 'Answer 1'
        b: 'Answer 2'
        c: 'Answer 3'
        d: 'Answer 4'
        Correct Answer: 'a'
#

@grim oasis maybe you know, im pretty sure you made my old old exam sign plugin?

dark garnet
junior shard
#

Yes I am opped

dark garnet
#

try deopping

junior shard
#

So, it works if I put that line of code in my ExamCreate listener

#

just not if I right click the sign, which I find odd

#

@dark garnet

dark garnet
#

worked?

junior shard
#

No, thats if I put the loop into my sign create listener

dark garnet
#

oh

junior shard
#

It shows the debug there, but it doesn't show the debug when I right click the sign

dark garnet
#

try adding multiple debug msgs inside each bracket

#

to find where its failing

junior shard
#

alright

junior shard
dark garnet
#

ah yea thats what i thought

#

are you sure its 1?

#

cause wouldnt that be [Exam]

junior shard
#

Yeah, line 1 would be the name of the exam

#

No line 0 is [Exam]

#

right?

#

unless it switches up lol

dark garnet
#

before that if statement put e.getPlayer().sendMessage(sign.getLine(1).toString()); or whatever it'd be

junior shard
dark garnet
#

o might be cause of if (sign.getLine(0).equalsIgnoreCase(ChatColor.translateAlternateColorCodes('&', sHeader)))

#

so put before this ^

#

ok wait nvm javadocs literally says 0 will return first line

#

so dont think its cause of that

junior shard
#

Maybe the color codes?

#

That must be it

#

what if I strip color

dark garnet
#

yea thats what im thinking

#

(ChatColor.stripColor(sign.getLine(X)).equals(Y)) i think?

junior shard
#

not exactly sure where the "boolean" is coming from considering "key" is a string

#

if (sign.getLine(1).equalsIgnoreCase(examNameColor + key)) {

I will just try this lol

dark garnet
#

ur providing a boolean (cause of the .equalsIgnoreCase(key)) for ChatColor.stripColor, it needs a String

#

so u just need to put .equalsIgnorecase(key) outside of ChatColor.stripColor()

junior shard
#

Oh

#

yeah parenthesis were wrong

#

if (ChatColor.stripColor(sign.getLine(1)).equalsIgnoreCase(key)) {

#

still failing

dark garnet
# junior shard

it looks like there is a space before Exam1, is that cause of the debug msg?

#

if its not cause of the debug msgs u could use .trim() to get rid of it

junior shard
#

My god i'm glad your eyes work

#

Alright that worked.. I don't even know why I put a space between the exam name color and the text

junior shard
#

I want to only send them one question at a time, after they answer the question, it sends the next one

dark garnet
junior shard
#

Im sure everything I code has a much easier way PepeLaughter

#

But thank you

junior shard
# dark garnet same lmao

Oh wait, but I need to be able to add as many questions as I want, not define it to a set amount of questions

#

That example would only give me the first question, then if I changed the 0 to a 1 it would give me the 2nd question -- But doing this I would have to manually code this for a set amount of questions

dark garnet
# night ice Loop

I need to remember to use loops more ig cause I’ve been running into the same issue lmao

junior shard
#

In config: amount of questions: 3

#

then for (int i = 0; i <= qAmt; i++) {

#

yeah?

night ice
#

Either that way..or you could get the iterator of ConfigurationSections#KeySet()

grim oasis
#

the old and horrid method I used to load exams from config

#

if you want it

night ice
#

oo..lordd xD

grim oasis
#

yes, this was quite a few years ago when Drew asked for this 😂

junior shard
#

I couldnt remember if it was you or another guy who made it

grim oasis
#

==>

junior shard
#

lol

terse kelp
#

hello people

#

I'm trying to add my own placeholders to my plugin

#

is there any good tutorial out there?

tepid patio
#

Hi, when i try to import PlaceholderAPI libraries it drops me this error:

The import:
import me.clip.placeholderapi.expansion.PlaceholderExpansion;

The error:
The import me cannot be resolved

I am using eclipse IDE with a spigot 1.18.1 jar, java 17 and I have set up the placeholder api external jar

robust crow
hoary scarab
#

Oh NVM I instanced DoubleChestInventory not DoubleChest

dense drift
#

yeah, DoubleChest is the block

#

debugging is hella good

hoary scarab
#

The others tabbed the correct DoubleChest instanceof tabbed DoubleChestInventory for some reason.

dense drift
#

Any idea if using a PermissionHolder, permissions will also be set on plugins like LuckPerms?

hoary scarab
dense drift
#

is not

lyric gyro
#

PermissionHolder?

dense drift
#

PermissionAttachment***

#

looks like a temporary permission

lyric gyro
#

I can't speak for other plugins but LP will preserve Bukkit's behavior and include it but it won't be saved

dense drift
#

yeah, I need it to be saved, will use vault

ocean raptor
sudden sand
#

Hi having issue with maven

#
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
#

always prints me this message no matter what java version I'm using

#

command I use is "mvn clean package"

#
<properties>
        <maven.compiler.source>16</maven.compiler.source>
        <maven.compiler.target>16</maven.compiler.target>
    </properties>
pulsar ferry
#

Iirc that's caused by the shade plugin version not being updated for latest Java versions
Search for the versions of "maven shade plugin" and use latest

dark garnet
ocean raptor
#

weird

pulsar ferry
#

Either that or the compile plugin version

#

Don't remember exactly, sorry I'm not used to maven ugh

sudden sand
pulsar ferry
#

Hmm, can you send the pom?

pulsar ferry
#

Line 18

surreal lynx
#

I know the code of the plugin isn't great (it's just a fork i made to add a few little things, i'm learning java so I will try to improve it soon), but can someone tell me why every fishing rod is a grappling hook on my main server, but on my test server only the correct ones are grappling hooks?
https://github.com/lucian929/GrapplingHook/blob/master/src/main/java/net/maploop/commands/MainCommand.java
I have a feeling some plugin is messing with the meta the plugin uses to check if an item is a grappling hook, but I'm not sure what a better method would be to store the data

high edge
#

Are you using lore/display name to check it or what?

high edge
#

Please don't do that

#

use PDC (persistent data container)

surreal lynx
#

Will do

sudden sand
#

r

sudden sand
#

hate maven

pulsar ferry
#

Yeah I don't know then 😦
And same
Is moving to gradle not an option?

forest jay
#

is there a way to replace a items texture with another if the same equals something without optifine? (using a resource pack)

upper jasper
#

Not really, you could use custommodeldata though

turbid yoke
#

Guys, I want to make text animation. How can I make the text blink in colors?

trail burrow
#

@sudden sandI have noticed that some errors don't go away unless you make the change in your pom then close IDE and open it again

west socket
turbid yoke
west socket
#

That’s tricky

#

Depending on how fast you want it to blink

neon wren
#

Is it a item in a player inventory or a GUI

west socket
#

^

turbid yoke
#

I want to make animation with one line of the lot of the item

#

can you give me the example of that?

west socket
#

Lot?

turbid yoke
#

no

west socket
#

Do you know how to make an ItemStack?

turbid yoke
spiral prairie
#

what

west socket
#

You should learn spigot first

neon wren
spiral prairie
#

wab you learn how to do that first?

west socket
high edge
#

3 people trynna help a single person, poor dude

turbid yoke
#

Is it possible to implement this in DeluxeMenus?

west socket
#

Oh god

#

I don’t think you know what this channel is

turbid yoke
#

lol

#

i am sorry

#

this isn`t need me channel

neon wren
#

Nothing to be sorry about, it's perfectly fine. EDITED: People make mistakes and it happens.

hoary scarab
graceful hedge
#

why async

hoary scarab
#

Since they (custom inventories) don't affect the world.

graceful hedge
#

but like async wont make it more performant really, it hurts both performance in this case, and it makes the code not thread safe

hoary scarab
# turbid yoke Thank you!

Its pseudo code so adjust accordingly. Also its just something to read to know what to do. I wouldn't recommend copying it exactly.

hoary scarab
graceful hedge
#

the problem isnt the code itself, but when you start creating abstractions you'll forget the implementation which can cause severe issues. but as said its totally redundant and unnecessary to do every little thing async

#

like, ::runTaskLaterAsynchronously might have to allocate a new thread and start it

#

which is everything but cheap

#

since it uses a cached thread pool in the end

hoary scarab
graceful hedge
#

main thread?

#

server thread I suppose you mean? that code will have negligible impact if anything

hoary scarab
west socket
#

I love how you guys are arguing over a piece of code that was given to a guy who doesn’t know what an ItemStack is

graceful hedge
#

there's no concept of a main thread, just the server thread where the majority of the server logic gets executed on

hoary scarab
graceful hedge
#

idk

hoary scarab
#

You literally just defined it yourself.

graceful hedge
#

main thread is relative

hoary scarab
#

Server thread/ main thread == same thing

graceful hedge
#

server thread is not

#

no not at all if we're being pedantic

#

anyways you really have to stop using async for every little thing, it does not help performance whatsoever, merely a premature optimization, good bye

hoary scarab
graceful hedge
#

hm?

#

stop trolling around

hoary scarab
#

Spawn over 1k particles sync 😉

lyric gyro
#

that will make literally no difference lol

#

particles only exist to the client, it's just a packet being sent on the server's end

#

and 1k is nothing

hoary scarab
loud sorrel
#

hey so this isnt rly a spigot question, more of a computer anatomy question. i want to try programming led strip lights and i dont have an arduino and my raspberry pis not here. can i connect it to my computer until i can get one? i just cant find a good tutorial if someone can point me in the right direction ty

west socket
#

Having a ton of packets sent will absolutely kill tps

hoary scarab
west socket
#

Have you ever had a hologram displaying placeholders to over 200 people at the same time

lyric gyro
#

That's the nature of sending too many packets, packets are always sent sync, when dispatched async they get put in a queue that is flushed on connection ticking (ticked by server thread)

graceful hedge
#

^

lyric gyro
#

"send async" doesn't mean anything

shell moon
#

so async is not async

graceful hedge
#

it might be understandable if you got some particle animation calculation you wanna do, but even then, java and the jvm is fast, it knows a lot of tricks, by using async you're hindering certain jvm and jit optimization stuff from being invoked

(well if used erroneously which is 80-90% the case of all code I have read so far on spigot)

west socket
#

I wish I could somehow have citizens run async

graceful hedge
#

for what purpose?

west socket
#

I have a lot of bots on my server with custom attack events and movement patterns

#

And they tend to be really hard on the main thread

graceful hedge
#

well, thing is chances are they would be even harder if you'd split it up and push it over to a thread / thread pool

west socket
#

Hmm yeah maybe

graceful hedge
#

like you need to implement proper locking mechanisms

#

which, yes affects performance in terms of speed

west socket
#

I would also need to use my own citizens fork I assume

graceful hedge
#

mye

#

and then you'd also pretty much have to setup some annoying tests to test atomicity (to make sure you didnt write anything wrongly)

west socket
#

Not worth the effort

#

I’ll just find more ways to optimize my end of the code

graceful hedge
#

mye

hoary scarab
#

Async means it runs later then sync. So it runs everything on the main thread that needs to be ran before moving on to queued threads

graceful hedge
#

async usually isnt an optimal solution

west socket
#

fawe moment

graceful hedge
# west socket Not worth the effort

well problem is, if you dont test your code that is multithread-implemented you have 0 way of telling if it will run into some concurrency update problems

#

especially when the software is supposed to scale

west socket
#

Yeah

hoary scarab
graceful hedge
#

what do you mean by this

#

I mean even if async is a viable solution, its rarely ever an optimal solution, especially in object orientation where you really try to abstract away implementation

loud sorrel
#

hey so this isnt rly a spigot question, more of a computer anatomy question. i want to try programming led strip lights and i dont have an arduino and my raspberry pis not here. can i connect it to my computer until i can get one? i just cant find a good tutorial if someone can point me in the right direction ty

icy shadow
#

running on another thread means the jvm doesn't optimize code

#

???

lyric gyro
#

you don't optimize code

spiral prairie
#

from my experience, Player#spawnParticle works just fine with thousands of them. No TPS drain afaik

winged pebble
tight junco
#

I believe World#spawnParticle might hurt fps significantly

graceful hedge
# icy shadow sorry what

Myes, if you for instance split up a big computation task into smaller ones and send them to a work stealing pool

#

Some of the optimizations may not be invokable (like generally when it comes to concurrency, things become a lot less predictable for both us and the jvm, and to some extent jit)

loud sorrel
#

i have a controller just dont know how to connect the lights to my pc and change them w code

winged pebble
#

Is it a programmable controller?

loud sorrel
#

i dont think so

winged pebble
#

I'd assume without a programmable controller, then there isn't too much you can do. (You could probably make something that might work with RGB interfaces if your motherboard supports it)

atomic trail
#

What exactly does these signs mean? I wanna update to Master branch

spiral prairie
tight junco
#

idk ive crashed a server with particles a few times

#

i think

dark garnet
#

im getting a syntax error with this mysql statement: [WORLD_XYZ_BLOCK] FROM v_locked (cause of the [])

[WORLD_XYZ_BLOCK] = Arrays.toString(columns).split(",")[0]

i tried doing (Arrays.toString(columns).split(",")[0]).replaceAll("\\[]", "") but that didn't work, any ideas?

dense drift
dark garnet
atomic trail
#

Yeah I knew it was a conflict, just not what exactly was from where, but it kinda makes sense, it just sometimes duplicates some stuff

dark garnet
#

its cause u didnt merge upstream before making changes

#

so u made changes to master and then edited old code and tried to merge that old code into the new code

dark garnet
shell moon
#

Day7: Still dont get what are you doing that lol

dark garnet
# shell moon Day7: Still dont get what are you doing that lol
  1. i input a String[] (columns) [ex: new String[]{"WORLD", "XYZ", "BLOCK"}]

  2. if columns has more than 1 String, it will append , to each String except for the first one to make result [ex output: ", XYZ, BLOCK"]

  3. then it will run this statement: "SELECT " + Arrays.toString(columns).split(",")[0].replaceAll("\\[|]", "") + result + " FROM " + name

Arrays.toString(columns).split(",")[0].replaceAll("\\[|]", "") = WORLD
result = , XYZ, BLOCK (empty if columns only has 1 String)
name = table name put in via constructor

and it returns new String[]{ps.executeQuery().toString()} (not sure if this part actually works)

#

yeah just realized that return statement probably doesnt make any sense

#

cause its literally converting to a single string (how does that even work lmao, this gets all the values in each column specified) then putting it into a String[] (ex: String[]{"entire output"}) lmao

#

so im gonna have to figure out what ps.executeQuery().toString() outputs

shell moon
#

wtf man

#

why are you even trying to do that wtf

cerulean birch
#

anyone got tips for doing async io? I have a plugin where I use the BukkitScheduler#runTaskAsynchronously to do a mix of parsing Files into JsonObjects and writing JsonObjects to Files, I wanna be careful to make sure data doesn't get corrupted/synchronization problems don't pop up

lyric gyro
#

welcome to concurrency

dark garnet
#

anyways, another issue (with same method):

ResultSet rs = ps.executeQuery();
List<String> fResult = new ArrayList<>();
if (rs.first()) {
    while (rs.next()) for (String column : columns) {
        fResult.add(rs.getString(column));
    }
    return fResult;
}```if there is only one value present it wont return it cause of the `rs.next()` (i think thats why)
i tried doing `for (String column : columns) while (rs.getString(column) != null)` but that just made the plugin hang on start
shell moon
#

i dont get what you wanna do tbh

#

i mean, whats the reason lol

#

not what you are trying to do to achieve that

sterile hinge
dusty frost
#

from what i've heard JVM escape analysis isn't super great as it doesn't have too many options since there aren't like stack allocated objects or anything

sterile hinge
#

that hasn't to do much with stack allocation, but the analysis is somewhat conservative. Graal for example can do partial escape analysis

sand ermine
#

Anyone recommend a good obfuscator?

robust crow
#

You'll most likely find people here will push for open source

dense drift
#

none

worn jasper
#

Open source is poggers

hoary scarab
flat anchor
#

Open source is best obfuscation

sterile hinge
#

Not knowing the language is the best obfuscation

lyric gyro
#

just write in any FP language

graceful hedge
#

lol

past ibex
#

open source is the best DRM and obfuscation

hoary scarab
past ibex
#

Yes it is, people can't steal your code into a proprietary plugin if everyone has access to your code

#

People will notice that it's stolen from X open source plugin

hoary scarab
#

Open source is literally "steal this code to use in your own projects" xD

past ibex
#

wow, I think I should really start decompiling + cracking your project to check for stolen code then

lyric gyro
#

open source licenses are a thing, y'know

hoary scarab
past ibex
#

so you trust that no one will deobfuscate and steal your code?

hoary scarab
lyric gyro
#

obfuscation is utterly useless

#

look at minecraft

#

nothing stopped the community from completely reversing it

#

That’s not completely true lol

#

Minecraft’s obfuscation is shit

hoary scarab
#

Minecrafts "Obfuscation" just changes the variable names. They aren't trying to hide their code.

lyric gyro
#

obfuscation != code mangling tho

#

There’s powerful obfuscates out there

hoary scarab
#

My Obfuscator makes what ever I want I's and L's; Strings, methods etc.. And remapps.

lyric gyro
#

so.. renaming

pulsar ferry
#

Not even the best obfuscation will prevent that

lyric gyro
#

All depends on your situation, if you’re selling your product idk why you’d open source it

#

Nobody would buy it then

#

Cause they already have it

grim oasis
#

well

#

not true necessarily

pulsar ferry
#

Citizens, Guilds, VoteParty

neat pierBOT
#
✨ Channel Cleaned!

• Removed 50 messages.

spiral prairie
hoary scarab
#

If a plugin.yml contains depend: [<pluginname>] will this plugin run onDisable() before or after the plugin its depending on?

hoary scarab
spiral prairie
#

You can just look at the log

#

No need for debug

past ibex
#

I don't see why it would

hoary scarab
past ibex
#

don't see anywhere in the code other than startup where it references depends

hoary scarab
#

well seems like it unloads based on depend order. So I don't think thats my issue then which kinda sucks cause I was hoping it would be that easy lol

past ibex
#

but it probably just unloads based on the order things load...

hoary scarab
#

Either way the plugin that depends says unloaded before the depended on plugin

past ibex
#

yeah, it does. Unload order is based on load order

hoary scarab
#

The issue was I forgot to add the object to the list that is checked onDisable

west socket
#

This should work right?

public static boolean isFull(Chest chest) {
        for(int i = 0; i < chest.getInventory().getSize(); i++) {
            ItemStack itemStack = chest.getInventory().getItem(i);
            if(isAirOrNull(itemStack)) return false;
        }
        return true;
    }```
#

Keeps returning the wrong value

winged pebble
#

What does isAirOrNull do exactly?

dusky harness
west socket
#

Oh I didn’t know about that method

#

Thanks

proud pebble
#

sorta makes sense

dark garnet
shell moon
#

What are you doing?

#

Ban system? Minigame?

dark garnet
#

locking system

#

it stores the world, x, y, z, and block type in WORLD_XYZ_BLOCK, the locker in LOCKER, and the person that placed it in PLACER

#

and on start it checks each location in WORLD_XYZ_BLOCK, if the block type at the location isnt the same as whats stored, it will set LOCKER to null

#

so to do that i need to get all values in WORLD_XYZ_BLOCK, and for each value it gets the world, x, y, and z, which is put into a Location

#
public void check() {
    List<String> list = new GetSQL("locked").getValue(new String[]{"WORLD_XYZ_BLOCK"});
    if (list != null) for (String key : list) {
        String[] split = key.split(",");
        Location loc = new Location(Bukkit.getWorld(split[0]), Double.parseDouble(split[1]), Double.parseDouble(split[2]), Double.parseDouble(split[3]));
        if (!loc.getBlock().getType().name().equalsIgnoreCase(split[4])) {
            new GetSQL("locked").setValue("WORLD_XYZ_BLOCK", new LockManager(loc.getBlock()).getId(), "LOCKER", null);
        }
    }
}```
shell moon
#

ahhhhhhh

#

you dont need all columns then

#

you need all rows

#

or im wrong

dark garnet
#

why?

shell moon
#

why what?

#

i doubt you create a column

#

every time you save a new location

#

that would be simply dumb

#

you probably insert a new row right?

#

(but column is not the same as row)

dark garnet
#

every time a block is placed it creates a new row with the block's WORLD_XYZ_BLOCK and PLACER, LOCKER remains null
PLACER is used to check if the person trying to lock the block placed it, but it only saves blocks which are lockable

shell moon
#

i know that

dark garnet
#

o

shell moon
#

question is why you said

#

"i need to get all columns"

past ibex
#

I hope you do a lot of caching as without caching this code will perform terribly

shell moon
#

HashMap<Location,Locker> ea = new HashMap()<>

#

prob

#

so you need to loop all rows

dark garnet
shell moon
#

not columns, right?

#

why columns

#

thats my question

#

idk if you get the difference between

#

column and row

#

thats why im confused

#

why would you have more than 4 columns

dark garnet
#

i have 3 columns

shell moon
#

ok

#

why you need to "loop"

#

those 3 columns

#

if you already know

#

the name of the columns

#

you "loop" when you dont know how many you have

#

if you have 3 with names

#

locker, type, owner

#

then you simply get them

#

which leads to my question again

#

WHY you need to loop all columns

#

if you have only 3

#

you probably meant "loop rows" instead?

#

that's what is confusing me

#

i dont understand what you trynna do

#

and why you would loop columns

#

you get my concern?

dark garnet
#

hm

shell moon
#

you dont?

dark garnet
#

sorta

#

this part right? for (String column : columns)

shell moon
#

yeah

#

thats the question

#

why would you loop columns (of the database)

#

if you have only 3

#

i wonder why

#

if its a locked system

#

you simply load all rows on start

#

and check on diff events like break block, interact, etc etc

#

and save on stop

dark garnet
#

but i dont want all rows

shell moon
#

but why columns

#

ok, i'm officially

dark garnet
#

i only want the values in WORLD_XYZ_BLOCK

shell moon
#

confused

#

thats

#

a

#

row

dark garnet
#

oh i thought u meant like entire row

shell moon
#

irrelevant

mint verge
#

Have you thought about using Terry's Ring0 Columns hashing mechanism @dark garnet ?

shell moon
#

you can simply set it to pick only WORLD_XYZ_BLOCK column

#

but why would you need to loop all columns

#

if you only have three

#

you probably made a mistake

#

and meant "loop rows" all this time?

mint verge
#

ResultSet

#

hello

shell moon
#

question is why he wants to loop "columns"

#

not rows

#

tahts my question, since yesterday

dark garnet
#

ik y i put it but i dont know how to explain 😩

shell moon
#

i dont think you know what you mean with that

rose oxide
#

but like also whom care if hes looping cols

mint verge
#

The only reason why u'd loop columns is if you don't know the column's content

shell moon
#

i mean, you have 3 columns

dark garnet
shell moon
#

if you had unknown number of columns

#

i'd understand

#

but with only 3

dark garnet
#

its a dynamic method, meant for any amount of columns

mint verge
#

@dark garnet Let me ask you this do you know what are the columns you need to get the info from?

dark garnet
mint verge
#

why

dark garnet
#

huh

shell moon
#

lmao