#help-development

1 messages · Page 715 of 1

echo basalt
#

I mean shit are you going to completely submit to a design company?

#

didn't think so

#

It's just BS marketing

#

for a decision that was forced on them

eternal night
#

the fact the non pro one has usb-c type 2 is the wildest shit

sullen marlin
#

Courage

eternal night
#

like

#

what was the reason

remote swallow
#

money

echo basalt
#

money

sullen marlin
#

Courage

echo basalt
#

if you want to like

#

transfer files

echo basalt
#

imagine you're a photographer or some shit

#

you gotta buy the pro

#

otherwise

#

fuck you

eternal night
#

🙃

echo basalt
eternal night
#

I wonder how/if they'll handle the repairable battery thingy

echo basalt
#

the apple engineer after dedicating 5% of the A17 soc to usb3

eternal night
#

tho that is far away, 2027 iirc

sullen marlin
#

Did you see the diy battery thing you can buy today

remote swallow
#

nah thats only a few years away

upper hazel
#

plugin for auto mine

echo basalt
livid dove
sullen marlin
#

They ship you like a 200kg kit

upper hazel
#

fuck deep customization

echo basalt
#

lmfao

eternal night
remote swallow
echo basalt
#

yeah they ship you some monster

#

that you gotta use and ship back

livid dove
#

Bro send the specs my way and I'll work with ya to get it out the door for deadline if it isnt ridiculously soon

echo basalt
#

and if you don't they charge you 20 grand or somn

remote swallow
#

is that jerry

livid dove
remote swallow
#

that looks like the jerry background

upper hazel
remote swallow
#

nope

remote swallow
echo basalt
scenic onyx
livid dove
#

@sullen marlin considering @ivory sleet has muted my ass for hours for "spam" in the help dev channel before can we maybe move the funni apple stuff to anotehr channel as folk in here rn are wanting help

fossil flax
#

how can i execute command on player that are not in the server?

remote swallow
#

1200 hundred to repair a battery you can get done by a shop for 50 bucks

upper hazel
#

how is it written in English when they connect <<automatic> <mine>

scenic onyx
#

player#performCommand

eternal oxide
#

player is not on the server so it can't issue commands

remote swallow
scenic onyx
small current
#

Fancy codes

remote swallow
#

an auth plugin?

fossil flax
remote swallow
#

thats because its handled inside of that plugin

#

so its able to make a queue for when they relog

fossil flax
#

it just shows that the player is offline

"You activeted fly for playerName (offline/online)

dusty kiln
#

Hello everyone. i want to match coord in overworld and nether. bypass */8 of default. but im stucking when tried to do that here is my listener demo https://ibb.co/YPHSmVL

sullen marlin
remote swallow
#

@livid dove basically a prison server except the blocks become cobble stone and get upgraded, no idea how that works if its a full mine but hey ho,

#

would take like 30 min to an hour prob

upper hazel
#

full setup of NPCs, cases, logic of the automine itself, interserver connection, etc.

#

this is fucking hard

remote swallow
#

npcs use citizens api, most likely only ores so make it config, inteserver stuff is pointless just use sql db

#

would probably take like a week at my current schedule

sullen marlin
#

Or just use the above plugin

upper hazel
#

I didn't give a complete description

remote swallow
#

he most likely had more info that i do

dusty kiln
# sullen marlin The coords in the location are already the real coords

Sorry, I am quite new in java. As you can see I have set getX-Z / scalingFactor by default to 1. That means it will multiply and divide by one. but when I tried it, it didn't seem to be very effective. The logic returned is very normal, but the actual coordinates when moving and creating gates are still / 8

sullen marlin
#

Multiplying and dividing by 1 does nothing

#

That's math

#

If it's been divided by 8 and you want it back to the original, then you multiply by 8

dusty kiln
#

I understand what you mean. but I want for example the player in the overworld with coordinates 300,80,300. then when going to the nether it will be 300,80,300. not 37.5,y,37.5

livid dove
#

@remote swallow wanna help this guy out with me? Could be banter, never got to code with you before so :L

#

Could be a neat challenge

sullen marlin
remote swallow
#

depends on how complex, if its not too bad yeah ill help

sullen marlin
#

Or multiply by 8 to undo the shrink

dusty kiln
livid dove
#

Part of the fun :L

#

And see? People pretend md_5 is a grumpy git sometimes, but here he is, main Spigot boi, helping out the humble noob dev ❤️

#

Warms ya heart

#

xD

livid dove
# upper hazel I didn't give a complete description

Give a full brief, top to bottom, and I'll personally help you out if I think its reasonable. Youve got ill and that aint ur fault lad, and whislt development is cool, it shouldnt come at the impact of ur health

dire bluff
#

hello guys a small help

#

how to get the contained items in inventory by name

dusty kiln
sullen marlin
#

Np

sterile token
#

You wanna **... ** **... ** yourself

echo basalt
livid dove
# dire bluff how to get the contained items in inventory by name

You need to loop through the contents and get the name for each.

Either done through a for loop or through a lambda function. My personal preference is a lambda, but either will work.

If you need some more help as youve not worked with invs before or something lmk

remote swallow
#

did we get full detail?

livid dove
#

Nah he dissapearedd

#

Shame

#

Wanna make a plugin together anyway? Banter innit

remote swallow
#

what plugin you feeling like

livid dove
#

Legit no clue atm.

Just thought it could be fun to collab. Got any old pet projects uve wanted to get an MvP for?

remote swallow
#

ill also tell you now half the stuffi do will be very jank and miss the obvious way untill im told about it and then realise how easy it couldve been

remote swallow
#

its on github atm, idk if its had my recent changes published

#

theres a lot i need to fix on it

#

i remember what i was last doing now

#

yeah its pretty jank

#

i remember why i probably stopped working on it, could probably just implement hibernate now though and remove json support

remote swallow
opal juniper
remote swallow
#

shut

livid dove
opal juniper
#

huh?

remote swallow
#

do ihave to delombok my classes

livid dove
eternal night
#

True, a compiler hack do be on the same level as a marker annotation 😭

eternal night
opal juniper
#

sarcasm

livid dove
#

Ur a paper dev, u cant say shit about lombok

#

xD

eternal night
#

yea sorry, the sarcasm must have passed by you

#

mb mb

livid dove
#

Lmao mb mb

#

There were legit people a day or so ago shitting on lombok

#

Cipher and them

eternal night
#

understandable

#

would too if I had the time

opal juniper
#

@hybrid spoke is this true

#

pathetic is full of it because of you

eternal night
#

promotes some rather bleh behaviour on potentially inexperienced devs

livid dove
#

Olie really comin in here tonight with violence

livid dove
#

xD

eternal night
#

no

opal juniper
#

like annotating your main class with getter ehem epic

eternal night
#

bukkit is a terribly easy to understand API

livid dove
#

Yeah but there arnt exactly great practices in it

eternal night
#

I mean

#

it works ™️

#

its simplistic

opal juniper
#

Bukkit.java ✨✨

remote swallow
#

leave me alone

eternal night
#

it does its job

remote swallow
#

am gonna start fixing stuff

eternal night
#

"great practices" are rather relative to interpret IMO.
API design is hard, some of bukkit is certainly terribly outdated, but the core principle of a simple API such as bukkit is a nice feat

opal juniper
#

it’s changing

eternal night
#

🙏

livid dove
#

I know, legit praise be

remote swallow
#

ping me if im needed to answer stuff

opal juniper
#

you won’t be

livid dove
#

Who was the god who came up with that?

opal juniper
#

🥰

livid dove
livid dove
#

xD

#

❤️

opal juniper
#

it’s been floating for a while

livid dove
#

Ive always meant to properly ask

#

What is the new approach?

opal juniper
#

iirc it was like ItemType and BlockType

#

it’s been a while since i looked

eternal night
#

proper interfaces, sourced from a registry

livid dove
opal juniper
#

YES

livid dove
#

OMFG

#

SAY SIKE RN

#

xD

opal juniper
#

exactly ✨

eternal night
#

well

#

it lays the groundwork for the API to support those once mojang does in their client

#

but yea

livid dove
#

Praise fuckin be

eternal night
#

it also makes a LOT of stuff nicer because we can skip UnsafeValues

eternal night
#

the configuration phase stuff in .2 looks promising

livid dove
#

Tell me this is a joint endevaour on ur lot's end too lynx

eternal night
#

interfaces ?

remote swallow
# livid dove What does the plugin do?

suggestion plugin, you can suggest somethng in game or from discord, allows users to vote for said suggestion if they would like to see it or not and allows for an answer in both places

eternal night
#

Well, we have been on the PRs in terms of feedback yea

livid dove
#

I.e. Spigot and paper gonna both nod and silently pick it up mutually

opal juniper
#

paper doesn’t have a choice omegalul

eternal night
#

true that KEKW

livid dove
#

#SoftSpoon

eternal night
#

but yea, we have been on it for review, mostly MM

#

I'll give it a read once my exam phase ends

remote swallow
#

shouldnt take aslong now

eternal night
#

but yea, I mean, paper has a few more things planned that will change

#

but the work is splendit and serves nicely

livid dove
#

Yeah we can work on it tommorow screw it

#

could be fun

remote swallow
#

im just gonna clean it up a bit so its not as bad as it could be

hybrid spoke
#

even showed pathetic as an example

#

i think he confuses shitting on lombok with shitting on him

#

because i'd definitely do that

opal juniper
#

ewwwwww

#

fair enough tho

remote swallow
#

@livid dove i just realised how much i miss something in another lib i dont also wanna shade so im just gonna like make a new main lib for myself removing pointless classes so you probably wont have anything to work on tomorrow lol

livid dove
#

Lmao no worries

livid dove
remote swallow
#

this is also a good reason to remove the jank in my current lib and refractor it too

upper niche
#

Anyone know how to modify speed without changing FOV, or maybe the other way around?

echo basalt
#

setWalkSpeed does that iirc

thin iris
#

@eternal night i keep thinking. u have a big mullet

#

but it’s just. aplant

#

in the back

young knoll
#

lul?

gentle kraken
#

I am trying to check if a player places a chest next to an existing chest, to make it a double chest... is there a better way than this? because as of now, it doesn't even have to become a double chest, it still catches it just being placed next to it

    @EventHandler
    public void onBlockPlace(BlockPlaceEvent event) {
        Block block = event.getBlockPlaced();
        Player player = event.getPlayer();

        // If a chest is placed next to an existing protected chest, protect it automatically
        if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST) {
            BlockFace[] faces = {BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST};
            for (BlockFace face : faces) {
                Block adjacentBlock = block.getRelative(face);
                if (protectedChests.contains(adjacentBlock.getLocation())) {
                    Chest chest = (Chest) block.getState();
                    Chest adjacentChest = (Chest) adjacentBlock.getState();
                    if (chest.getInventory().getType() == InventoryType.CHEST && adjacentChest.getInventory().getType() == InventoryType.CHEST) {
                        protectedChests.add(block.getLocation());
                        player.sendMessage("Adjacent chest has been automatically protected.");
                        return;
                    }
                }
            }
        }
sullen marlin
#

Can't you getInventory instance of DoubleChest

#

Or does that not work in the event

quaint mantle
#

how do u make hover and click text in kyori adveture?

river oracle
#

Should probably ask paper

lofty badge
#

Guys, i'm trying remove the <> before and after player name, but it's not working. who can help? ``` @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
String playerName = event.getPlayer().getName();
String filteredName = playerName.trim();
try {
int playerRank = ReadPlayerRank(playerName);
String newNickname = "[Rank " + playerRank + "] " + filteredName + ": ";

        event.getPlayer().setDisplayName(newNickname);
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
}```
sullen marlin
#

You want AsyncPlayerChatEvent.setFormat

lost matrix
lofty badge
lost matrix
lofty badge
#

i'm noob in spigot/java code

lost matrix
#

And like md5 stated: To format the chat you should not change a players name.
Rather modify the format using AsyncPlayerChatEvent.setFormat

lost matrix
#

?paste

undone axleBOT
lofty badge
#

i have one big problem in my plugin

lofty badge
#

💀

lost matrix
#

I would highly suggest not using Databases if you are new.
Just write your data into files.

#

Focus on getting better in java and put SQL by side for now

lofty badge
lost matrix
#

No you dont

#

And if you run this on a big server then it will simply crash. I can assure you that.

lofty badge
#

Than what i can do?

lofty badge
lost matrix
#

Files are perfectly fine. Even for slightly bigger projects.
How big are we talking? And do you run mutliple server instances?

lofty badge
lost matrix
#

If you have consistently 50 concurrent players then you are one of the top 0.1% of servers
and should hire professional developers.

lofty badge
#

no, bro, i want to launch my server, than i making plugin for it

lost matrix
#

I see. Do you run multiple server instances or one big server?

lofty badge
#

max 50-64 at one time

lost matrix
#

Use Files then. You wont need a DB for this.

lofty badge
#

i think db it's better than files

lost matrix
#

Why

smoky anchor
#

I might get flamed for this, but wouldn't PDC work just as well ?

lost matrix
#

Kind of, but only for very specific data.
I would only use it for Tags and less for data like ranks.
You want to be able to modify ranks for offline players and modifying
PDCs of offline players is a hustle.

smoky anchor
#

I guess that is a fair point.
Ty for answering.

lofty badge
#

i'm using db to save: name of user, balance, rank and job id

#

i don't need anything more

lost matrix
#

Anyways im late for my workout. The megumi weeb can probably help you as well.

lofty badge
lost matrix
lofty badge
grizzled sable
# lofty badge example please
@EventHandler
    public void onChat(AsyncPlayerChatEvent event){
        Player p = event.getPlayer();
        String msg = event.getMessage();
        String prefix = "YOURPREFIX";

        //can also do without permission
        if(p.hasPermission("your.permission")){
            event.setFormat(prefix + msg));
    }
}```
viscid ginkgo
#

Anyone know what this error is?

I've tried everything and can't figure it out
(Edit: Ik it says player table not created but I made a debug check so if the table is created it sends a message. The .db file is not being created either)

#

My table create function:

public void createTable() {
        try {
            connection.createStatement().execute(
                    "CREATE TABLE IF NOT EXISTS player_data (" +
                            "id INTEGER PRIMARY KEY AUTOINCREMENT," +
                            "player_uuid TEXT," +
                            "lives INTEGER" +
                            ")"
            );
            System.out.println("Table 'player_data' created successfully.");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }```
#

for anyone curious on why I'm using SQLite its because I'm storing every player's data and yml or json is just not the go. And true I can use external databases with SQL or mongo but I would like it to be user friendly as I will most likely be releasing this plugin publicly

grizzled sable
#

org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: players)
according to the create function it creates a player_data table did you look in sql which table are created ?

viscid ginkgo
#

I'm a bit confused

grizzled sable
#

CMD for/in sql: "show tables";

viscid ginkgo
#

where would I use this command

#

I'm using SQLITE which is just flat-file storage I'm not to sure if theres a terminal for that

#

Unless you are refering to the terminal in Intellij (Which wouldn't make sense)

grizzled sable
#

can you see any tables created in sqllite ?

bold gorge
#

Does spigot allow custom implementations like custom impls of Inventory?

grizzled sable
bold gorge
grizzled sable
#

should be possible to my knowledge

viscid ginkgo
#

Is there another flat-file storage method I could use instead? (That is recommended for player data storage.)

viscid ginkgo
#

H2?

#

I'll look into that

bold gorge
#

It's sql

viscid ginkgo
#

I see

bold gorge
#

Should be the same syntax

#

It's known to be faster and more preferred than sql

viscid ginkgo
#

H2 SQL?

bold gorge
#

Yeah

viscid ginkgo
#

Is it flat-file base storage?

bold gorge
#

yeah

viscid ginkgo
#

I see, I'll have a look now thanks for the suggestion 👍

bold gorge
#

You can use it as a file based jdbc database and memory

viscid ginkgo
# bold gorge You can use it as a file based jdbc database and memory

I tried using H2 SQL but I got these errors:

[07:12:52 WARN]: java.lang.ClassNotFoundException: org.h2.Driver
[07:12:52 WARN]:        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:183)
[07:12:52 WARN]:        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:150)
[07:12:52 WARN]:        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[07:12:52 WARN]:        at java.base/java.lang.Class.forName0(Native Method)
[07:12:52 WARN]:        at java.base/java.lang.Class.forName(Class.java:375)
[07:12:52 WARN]:        at HardCorePlus-1.0.jar//com.developedmade.hardcoreplus.DatabaseManager.<init>(DatabaseManager.java:12)
[07:12:52 WARN]:        at HardCorePlus-1.0.jar//com.developedmade.hardcoreplus.HardCorePlus.onEnable(HardCorePlus.java:26)
[07:12:52 WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281)
[07:12:52 WARN]:        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189)
[07:12:52 WARN]:        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104)
[07:12:52 WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507)
[07:12:52 WARN]:        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:640)
[07:12:52 WARN]:        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:551)
[07:12:52 WARN]:        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635)
[07:12:52 WARN]:        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434)
[07:12:52 WARN]:        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:308)
[07:12:52 WARN]:        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1100)
[07:12:52 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317)
[07:12:52 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)```

Are you familiar with them?
quasi flint
#

did ya shade the dependency?

viscid ginkgo
#

oh I did not

quasi flint
#

well then there you have it

#

prob

viscid ginkgo
#

yeah same error

abstract iron
#

public void spawnMobs(int size, int mobCap, int spawnTime) {
task = new BukkitRunnable() {
List<Entity> removal = new ArrayList<>();
@Override
public void run() {
for (Entity entity : entities) {
if (!entity.isValid() || entity.isDead()) {
removal.add(entity);
}
entities.removeAll(removal);
}
int diff = mobCap - entities.size();
if (diff <= 0)
return;
int spawnAmount = (int) (Math.random() * (diff + 1));
int count = 0;
while (count <= spawnAmount) {
count++;
int ranX = getRandomWithNeg(size);
int ranZ = getRandomWithNeg(size);
Block block = world.getHighestBlockAt(ranX, ranZ);
Location loc = block.getLocation().clone().add(0, 1, 0);

                entities.add(world.spawnEntity(loc, EntityType.ZOMBIE));
            }
        }
    }.runTaskTimer(this, 0L, spawnTime);
}

yall trying to make a mob spawner of sorts
am I to put the removal array insite or outside run()

abstract iron
#

wrong thing hol on

#

[09:10:33] [Server thread/WARN]: [FirstProject] Task #2 for FirstProject v1.0 generated an exception
java.util.ConcurrentModificationException: null
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013) ~[?:?]
at java.util.ArrayList$Itr.next(ArrayList.java:967) ~[?:?]
at me.marsim.firstproject.FirstProject$1.run(FirstProject.java:34) ~[?:?]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3869-Spigot-d2eba2c-78796c9]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3869-Spigot-d2eba2c-78796c9]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1256) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3869-Spigot-d2eba2c-78796c9]
at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:387) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3869-Spigot-d2eba2c-78796c9]
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1197) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3869-Spigot-d2eba2c-78796c9]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1014) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3869-Spigot-d2eba2c-78796c9]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:303) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3869-Spigot-d2eba2c-78796c9]
at java.lang.Thread.run(Thread.java:833) ~[?:?]

#

34 would be

            for (Entity entity : entities) {
grizzled sable
chrome beacon
abstract iron
#

why?

#

entities variable btw

private List<Entity> entities = new ArrayList<>();
grizzled sable
chrome beacon
#

You're better off removing from the list after the loop is done

chrome beacon
viscid ginkgo
#
plugins {
    id 'java'
    id 'com.github.johnrengelman.shadow' version '7.1.2'
}

group = 'com.developedmade'
version = '1.0'

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

dependencies {
    compileOnly "org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT"
    compileOnly 'com.h2database:h2:1.4.200'
}```
#

all i did

#

...

chrome beacon
#

So no you didn't

viscid ginkgo
#

plus the gradle shadowjar command

chrome beacon
#

Read the shadow jar docs

viscid ginkgo
#

wait am i supposed to add the jar to the files 💀

abstract iron
viscid ginkgo
#

im so confused

quasi flint
#

also u using stone old shadow version

#

8.1.1 is newest

abstract iron
#

@chrome beacon Solved, thanks mate

lofty badge
#

who can help me again?

#

how to install commandapi in my project?

#

i got error Could not find artifact dev.jorel:commandapi:jar:8.7.3

smoky anchor
#

Are you using maven ?
If so paste the pom

#

?paste

undone axleBOT
lofty badge
#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dev.jorel</groupId>
            <artifactId>commandapi</artifactId>
            <version>9.1.0</version>
            <type>pom</type>
        </dependency>
    </dependencies>``` my maven dependencies
#

but it doesn't appear at all

smoky anchor
lofty badge
#

it's not working for me

#

no errors but i not see anything from this dependency

grizzled sable
#

do you have dependency reloaded in your project ?

grizzled sable
#

hm

#

and the IDE dont check this package for use ? or the plugins dont load on your server ?

lofty badge
#
[INFO] 
[INFO] --------------------< org.fluffiesun:FluffieCraft >---------------------
[INFO] Building FluffieCraft 1.0
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- resources:3.3.0:resources (default-resources) @ FluffieCraft ---
[INFO] Copying 1 resource
[INFO] 
[INFO] --- compiler:3.8.1:compile (default-compile) @ FluffieCraft ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\fluffiesun\IdeaProjects\FluffieCraft\target\classes
[INFO] 
[INFO] --- resources:3.3.0:testResources (default-testResources) @ FluffieCraft ---
[INFO] skip non existing resourceDirectory C:\Users\fluffiesun\IdeaProjects\FluffieCraft\src\test\resources
[INFO] 
[INFO] --- compiler:3.8.1:testCompile (default-testCompile) @ FluffieCraft ---
[INFO] No sources to compile
[INFO] 
[INFO] --- surefire:3.0.0:test (default-test) @ FluffieCraft ---
[INFO] No tests to run.
[INFO] 
[INFO] --- jar:3.3.0:jar (default-jar) @ FluffieCraft ---
[INFO] Building jar: C:\Users\fluffiesun\IdeaProjects\FluffieCraft\target\FluffieCraft-1.0.jar
[INFO] 
[INFO] --- shade:3.2.4:shade (default) @ FluffieCraft ---
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing C:\Users\fluffiesun\IdeaProjects\FluffieCraft\target\FluffieCraft-1.0.jar with C:\Users\fluffiesun\IdeaProjects\FluffieCraft\target\FluffieCraft-1.0-shaded.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.551 s
[INFO] Finished at: 2023-09-14T10:38:14+03:00
[INFO] ------------------------------------------------------------------------
#

All log

#

.

smoky anchor
#

@lofty badge I do not provide support in DMs

eternal oxide
#

Your scope and artifactId is wrong when compared to the wiki page

#

remove the type pom

lofty badge
#

than who can help?

#

I need just a template project with imported CommandAPI

orchid gazelle
lofty badge
#

ok. i will try create new project

#

gradle or maven better?

smoky anchor
#

noone talked about creating new project
Just replace the dependency with the one from the documentation
and then change the version

orchid gazelle
lofty badge
#

let's try again in empty project

supple elk
#

I'm making a player tracker using a compass and I'd like it to work across dimensions, so I'm using lodestones. The problem is that every time I change the lodestone location, the nbt data of the item changes and so the re-equip animation plays. Does anyone know how I can get around this?

echo basalt
#

setCompassTarget

smoky anchor
#

@lofty badge I do get that English is not your native tounge but I will not help you in DMs
I think you can understand that much

#

Change the dependency to

  <dependency>
      <groupId>dev.jorel</groupId>
      <artifactId>commandapi-bukkit-core</artifactId>
      <version>9.0.3</version>
      <scope>provided</scope>
  </dependency>

And refresh maven, there's a button for that that pops up on top right when you make any change
Or you can access it by opening the maven tab

supple elk
#

therefore I have to use lodestone

echo basalt
#

Well not much you can do then

lilac dagger
#

if you're in nether it'll show the closest portal?

supple elk
#

so I keep track of the last location a player was in for the nether, end and overworld

lilac dagger
#

i see

supple elk
#

if they're not in the same dimension as you, then it points to where they last were in that dimension

#

which will lead you to the portal they went through

#

the problem is that changing the lodestone location changes the compass nbt, since it's unique to the compass and not the player

valid burrow
#

yh i think not much you can do

#

well

#

you could

#

use heads

#

instead of a compass

supple elk
#

heads?

valid burrow
#

theres player heads for each direction of a compass

#

technically

#

that could work

supple elk
#

oh lol

valid burrow
#

if you really dont want the animation

supple elk
#

anything I could do with packets?

#

there seems to be a method you can ovveride on an item in forge, there are some posts about it

#

so maybe there's some equivalent?

#

I couldn't see any for an ItemStack but maybe for an nms item?

valid burrow
#

i know 0 about forge sorry mate

supple elk
#

nor do I lol

valid burrow
#

also aint aware of something similar in spigot

supple elk
#

see, the same thing will happen if I use heads now that i think about it

#

cause every time the direction changes I'll have to change the look of the head

#

which would cause an nbt change

#

I really can't win lol

valid burrow
#

but heads dont play an equip animation

#

they arent tools

#

oh wait

#

im stupid

#

ignore what i just said

supple elk
#

lol

valid burrow
#

well but now that i think about it there 100% is a way. Hypixel Skyblock utilises that

#

not sure how they did it

#

but they did

supple elk
#

hmm

#

what was the tracker?

#

or compass

#

was the location it was pointing to changing?

#

Maybe I can use a recovery compass?

valid burrow
#

not that exact scenario but for example when using tools they constantly change the data of the tool, mining speed, name description etc without playing animations

supple elk
#

true

#

hm

valid burrow
#

wish i could work with a skyblock dev just for one day x) i feel my coding skills would tripple

supple elk
#

lol yeah

#

the secrets they must know

valid burrow
#

frfr

supple elk
#

I did a whole dive into making a tab screen display

#

it turns out to be annoyingly difficult

#

you have to create fake players

hybrid spoke
supple elk
#

and remove the real ones, but also send packets when people get in render distance cause it tturns out removing them from the tab board messes stuff up

#

I then went back on to hypixel skyblock and looked really closely and the nsaw they did it exactly in that way

#

whenever a player gets into render distance, or an npc, their name briefly appears on the tab screen before getting removed

valid burrow
#

i made bossbars in 1.8 and i just cant figure out how they did it. I found a way but its definetly different from their way. I read EVERYTHING there is to find about bossbars in 1.8 and they still found a different way

#

like literal days

supple elk
#

yeah it's crazy

hybrid spoke
supple elk
#

but yeah I might try a recovery compass, cause that points towards the player's last death location

supple elk
#

so that must be stored for the player

#

rather than in the compass

shadow night
#

There are recovery compasses?

valid burrow
#

yes

lilac dagger
remote swallow
#

packets

#

probably packets

valid burrow
#

it is packets

lilac dagger
#

and that

#

i think i still have the code for 1.8.8 bossbar somewhere

#

if you want it

valid burrow
#

thats also the way i do it now but it works a millon times better for them

valid burrow
#

just took me way to long

#

to figure something out xd

#

like if you turn really really really fast the bossbar flashes for like half a second

#

and it doesnt do that on hypixel even with a 200ms ping

lilac dagger
hybrid spoke
#

what bossbar

lilac dagger
#

if you look closely you can see effects of the wither

valid burrow
#

hm i might check that out

#

@supple elk

supple elk
#

uhhh

#

if I don't update nbt data on client the compass won't point in the right direction though

#

send packets to change the compass direction?

smoky anchor
#

I really want to see you provide some code/source for this

supple elk
#

that would be gr8

#

thanks

#

that would be super helpful

smoky anchor
#

there's player.setCompassTarget

subtle folio
#

what’s the best way of setting up a job that gets run at a specific time every week?

hybrid spoke
#

🤔

supple elk
smoky anchor
#

I know

subtle folio
supple elk
#

kk thanks

#

don't mind at all, go for it

hybrid spoke
subtle folio
remote swallow
#

ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
public void schedule() {

    LocalDate nextDate = LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.MONDAY));
    long midnight = LocalDateTime.now().until(nextDate.atStartOfDay(), ChronoUnit.MINUTES);
    scheduler.scheduleAtFixedRate(()-> { /* Code here */ }, midnight, TimeUnit.DAYS.toMinutes(7), TimeUnit.MINUTES);
}
#

-credit elgarl

lost matrix
hybrid spoke
#

its programmatically just like a file system

#

and they are even better and more optimized

lost matrix
#

Databases add a ton of complexity compared to flat files. They need a completely new
programming language, just to query data.

hybrid spoke
#

sql isnt that hard

lost matrix
#

Thats not the point

hybrid spoke
#

what is your point then

#

databases are factually better then a file system

lost matrix
#

That the introduction of a new programming language, just to administrate data, adds a ton of complexity to your design.

hybrid spoke
#

and with the different ms's you can even optimize on your specific case

lost matrix
eternal night
#

sure you need more skills for it

lofty badge
eternal night
#

I would not call it a large increase in complexity overall

hybrid spoke
#

at all*

eternal night
#

I mean

#

proper SQL design is hard

lost matrix
# hybrid spoke i dont see the point

I dont know how to make this any more clear.
If you struggle with basic java then you shouldnt touch SQL and use flat files as they
are way easier to work with.

hybrid spoke
eternal night
#

I mean, I agree with smile here

#

if you barely can smack together java, SQL is overkill

#

migrate later once you get better

lofty badge
# lofty badge bro, chill. i can't create commands))

I want make commands with args, but i can't use for this CommandAPI.

                if (args.length!=0) {
                    String name = "";
                    for (int i = 0; i < args.length; i++) {
                        name = String.valueOf(name)+args[i]+"";
                    }

                    if (sender instanceof Player) {
                        Player p = (Player) sender;
                        try {
                            p.sendMessage("Баланс игрока " + name + ": " + ReadPlayerBalance(name) + "$");
                        } catch (SQLException e) {
                            throw new RuntimeException(e);
                        }
                    }
                }

                else {
                    if (sender instanceof Player) {
                        Player p = (Player) sender;
                        try {
                            p.sendMessage("Ваш баланс"+ ": " + ReadPlayerBalance(p.getName()) + "$");
                        } catch (SQLException e) {
                            throw new RuntimeException(e);
                        }
                    }
                }
            }```
My current command with arg
eternal night
#

stick to bukkit YamlConfiguration for now and run into the issues filesystem data storage brings down the line

hybrid spoke
#

if thats the case, sure, go for it. but to say nah dont use sql it adds too much complexity is bs

eternal night
#

I guess the initial statement was a bit unfortunately worded KEKW

lost matrix
#

If you are very experienced then this isnt a debate anymore. You program against an abstract persistence interface
and for all you care it can be implemented via storing your data in a floating zombies pdc.

eternal night
lost matrix
#

iirc the event is only called when the piston extends

echo basalt
#

Using packet meta

#

you see

lost matrix
echo basalt
distant wave
#

does the createInventory size arguments means amount of rows or general size

worldly ingot
#

Slots, yeah

#

It should be a multiple of 9 for generic inventories (e.g. 9, 18, 27, 36, etc.)

distant wave
#

i get it

#

thanks

upper hazel
#

"softdependent" - in plugin.yml understands disabled required plugins, even if they are on the server?

agile hollow
#

how can i make an autorespawn plugin when someone die the death screen didn't apear

remote swallow
upper hazel
#

but it also disables the plugin if the dependencies are not found

#

does the plugin take into account the fact that dependencies exist but are disabled?

lost matrix
remote swallow
upper hazel
#

So all these checks for the presence of dependency are not needed?

remote swallow
#

if you can function without them you do not need to check if they arent there

#

if you require them to be there use depend

upper hazel
#

i mean write check code in enable metod

#

i can just connect in plugin.yml "depend" word

#

and not check in enable metod

remote swallow
#

correct

#

if you have depened you dont need to check if its enabled, it wont start to enable without it

upper hazel
#

oh nice

upper hazel
#

I'm tired of just writing all these check metods hahaha

agile hollow
#

how can i make a gui where i can disable the pickup of some drops

#

i need only the think for disable the pickup

#

i know how do all the other

upper hazel
#

Please advise someone who is a decent translator

#

site

lost matrix
upper hazel
#

for engl

#

or yes

lost matrix
#

from/to?

upper hazel
#

which

upper hazel
lost matrix
upper hazel
#

I think you don’t need anything other than English

river oracle
upper hazel
#

so yea fro inglish

remote swallow
#

yeah i was gonna say deepl

river oracle
#

If you're German deepl is pretty good iirc cuz their main thing is German to English

upper hazel
#

i rus

hybrid spoke
#

google translator is the best

#

even for german nowadays

lost matrix
#

deepl outclassed google translate the last time ive checked

gentle kraken
#

onSignChange include sign edits that were added? or only whne a sign is saved?

hybrid spoke
shadow night
# upper hazel i rus

Last time, my friend said yandex translate is very good for english <-> russian

hybrid turret
#

Kinda super basic question:
Do I understand it right that if I change the display name using player.setDisplayname(name);, I can still get the real name using player.getName()?

hybrid turret
#

Alright thanks

lost matrix
hybrid turret
#

Wym by that?

lost matrix
#

Yes

hybrid turret
#

What do you think I think it does?

lost matrix
#

Something that it actually wont do

hybrid turret
#

Can‘t you just tell me man? I can‘t test rn and don‘t wanna bother getting back to that later bc I am refactoring code rn to not have kamehameha anymore and I just stumbled over some weird code

#

:/

hybrid spoke
#

he means that it wont actually change the "display name", but only the name in chat messages

lost matrix
#

Changing the name like this wont result in actually changing the name of the player.
Only its appearance in chat.

hybrid turret
#

Oh damn

#

How do nick plugins work then?

#

I thought that code worked when i first implemented it 💀

#

(It‘s been years)

lost matrix
#

There are multiple approaches for this. Most involve packet fkery.

hybrid spoke
#

nick plugins typically change the gameprofile of a player

hybrid turret
#

Oh what the fk

slender elbow
#

iirc you can now use text displays mounted on an appropriately sized interaction entity to not mess with the profile

#

there was a github gist with that somewhere ..

#

it worked wonders

lost matrix
#

Main drawback: No auto completion for your name then

slender elbow
#

i mean the real player name will still be on the client

lost matrix
#

Main benefit: No char size limit

hybrid turret
#

Depends. Couldn‘t you do the autocompletion manually with the displayname?

slender elbow
#

the client doesn't know about the bukkit display name

#

if you change the game profile, you'll change the "real" name other clients see the player as

hybrid turret
lost matrix
#

Ive used the display entity approach for NPCs

slender elbow
#

no, that's kind of the point of it

hybrid turret
slender elbow
hybrid turret
#

Is there a tutorial on how to add npcs?

slender elbow
#

the interaction.customName(this.name); method is Paper but, just, setCustomName

lost matrix
#

NPCs are difficult to get right. Ive done mine completely from scratch using packets.

hybrid turret
#

Oh damn

#

I‘ve been wondering for a long time how you get a "fake player" somewhere. Something like an new instance of Player or sum where u set a location for but never got too deep into it

hybrid spoke
#

new Player()

#

you could also just use citiziens

lost matrix
upper hazel
slender elbow
#

that does not change the displayed name tag

#

that's what the whole conversation was all about

upper hazel
#

you mean Player.getName ?

remote swallow
#

you cannot change the visable name people see anywhere but chat with setDisplayName

upper hazel
#

lol I used to add prefixes to the player name and it worked

lilac dagger
lost matrix
#

Display entities support multiple lines

lilac dagger
#

that's super cool

quaint mantle
#

does inventory.contents contain the helmet and stuff?

and does it contain offhand?

lost matrix
#

Nope it contains the contents

quaint mantle
#

what about offhand

lost matrix
#

Wait contents might contain everything, i thought about storage contents.

quaint mantle
#

?

smoky oak
#

quick question, how do i query the explosion resistance of a block, both default and current?

solid matrix
#

Can you run a listener inside of a bukkit runnable so it’s only listening while the runnable is running

chrome beacon
#

You can just set a boolean to true while the bukkit runnable is running

#

and when it stops you just set it back to false

hushed spindle
#

is there some way to get the item involved with a ProjectileLaunchEvent without a bunch of hacky shit

river oracle
river oracle
#

correct

smoky oak
#

it throws exceptions

river oracle
#

they do

#

if it wasn't scheduled

smoky oak
#

this method only works if the runnable has been scheduled yet

solid matrix
#

Yeah but my question is is there a way to register a runnable with event listeners attached

#

So it a certain state is true only certain listeners will be active

river oracle
#

no need to just do an if statement

solid matrix
#

Well I’m working on a project

#

That requires this

solid matrix
#

Because of how large it is

ivory sleet
#

Although I’d avoid doing that

solid matrix
#

Why

#

?

hushed spindle
#

what are you trying to do with it anyway

smoky oak
#

i can think of two equally stupid ways to do it

ivory sleet
# solid matrix Why

I assume you mean sth like
class X extends BukkitRunnable implements Listener no?

solid matrix
#

Yes

ivory sleet
#

Myeah no

solid matrix
#

So it’s stupid or there’s no way to do it

smoky oak
#

i

#

it works but

hushed spindle
#

i cant think of a reason why you'd want to do it both in one class

#

just separate the two

ivory sleet
#

Its a bit complicated since you’re essentially coupling yourself to the logic of the BukkitRunnable

solid matrix
#

Hmmmm

#

Oh I know a better way

#

Use a Bukkit Runnable to manage active listeners in main Java file

#

So if a certain state is active only certain events will be listened

#

Too

hushed spindle
#

good lord why

solid matrix
#

My project has a lot of States and Settings as well as Managers

#

And it’s gonna be holy hell

#

To manage them all

ivory sleet
#

Sounds like a design flaw

smoky oak
#

mate

#

extend runnable

#

on run register listener

#

on cancel unregister

#

register it for super long

#

done

remote swallow
#

private boolean running = false

@EventHandler
public void onEvent(Event event) {
    if (!running) return;
ivory sleet
#

You usually want your event listeners to be at the very very bottom of your structure, that is no class should in principle rely on an event listener as a dependency

smoky oak
#

oh right, events, wanted to ask this

#

events get run from low to high priority right?

ivory sleet
#

Yes

hushed spindle
#

low to monitor yes

solid matrix
ivory sleet
#

If you can that is

smoky oak
#

?paste

undone axleBOT
smoky oak
remote swallow
smoky oak
#

heres my terrible solution

#

because of course everything internal must throw exceptions

remote swallow
#

i would have a handle method for the events in respective managers that would just not doing anything if its not requested

ivory sleet
#

Just have your event listeners as normal, plain, simple event listeners. Then just make them delegate to your managers as needed

river oracle
smoky oak
#

yes, unironically

ivory sleet
#

same with runnables, just pass a runnable to the scheduler and delegate within its run() method to whatever manager

smoky oak
#

i hate internals

river oracle
#

conclube answer is best though delegate!

ivory sleet
smoky oak
#

got a better solution

ivory sleet
#

Mhm

#

I think at least lol

smoky oak
#

that is not a try catch lol

ivory sleet
#

myeah

#

BukkitScheduler or/and BukkitTask

smoky oak
#

r u telling me to cache the bukkitTasks ?

ivory sleet
#

Yeah

hushed spindle
#

dont tasks get an integer id when you schedule them..?

#

why not just use that

ivory sleet
#

BukkitTask is just a wrapper around those

#

essentially

smoky oak
ivory sleet
#

And if you rly don’t like caching bukkit tasks under a longer time, you can ofc be smart and cache a snapshot of one

smoky oak
#

that code up there is me throwing my hands up and giving up doing it 'normally'

hushed spindle
#

what are these exceptions

smoky oak
#

cant remember and cba to test

#

i just remember that everything caused exceptions

#

so i just made a wrapper

#

or whatever u call something like this

ivory sleet
#

some illegal state exceptions

smoky oak
#

do u know how much time it eats to see exceptions in ur console every time u do something with schedulers that might not have been scheduled yet and you need to be certain have been stopped
a good 20% of code in affected classes was there for handling those damn things

#

now its just 'runnable.cancel() runnable = null'

ivory sleet
#

yes but do u know why it gives u those exceptions

smoky oak
#

cuz spigot is dumb

ivory sleet
#

because otherwise u'd get a nullpointerexception

#

since bukkitrunnable literally just wraps around a bukkit task

#

and if there is no bukkit task, then null and u get it lol

smoky oak
#

im pretty sure its not supposed to give me an null pointer exception when im basically asking 'hey is task x null'

hushed spindle
#

does isCurrentlyRunning() not work

smoky oak
#

thats not a method in BukkitRunnable

#

whered u find that?

hushed spindle
#

it is in bukkitscheduler

ivory sleet
#

^

hushed spindle
#

the kind of the first thing you should look for when working with running or not running tasks lol

smoky oak
#

ah yea

#

that one throws exceptions

#

iirc

ivory sleet
#

::isQueued and ::isCurrentlyQueued from BukkitScheduler
::isCancelled from BukkitTask

ivory sleet
hushed spindle
#

the documentation page doesnt mention any exceptions it throws

#

but i know it can be incomplete sometimes

#

though that is the intended way you check if tasks have been scheduled or not

floral drum
#

(hi conclure)

ivory sleet
#

hello :)

floral drum
#

how are you bestie

ivory sleet
#

caught a cold otherwise good :>

smoky oak
#

alright im testing this

floral drum
#

aw damn, I hope you feel better soon my guy :c

ivory sleet
# smoky oak alright im testing this

since i happen to be on my pc here is the impl

    @Override
    public boolean isCurrentlyRunning(final int taskId) {
        final CraftTask task = runners.get(taskId);
        if (task == null) {
            return false;
        }
        if (task.isSync()) {
            return (task == currentTask);
        }
        final CraftAsyncTask asyncTask = (CraftAsyncTask) task;
        synchronized (asyncTask.getWorkers()) {
            return !asyncTask.getWorkers().isEmpty();
        }
    }

    @Override
    public boolean isQueued(final int taskId) {
        if (taskId <= 0) {
            return false;
        }
        for (CraftTask task = head.getNext(); task != null; task = task.getNext()) {
            if (task.getTaskId() == taskId) {
                return task.getPeriod() >= CraftTask.NO_REPEATING; // The task will run
            }
        }
        CraftTask task = runners.get(taskId);
        return task != null && task.getPeriod() >= CraftTask.NO_REPEATING;
    }
#

see

#

no exceptions

#

viola

smoky oak
#

huh

#

maybe i used a different method?

ivory sleet
#

u used BukkitRunnable

smoky oak
#

no no

#

i did something with id that threw exceptions

ivory sleet
#

alr myea maybe

smoky oak
#

wait what

#

why does a logger NPE crash the server

#

alright what the fuck

java.lang.ClassCastException: class io.github.moterius.GreekGodsPlugin.Echo cannot be cast to class io.github.moterius.GreekGodsPlugin.Echo (io.github.moterius.GreekGodsPlugin.Echo is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @52066a6b; io.github.moterius.GreekGodsPlugin.Echo is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @71fc3fce)
#

sooooooo

#

class != class

#

WTF

#

is this some residue nonsense caused by reload?

#

i cant understand how the logger would cause this

hasty prawn
#

Yeah maybe don't reload

#

Try restartin g and see if it goes away

tender shard
smoky oak
#

no im not

#

im trying to obtian the instance of the JavaPlugin implementation

#

internally i might add

hexed nexus
#
package org.welcome.welcomer;

import org.bukkit.plugin.java.JavaPlugin;

public final class Welcomer extends JavaPlugin {

    @Override
    public void onEnable() {
        getLogger().info("[WELCOMER]: Pluginul a fost incarcat.");
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}

Hello, I am a beginner in java and in the development of plugins for minecraft. How could I add color to a text in the console when the plugin is activated? I added that log but I want to know how I can manage the colors in the console.

ivory sleet
#

on reload new classloaders for every plugin are instantiated

smoky oak
#

well yea but why would it still refere to the old loader

tender shard
#

for a good reason

hexed nexus
#

I understand, thanks for the information.

ivory sleet
smoky oak
#

hm i figured out part of it

#

it's apparantly keeping the old instance of the plugin in memory despite it being disabled

#

so the call Echo.getInstance() returns the static singletron of itself of the old plugin

#

disabling the onDisable singletron flush stopped the NPE

ivory sleet
#

hmm under normal circumstances static may be gcd on class unloading

#

but may wanna just set the singleton to null onDisable

smoky oak
#

um

#

the error occurs if i set the singletron to null

#

if i dont it works

#

which...

#

i THIKN means that all 'Echo.getInstance()' calls grab the old class instance

#

uuuurgh

ivory sleet
#

do it in onDisable

smoky oak
#

yea i did

ivory sleet
#

just?

smoky oak
#

instance = null -> crash
// instance = null -> no crash

#

some part of my code references the old instance, which it really shoudln't be able to

ivory sleet
#

yeah

#

design issue most likely

smoky oak
#

no see i'm about 95% sure its an issue with the singletron reference

#

let me test this

#

yup i figured it out

#

so apparantly LogHandlers keep the old plugin handler classes, so they need to be removed and re-registered on reload

slender elbow
#

DI 😇

ivory sleet
#

myeah well simple solution sometimes as well may be to not cache getInstance() too much moterius, else listen to emily

smoky oak
#

i didnt cache it

#

i always do Echo.getInstance

ivory sleet
#

rly?

smoky oak
#

but the logger kept the reference to the old instance

#

the class name

#

whatever

#

for some reason the class itself didnt get removed from the pluginclassloader

upper hazel
#

Do you think development will speed up if you create separate modules for the plugin (plugin with pieces of code) with tests?

smoky oak
#

so when the old listener tried to access Echo it got the pluginclass from before the reload

ivory sleet
#

short term no

#

any project u do short term will be faster if u skip all tests lol

#

but in long term yeah tests may actually help a lot, (not always; but sometimes esp. w/ these religious practices like agile)

upper hazel
#

Well, personally, I have a month

#

So I thought I'd test it

ivory sleet
#

yeah well if its just ur own project u do have the luxary of just testing the parts u wanna test

grim oak
#

Hi, Is there a way I can list all items as a command tab complete arg like essentials does, which allows for shortened names like 'diamondpick' instead of typing out the full 'diamond_pickaxe'

smoky oak
#

anyways now that my logger doest crash, back to the question i originally wanted to ask
Regexr says the regex ((.|\n)*?)(?=(Caused)) finds anything up until the first instance of the word 'Caused'.

#

I throw an exception in

upper hazel
#

just after I made the plugin I realized that it could be done in a week but for lack of a complete plan I had to spend a lot of time

smoky oak
grim oak
#

but how can i list all items

smoky oak
#

for example a config file, or just grabbing all materials (dont)

#

OH FUCK COPY PASTE BRUH
\n isnt \\n

lofty badge
#

why my command gives error when i type it without args? ``` if (command.getName().equalsIgnoreCase("pay")) {
String name = args[0];
String value = args[1];

            if (args.length==2) {
                if (sender instanceof Player) {
                    Player p = (Player) sender;
                    try {
                        if (ReadPlayerBalance(p.getName()) > Integer.parseInt(value)) {
                            SendMoney(p.getName(), name, Integer.parseInt(value));
                            p.sendMessage("Вы успешно отправили " + value + "$ " + "игроку " + name + "!");
                        } else {
                            p.sendMessage("На вашем балансе недостаточно средств!");
                        }
                    } catch (SQLException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
            if (args.length!=2){
                if (sender instanceof Player) {
                    Player p = (Player) sender;
                    p.sendMessage("Использование: /pay <пользователь> <количество>!");
                }
            }
        }```
smoky oak
#

didnt help -.-

tender shard
smoky oak
tender shard
#

also why are you checking the command's name?

grim oak
#

oh i just realised essentials has it all in an 'items.json' config file

lofty badge
smoky oak
#

no

#

the first arg is the first thing after the command itself

tender shard
#

without args = no args[0]

icy beacon
#

See how it does not make any sense?

upper hazel
smoky oak
#

maybe

lofty badge
smoky oak
#

alex do u know regex?

tender shard
#

a bit

smoky oak
#

so here issue

String causedTrace = fullTrace.replaceFirst("((.|\n)*?)(?=(Caused))","");
#

according to the website it matches that first part

#

but the console print still includes everything

#

and yes im not accidentally printing 'fulltrace'

tender shard
#

why are you even trying to suppress the Caused by part?

smoky oak
#

no im trying to extract it

#

but the replaceFirst aint working

tender shard
#

you did not double escape the \n

eternal night
#

cat_what Exeption#getCause() ?

tender shard
#

\n shuold be \\\n

eternal night
#

What do you mean nope KEKW

smoky oak
smoky oak
tender shard
#

I still don't get what you're trying to do

#

you want to print only the Caused by part, or everything except the caused by part?

eternal night
#

what do you mean, the "caused by" part KEKW

#

you get back an exception

smoky oak
#

print caused by part only

eternal night
#

with its message and stacktrace

smoky oak
tender shard
#

send an example of your stacktrace as codeblock here pls

#

basically the string you have

smoky oak
#

https://paste.md-5.net/ebivexupoh.cs

//This is the only way to obtain the full stacktrace.
//It's also 500x slower than obtaining the stacktrace wihtout caused by
StringWriter out = new StringWriter();
PrintWriter out2 = new PrintWriter(out);
thrown.printStackTrace(out2);
String fullTrace = out.getBuffer().toString();
//This contains the stack trace, but not the caused by
//Object test = thrown.getStackTrace();

//Tried \n and \\n here, neither did anything
String causedTrace = fullTrace.replaceFirst("((.|\\n)*?)(?=(Caused))","");
Echo.getInstance().getLogger().info("Full CausedTracke: "+fullTrace);
Echo.getInstance().getLogger().info("Truc CausedTracke: "+causedTrace);
eternal night
#

this is what I get

#

for a

@EventHandler
public void on(final ServerExceptionEvent event) {
    getLogger().info("Full exception:");
    event.getException().printStackTrace();

    getLogger().info("Cause exception:");
    event.getException().getCause().printStackTrace();
}
smoky oak
#

wait one second here

smoky oak
#

this works on the event yea

#

not if youre registering a Log Handler

eternal night
#

I mean, your cause looks right there no ?

smoky oak
#

well thats all it is

#

the string 'Test'

eternal night
#

and an 11 element stacktrace ?

smoky oak
#

theyre basically identical

#

its a copy of the stacktrace with the name of the plugin added

eternal night
#

Well obviously ?

#

because that is the stack

smoky oak
#

i want teh caused by not the stack trace

eternal night
#

the "caused by" part ?

smoky oak
#

yes

eternal night
#

then literally just grab the first element on the stack ?

#

or like, however nelements you need

#

Like, the JVM does nothing but just adding Caused by and then printStackTrace on the cause

#

the bottom stacktrace looks similar because the exception is rethrown in the handler

#

so its stacktrace is naturally not that different. Its missing the call to Command#execute and has a different line number in the SimpleCommandMap

#

but beyond that, same method and same call stack, so same stacktrace

tender shard
#
    private static final Pattern CAUSED_BY_PATTERN = Pattern.compile(".*(?<causedBy>Caused by: (.*))", Pattern.DOTALL);

    public static String getCausedBy(String input) {
        Matcher matcher = CAUSED_BY_PATTERN.matcher(input);
        matcher.find();
        return matcher.group("causedBy");
    }
#

this what you want?

eternal night
#

using regex for this is absolutely useless

slender elbow
#

i don't even understand what you're trying to achieve tbh

smoky oak
eternal night
#

I mean, you can do all of this programatically

slender elbow
#

the "caused by" is simply added in printStackTrace for the sake of printing it if getCause isn't null

tender shard
eternal night
smoky oak
#

at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47)
vs

at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)```
#

those are not the same

#

the stacktraces may look like it but theyre not

tender shard
smoky oak
#

do you have any clue why the original pattern works on the regex website but not in code?

slender elbow
#

"Caused by: " + ex.getCause()

tender shard
smoky oak
#

i mean one logged exception should only have one causedBy right?

tender shard
eternal night
#

no lol

#

exceptions can have deep causal structures

#

that can be rethrown/wrapped for as often as you want pretty much

tender shard
smoky oak
tender shard
#

the proper way is to log exceptions completely and don't mess with them at all

smoky oak
#

im trying to print them partially to chat for debugging purposes

eternal night
#

the console has them too

tender shard
#

in that case I'd just remove all lines that have org.bukkit or net.minecraft or java. as beginning lol

#

so you're only left with the plugin parts

smoky oak
eternal night
#

Trust me when I tell you that minecraft chat is not the most pleasant thing to look at for exceptions

#

given how limited the width is

grim oak
#

Hi, I want to be able to use commands from different plugins that give plugin items, but i want to be able to add them to a chest inventory (or something similar), for example if im using a crate plugin on my server and wanted to do 'crate give key <player>' is there a way i could create a fake player or something so that it puts the key into an inventory which i can then manage with my own plugin? Idk if that made any sense, sry if it didnt

smoky oak
#

yo wtf
the message in log and in chat are completely different

eternal oxide
grim oak
#

okay thanks

smoky oak
#

@tender shard do u know what the [cr] thing is? It's not a newline

#

ah its \n\r together

small current
#

is it possible that 'obj' isnt null but '(SomeClass) obj' is?

smoky oak
small current
#

but here

#

database is null

#

but the other thing isnt

smoky oak
#

wh

#

ok i clearly dont know how casting works

tough mica
#

i need extrem help with nbt tags, please dm me i will got depressions

eternal oxide
#

Your private final field is intiialized at class instancing. If your FFA or database in your main class has not yet been set when you instance your other class it will be null

tough mica
#

i need help with nbt tags. first i want if the player places a door the placed door got a nbt tag test. now if the player want to open the door, the nbt tag from the block got to send in the chat. but it dont works. i code in spigot 1.20.1 please help me boys

https://pastebin.com/CSMgizha

tough mica
pseudo hazel
#

"but it don't works" what doesnt work? does nothing happen?

#

have yo tried printing at several spots to see if the code reaches that point

tough mica
#

if i place the door, no mesage will send

pseudo hazel
#

like does it even see if you are placing down a door

eternal oxide
#

ah ok

tough mica
#

yes

eternal oxide
#

you don;t have an api version in your plugin.yml i my guess

tough mica
#

and i got errors in my console in the interactevent

pseudo hazel
#

okay

tough mica
pseudo hazel
#

well stating what errors those are would probably help...

eternal oxide
#

oh errors, you could have said so

pseudo hazel
#

there are like infinitely different errors so we dont magically know what you are referring to

tough mica
#

wait i upload on pastebin

tough mica
eternal oxide
#

I thought doors had a tilestate?

carmine mica
#

why would they need that? they don't need to be a block entity

eternal oxide
#

I guess

#

in which case no pdc

tough mica
#

huh?

#

i dont understand

#

my english is bad

eternal oxide
tough mica
#

so i cant safe a nbt tag in my doors?

glossy venture
#

u need to use the chunks pdc

eternal oxide
#

?morepdc

undone axleBOT
tough mica
#

ah okay

#

so i have to use pdc

small current
#

Hello packet question

#

why PacketPlayInUseEntity gets sent when i right click on a packet armor stand

#

but why doesn't it get sent

#

when i left click (attack)

tough mica
eternal oxide
#

no, doors have no PDC