#help-development

1 messages ยท Page 294 of 1

tender shard
#

does it tabcomplete other bungee commands?

lapis swan
#

nop

tender shard
#

hm

#

do you have permission for those commands?

#

remember that you need a separate permissions plugin for bungeecord

vale ember
#

should i create a new thread or run async task with bukkit scheduler when i want to load data from url?

humble tulip
#

which uses another thread

lapis swan
tender shard
#

yeah I'd also use a future if you need a callback

humble tulip
#

apparently runasync can still run on the main thread

vale ember
#

i don't use the data loaded from the url directly, i just put in inside a map

humble tulip
#

use completablefutures still

vale ember
#
        CompletableFuture.runAsync(() -> {
            cache.getUnchecked(event.getPlayer().getLocale());
        });

Like this?

humble tulip
#

yes

tender shard
#

maybe a plugin on the backend server messing with the commands packet?

lapis swan
#

maybe I do not use normal bungee i use it with CloudNet

rose aspen
#

I switched to from spigot 1.19 to spigot 1.19.3 and it looks like some craftbukkit packets have been changed ..

Does someone know how to define PacketPlayOutEntityMetadata the right way fro 1.19.3 ?

tender shard
tender shard
#

you should really use mojang mappings

#

?switchmappings

lapis swan
rose aspen
#

Uh dayum

tender shard
tender shard
#

it'll be way easier if you switch to mojang mappings

rose aspen
lapis swan
tender shard
#

the packet probably changed between 1.19.2 and 1.19.3

rose aspen
#

yee

tender shard
#

if you switch to mojang mappings, I could help you to find out how to turn your current stuff into the appropriate List<DataValue<?>>, but with obfuscated mappings, I have no clue

rose aspen
#

I'll try this out, but I have to read the articles first

tender shard
#

oki

#

it'll be annoying now, but after that you can basically easily update your code for new versions with only minor changes

rose aspen
#

Thats true

lapis swan
#

so spigot seems to have an option tab-complete but i can't find something like this in bungee.

sterile token
# lapis swan so spigot seems to have an option tab-complete but i can't find something like t...
GitHub

BungeeCord, the 6th in a generation of server portal suites. Efficiently proxies and maintains connections and transport between multiple Minecraft servers. - BungeeCord/TabExecutor.java at f8e0bcc...

tender shard
lapis swan
#

okay ... than I have to figure out if some plugin may destroys my tab complete

sterile token
#

Best way for that, is to remove all the plugins and test your plugin

#

And then start testing your plugin adding one by one the others plugin

#

Spigot or bungeecord?

#

oh ok

hazy parrot
#

probably because its empty in server.properites

#

you can probably make get request on ipinfo or smth

trim creek
#

I just need for other reasons

#

?paste

undone axleBOT
quaint mantle
#

Wie kopiert man ein Plugin in ein anders?

tender shard
#

what do you mean o0

#

also english please

quaint mantle
#

How to copy one plugin to another?

tender shard
#

I have no clue what you mean with that

quaint mantle
#

WeiรŸ jemand anders was ich meine?

vale ember
#

How can i serialize/deserialize PDC into json via gson?

remote swallow
#

what do you mean copy one plugin to another

#

add features of one to another? shade stuff and have it run from another plugin?

tender shard
vale ember
remote swallow
#

bet he will say base64

#

also whats the point of storing pdc in json

tender shard
#

then you can basically loop over all keys, and then check the proper datatype for every key. if it's integer, get it as int, etc. if it's something else than primitives, get it as byte array

#

and then store that in your json

quaint mantle
#

I have written a troll plugin and want to hide it in another plugin. Therefore I want to copy the plugin into another plugin.

remote swallow
#

shade it

rose aspen
tender shard
remote swallow
#

deobsfucated

remote swallow
#

oh yeah

#

im blind lol

tender shard
# rose aspen

hm can you somehow obtain an EntityDataSerializer from somewhere?

rose aspen
#

And i followed both articles you've sent

tender shard
vale ember
tender shard
#

you are using a weird mixture of both, mojang mappings and obfuscated mappings

tender shard
#

e.g. String or byte[]

#

it will return that

#

e.g. imagine you have a custom data type <String, MyObject>

#

then the method will return String

vale ember
#

oh right, thanks!

tender shard
#

so that's not a problem

#

np

rose aspen
tender shard
#

yes

#

you should remove the normal spigot dependency and ONLY add the remapped one

rose aspen
#

Uh okay wait

#

I had both xd

#

Also no need for CraftBukkit anymore ?

tender shard
#

no you dont need craftbukkit

#

you dont need craftbukkit, you dont need spigot-api

#

you only need spigot remapped

#
        Entity myNmsEntity = null;
        List<SynchedEntityData.DataValue<?>> myList = new ArrayList<>();
        myList.add(new SynchedEntityData.DataValue<>(1, EntityDataSerializers.STRING, "test"));
        new ClientboundSetEntityDataPacket(1, myList);
#

maybe sth like this might work

#

but I am not sure, might also be complete bullshit

rose aspen
#

Uh dayum my whole codeee xd

#

All red

tender shard
#

you can basically then go from 1.19.3 to 1.20 by just adjusting your pom.xml

rose aspen
#

Okay so now its ONLY that

tender shard
#

yes that's good

#

did you also add the special source plugin and stuff?

tender shard
#

usually when a new update comes out, I only have to change 5 lines in my pom, that's it

rose aspen
eternal oxide
#

I change one ๐Ÿ™‚

tender shard
#

many people forget to add that part

#

idk why

rose aspen
#

I read the article to the end xd

remote swallow
rose aspen
#

I have to get the red lines away with the NMSMapper tool... give me time .. xd

formal bear
#

Does HikariCP need mysql driver too? Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource

tardy delta
#

you need to shade it if it isnt present

eternal oxide
#

yes it needs a driver. Spigot contains a Driver but likely not the version you are building against

formal bear
#

Bungee, understood, can i connect mysql driver with MariaDB database?

eternal oxide
#

yes depending on version and connection string

formal bear
#

Tysm

eternal oxide
#

Maria has a mysql compatability connection but uses a different defaul tport

formal bear
#

Good to know, i'm using custom port anyway so

remote swallow
#

i wonder what version spigot uses

wet breach
#

spigot shades mysql driver

#

it usually isn't way outdated

#

there is a caveat to depending on the mariadb driver for mysql

remote swallow
#

just wondering what version so i can check which hikari version to use lol

wet breach
#

it is a pain to load the mariadb driver onto the class path if the mysql driver is already on the path so you have to resort to some hacky solutions

#

good news is the mysql driver works with mariadb

#

just you don't get fancy functions and what not, in most cases you are fine without the fancy stuff

wet breach
remote swallow
#

oh

#

even better

formal bear
#

Huh? java.lang.RuntimeException: Property databaseName does not exist on target class com.zaxxer.hikari.HikariConfig

#

;D

remote swallow
#

sounds fun

formal bear
#

?

#

driver

wet breach
#

yes and easier

#

it works just fine and with a thread pool doesn't even more fine

#

and if you have a decent DB setup and properly configured db server you really shouldn't even come close to having any issues

#

mysql is designed to literally handle millions of connections on servers with resources of like 1-2GB of ram, and like 1-2Ghz processing speed

#

mysql has been around for a long time ๐Ÿ™‚

formal bear
#

My HikariCP initialization, what's wrong? Why "databaseName" does not exist?


        ProxyServer.getInstance().getLogger().info("Loading MySQL database...");

        this.instance = instance;

        Configuration config = configuration.getSection("database");

        Properties properties = new Properties();

        properties.setProperty("dataSourceClassName", "org.mariadb.jdbc.MysqlDataSource");
        properties.setProperty("serverName", config.getString("host"));
        properties.setProperty("port", config.getString("port"));
        properties.setProperty("databaseName", config.getString("database"));
        properties.setProperty("user", config.getString("user"));
        properties.setProperty("password", config.getString("password"));

        this.hikari = new HikariDataSource(new HikariConfig(properties));

        createTable();

    }```
wet breach
#

why not just do plugin.getConfig()

#

don't really see the reason why you need a config object if you are not specifying a custom yaml file other then config.yml

winged anvil
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

formal bear
#

Bungee supports that?

wet breach
#

wouldn't surprise me if it does since it uses yaml for its own configs

tender shard
#

bungee's config api is shit

#

it's totally different from spigot

wet breach
#

its the same library

#

so it does the same thing

tender shard
#

no, it's indeed very different

wet breach
#

its not

#

Bungee uses Snakeyaml just like spigot does

tender shard
#

?jd-bc

formal bear
#

My code ``` public void loadConfig() {

    try {

        this.configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(instance.getDataFolder(), name));

    }

    catch (IOException error) {

        error.printStackTrace();

    }

}```
tender shard
eternal oxide
#

The only thing I dislike about it is no access to the backing map

tender shard
#

bungee doesnt even have a getConfig() method

tender shard
wet breach
#

Just use SnakeYamls api

#

YamlConfiguration

tender shard
#

YamlConfiguration is NOT from SnakeYaml

#

that's a normal bukkit class

formal bear
#

I mean guys, the problem was with HikariCP class not with config, config loads just fine

rose aspen
#

@tender shard Okay im done cleaning up the whole red lines of code ..

So right now im stuck here, where idk how this constructor works
ClientboundSetEntityDataPacket(int var0, List<DataValue<?>> var1)

List<DataValue<?>> var1 ??

tender shard
tender shard
formal bear
formal bear
#
        at com.zaxxer.hikari.util.PropertyElf.setProperty(PropertyElf.java:127) ~[?:?]
        at com.zaxxer.hikari.util.PropertyElf.lambda$setTargetFromProperties$0(PropertyElf.java:51) ~[?:?]
        at java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603) ~[?:?]
        at java.util.Properties.forEach(Properties.java:1422) ~[?:?]
        at com.zaxxer.hikari.util.PropertyElf.setTargetFromProperties(PropertyElf.java:46) ~[?:?]
        at com.zaxxer.hikari.HikariConfig.<init>(HikariConfig.java:137) ~[?:?]
        at pl.botprzemek.bpBungeeUtils.Utils.Database.<init>(Database.java:44) ~[?:?]
        at pl.botprzemek.bpBungeeUtils.UtilsManager.<init>(UtilsManager.java:35) ~[?:?]
        at pl.botprzemek.bpBungeeUtils.BpBungeeUtils.onEnable(BpBungeeUtils.java:12) ~[?:?]
        at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:356) ~[FlameCord.jar:git:Waterfall-Bootstrap:1.19-R0.1-SNAPSHOT:cb6d661:unknown]```
tender shard
#

is it maybe just "database"?

formal bear
#

i will try

wet breach
#

either way not hard to use SnakeYamls api

#

Yaml snakeYaml = new Yaml()

tender shard
#

yeah but that only gives you a Map<String,Object>

#

imagine a yaml like thsi:

#
name: 123
#

and now you cant get it as string from snake

#

it's an integer

#

if you cast it, it fails

wet breach
#

oh only spigot can do it ?

#

or are you incapable?

tender shard
#

spigot wraps the whole snakeyaml thing

#

all these convenient methods like getInt(...) aren't there in snakeyaml

#

snakeyaml only returns Objects

wet breach
#

sure, not hard to make yourself

#

you are complaining about convenience more then anything and not actually whether or not you could or could not use snakeyamls api

formal bear
tender shard
#

yeah usually the database name is part of the url lol

formal bear
#

yeah but i have seen people using it for every property, serverName, port etc

rose aspen
wet breach
#

not sure why you are doing it like that

#

it should be just HikariConfig config = new HikariConfig();
then you use config object to set all the relevant properties then you create the datasource
HikariDataSource source = new HikariDataSource(config);
then you can do Connection connection = source.getConnection()

remote swallow
#

arent you meant to use hikari data source

#

oh wait you do

#
private void setupConnection(String name, String fileName, File dataDir) {
        if (!dataDir.exists()) dataDir.mkdirs();

        String url = "jdbc:sqlite:" + dataDir.getAbsolutePath() + "/" + fileName + ".db";

        dataSource = new HikariDataSource();
        dataSource.setJdbcUrl(url);
        dataSource.setMaximumPoolSize(15);
        dataSource.setPoolName(name + "-Connection-Pool");

        dataSource.addDataSourceProperty("useUnicode", "true");
        dataSource.addDataSourceProperty("characterEncoding", "utf-8");
        dataSource.addDataSourceProperty("rewriteBatchedStatements", "true");
        dataSource.addDataSourceProperty("tcpKeepAlive", true);

        dataSource.addDataSourceProperty("cachePrepStmts", "true");
        dataSource.addDataSourceProperty("prepStmtCacheSize", "250");
        dataSource.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
        dataSource.addDataSourceProperty("useServerPrepStmts", "true");

        dataSource.addDataSourceProperty("useSSL", false);
        dataSource.addDataSourceProperty("verifyServerCertificate", "false");
    }
``` normally i do something like that
wet breach
remote swallow
#

ah

wet breach
#

You can make the config properties before the datasource object ๐Ÿ™‚

wet breach
#

but your way works too just seen people have problems sometimes that way

formal bear
#

i will just rewrite it

wet breach
#

also

formal bear
#

maybe theres some errors idk

wet breach
#

hikaricp is useless for sqlite just fyi

#

there is no such thing as a connection or a connection pool for sqlite

formal bear
#

yep found it, config.getstring from port which is an int ๐Ÿคจ

wet breach
#

so if you are using hikaricp for sqlite you are wasting resources by shading in a dependency that isn't doing anything any different then what you can do with Java quite literally

wet breach
opal juniper
#

just using jdbc is peasy

formal bear
#

sorry @wet breach my bad

remote swallow
#

dont think i shaded this in lol

#

but the for i would use this in atm i would also have a mysql use for it

wet breach
#

yeah still wouldn't touch hikaricp for sqlite even if you have it there for mysql

#

because as I said it doesn't do anything differently then what the JVM gives you and it makes sense because sqlite is file based

#

therefore no connections just a file handle

remote swallow
#

hm

#

guess i should learn sql lol

opal juniper
#

dw its peasy

wet breach
#

all you need is the sqlite driver to load on the path

#

then make use of the sql stuff that is provided by java, and using sqlite driver you load the file AKA DB

#

its like 1 line of code to load the sqlite file

remote swallow
#

also what would be the best way for me to store un-used previously used keys
Like i have a table of eg Player uuid, int id. Table of int id and some extra data but the rows could be removed. what would also be the better way to store those ids that were previously used that can now be used again

wet breach
#

not really following

remote swallow
#

one sec

wet breach
#

why not ask the developers of geyser

remote swallow
#

Table 1:
PLAYER uuid, INT id
uuid, 1

Table 2:
INT id, some extra data i cant remember atm
id, data

the uuid and id could be deleted because the extra data would be relating to blocks and that. What would be the better way to store those ids that were used before but are no longer

wet breach
#

if you don't need them, just delete them?

remote swallow
#

well yeah

wet breach
#

like I would just remove the entire column

remote swallow
#

but wouldnt it be worth re-using those ids

wet breach
#

they are not ids specific to mysql

#

or anything else

#

so why do they need to be so called re-used?

remote swallow
#

idk i just thought it might be worth re-using them lol

wet breach
#

unless they were generated id's that actually refer to something

#

then its pointless

remote swallow
#

it would just pose as some link of table 1 to table 2

#

but table 2 content could be deleted so

wet breach
#

you could recreate the link on the uuid, but you said uuid and id can go away

#

so that means you can drop the entire table 1

#

or table 2 can be deleted which ever

#

either way, the link is pointless if you can remove an entire table

remote swallow
#

i thought using 2 tables was better

#

i remember having a convo here with you about it before lol

wet breach
#

can be, but you said you have on use for the other table

#

therefore why keep it

remote swallow
#

true ig

wet breach
#

you should always consolidate when possible, like in this case. If because of some restructering or whatever happens and it turns out you can remove extra data and it happens to be that an entire table gets wiped out, then wipe out that entire table

#

multiple tables should be used, but not over used. You wan to use them to keep things organized

#

also helps when you don't need all the data at once

#

so for instance your two tables, Table 1 data can be obtained and is used in places where table 2 data isn't needed

#

so in other words using multiple tables is good but you don't want to excessively use them where you are not storing much data in the tables being created. You want to fill the tables with decent amount of data. That is how mysql is designed ๐Ÿ™‚

#

I mean I am sure it is happy with small tables too, but you are just wasting its capabilities lol

#

its like when you drive a car, you don't fill up the tank every time you stop. You fill it up when its like halfway or almost empty. MySQL is basically kind of the same way because it has mechanisms for optimizing but they really only work if you have some decent data sizes for it to work with

quartz basalt
#

ik i can test this for myself but my server is offline waiting for support, but does the PlayerCommandPreprocessEvent method e.getMessage() return the entire command? like "/command hi hello" or just the command?

tardy delta
#

database normalisation aah

#

for some reason my eyes are dying

rose aspen
# tender shard ```java Entity myNmsEntity = null; List<SynchedEntityData.DataVa...

That didn't work for me but I got it now..

Here is the result:

                // Armorstand pakets
                ClientboundAddEntityPacket armor_spawn = new ClientboundAddEntityPacket(stand);
                ClientboundSetEntityDataPacket armor_meta = new ClientboundSetEntityDataPacket(stand.getBukkitEntity().getEntityId(), stand.getEntityData().packDirty());

                manager.sendServerPacket(nearby, PacketContainer.fromPacket(armor_spawn));
                manager.sendServerPacket(nearby, PacketContainer.fromPacket(armor_meta));

                // Item paketsS
                ClientboundAddEntityPacket item_spawn = new ClientboundAddEntityPacket(item);
                ClientboundSetEntityDataPacket item_meta = new ClientboundSetEntityDataPacket(item.getBukkitEntity().getEntityId(), item.getEntityData().packDirty());

                manager.sendServerPacket(nearby, PacketContainer.fromPacket(item_spawn));
                manager.sendServerPacket(nearby, PacketContainer.fromPacket(item_meta));```

Big thank you for your help, now in the future I'm safe from recoding stuff and so ๐Ÿ˜„
remote swallow
#

yeah jds say yes

tender shard
#

I actually knew about the packDirty() methods ugh

#

just didnt think about it for this one

#

I used the same to serialize entities

#

sorry lol

rose aspen
#

But what menas packDirty() ?

Is it a bad way to serialize?

tender shard
#

I knew that I messed with DataValues once but forgot how exactly it worked

tender shard
#

it only sends the values that are non-default

quartz basalt
#

is there not a PlayerCommandPreprocessEvent equivilent for every type of command?

rose aspen
quartz basalt
#

yeah console and player

remote swallow
quartz basalt
#

is there not one for both?

remote swallow
#

dont think so

wet breach
#

they are different because players are not consoles

sterile token
#

Hi, how are you? Im needing help with my custom command framework im creating, i have the next structures

  1. SimpleCommand (abstract, which contains the common methods for name, alias, permission, description, usage, execute) which takes care for creating normal commands - https://paste.md-5.net/ufehimafig.cs

  2. SimpleExecutor (extends SimpleCommand, and allow you to register/unregister sub commands or arguments) which takes care for creating sub commands -

So my problem came in the CommandParser (extends BukkitCommand) im a bit confuse how i would call the execute method depending on the instance you passed it

Why? Because if I pass a SimpleExecutor to the parser, then i have to called the SimpleExecutor#execute(sender, args - 1)

#

Im sending the code urls 1m

atomic swift
#

any ideas

remote swallow
#

use a BukkitRunnable instead or use a lambda

sterile token
remote swallow
#

lol

sterile token
#

Because you were typing when i sent it and then you stopped haha

humble tulip
#

Use a map verano

sterile token
humble tulip
#

this i what i worked on like a LONG time ago

#

it sucked but maybe you can get some ideas

echo basalt
#

ew

#

I just like

sterile token
echo basalt
#
public class HelpCommand implements SimpleCommand {

  @Override
  public String getIdentifier() {
    return "help.*";
  }

  @Override
  public boolean canExecute(CommandSender sender) {
    return sender instanceof Player;
  ]

  @Override
  public String getPermission() {
    return "command.help";
  }

  @Override
  public void execute(CommandSender sender, String... args) {
    int page = 1;

    try {
      page = Integer.parseInt(args[0]);
    } catch (NumberFormatException ignored) {
      page = 1;
    }

    ...
  }
}
#

this is how I do commands

sterile token
#

My idea is simple, have a way for creating simple command (normal ones), and executor command (allow you to register simple command as arguments and also allow to register those executor command as sub commands). I dont know if i have explained?

tardy delta
#

thats what i tried and i failed so hard

#

just started using acf from that point

sterile token
#

yeah ik, but acf is too big and its not proper documented

river oracle
#

would you need NMS to make a player like NPC? I want it to act basically exactly like a player would, but I want to implement my own AI to control it

#

I figured it'd be easier to train the AI doing everything server side, but if not I'll just start using a mod any help is appreciated

vivid hill
#

how do I shade a dependency?

humble tulip
#

Look at sentinel @river oracle

humble tulip
vivid hill
river oracle
#

combat npcs

#

Ic

humble tulip
humble tulip
#

?paste

undone axleBOT
remote swallow
#

your relocating adventure twice which might cause issues

vivid hill
#

I tried it without the deopendecys and got the same error

spice shoal
#

guys , someone know how i can stop death screen?

atomic swift
#

where do i get PlayerInteractManager

remote swallow
atomic swift
#

with 1.18.2

remote swallow
#

or cancel the death event

remote swallow
atomic swift
#

idk

#

i keep seeing it with tablist stuff

#

also PacketPlayOutPlayerInfo doesn't exist

river oracle
#

?nms

river oracle
atomic swift
#

i have nms

river oracle
#

use screamingsandals then

#

it'll tell you mojmap names equiv

#

for mojmaps its usually Clientbound or Serverbound

vivid hill
spice shoal
atomic swift
#

what im trying to do is create a fake player and not count it as anything but the chat tab complete

remote swallow
vivid hill
remote swallow
#

oh you arent shading kotlin

vivid hill
#

shading kotlin?

sterile token
#

Hmn, loving Java

remote swallow
vivid hill
remote swallow
#

you already shade stuff into your plugin

#

its simply a copy and paste

sterile token
humble tulip
#

that for a specific dependency

#

although i think the default scope is compile

vivid hill
#

oh, ty

sterile token
#

For sahding, you have to use the maven-shade-plugin and dont add any scope to them
In case of not wondering dependencies to get shade, add them scope provided

humble tulip
#

he does

humble tulip
humble tulip
sterile token
humble tulip
#

true

humble tulip
#

the -original one?

sterile token
#

So for shading dependencies, you need to use a maven plugin called maven-shade-plugin
Dependencies you want to be shade should not contain any scope
If you dont want a specific dependency being shade, add scope provided
If the dependency is a diff version, you will have to relocate it

vivid hill
humble tulip
vivid hill
#

but it still gives me the error

humble tulip
#

build and show me your target folder

#

send a ss

atomic swift
#

does a CraftPlayer have to be online

humble tulip
#

Yes

vivid hill
humble tulip
#

You have only 1 file?

remote swallow
#

you arent building with maven

humble tulip
#

oh that's out

#

build with maven

#

to the top right corner

#

you'll see maven

#

click on it

remote swallow
#

press control twice type mvn clean package then for following builds press the green play button top right

vivid hill
remote swallow
#

press the green play button

humble tulip
#

are you using that to build?

vivid hill
#

ohh

#

ye

humble tulip
#

click the green triangle button

#

then show us the target folder

vivid hill
#

sure, gimme a second

remote swallow
#

use the generator-1.0-snapshot.jar

vivid hill
remote swallow
#

what java version do you use

vivid hill
#

18

#

sorry

sullen marlin
#

try a newer version of the shade plugin

remote swallow
#

set <java.version>1.8</java.version> to 18 and change the shade plugin

sullen marlin
#

or use java 17 like a normal person

remote swallow
#

version

#

3.2.4 doesnt support java 17 for some reason

#

use maven shade version 3.4.1

worldly ingot
#

Well yeah use whatever the latest version of that plugin is

#

3.3.0 added support for 17

vivid hill
humble tulip
#

use genrator-1.0-SNAPSHOT.jar

vivid hill
#

ye I did, just waiting for the server

#

alr ty, it gives me no error when placing a block

#

ty for the support, and sorry for the long time I used

quiet ice
#

Needed for relocation to work btw

ionic thicket
#

if i use 1.12 libraries, can I develop a 1.19 plugin?

remote swallow
#

you can develop a 1.12 plugin that would also work on higher versions if it does not use nms

river oracle
#

should beable to work, but you'll need to use reflection to grab any new methods you want to use

river oracle
#

net minecraft server

#

its the actual server code

ionic thicket
#

what about net.md.bungee.api.chatcolor?

river oracle
#

thats not net minecraft code

#

thats bungees chat api

ionic thicket
#

oke

jagged monolith
river oracle
#

not needed

#

especially if he wants support for older versions as well

#

while 1.19 libraries are ideal its not required

ionic thicket
remote swallow
#

you can change version fairly easily

river oracle
#

if you don't need backwards compat from 1.19 just change the version

#

otherwise just continue on your path

jagged monolith
#

Develop for the highest version you want to support, then implement backwards compatibility. That's the best way to do it.

river oracle
#

just note 1.12 is old, so you may not recieve as good of support from it here

ionic thicket
#

im having all the code fu*** up because i changed path

ionic thicket
sullen marlin
#

No, develop for the oldest version you want

river oracle
#

exactly what I was going to say

sullen marlin
#

Though anything older than 1.13 is difficult nowadays

remote swallow
#

anything pre 1.16/1.17 is pointless

#

if you are running an older version than that why

river oracle
#

pvp guys ๐Ÿ˜

remote swallow
#

no

#

get out

#

md why did you fix log4j for anything further back than 1.14

river oracle
#

get out? how about you get innnn with the times

#

?1.8

undone axleBOT
remote swallow
#

you get in with the times bozo

river oracle
#

last time I checked it was january 4th 2015

#

I'm curious what a good way to check if a player is in certain areas when a block is broken etc?

Now bounding boxes is the most obvious solutions, but there could be possibly thousands of bounding boxes. I was thinking of possibly using chunk pdc, but that will get messy if the chunk has 3 or 4 bounding boxes. I don't want to be super overly efficient, but I'm also struggling on a good way to execute this without it ending up as a mess.

sullen marlin
#

I think worldguard now has some optimised set thing

#

But for years and years it just iterated

remote swallow
#

save every coord to config by converting it all to base64 then to binary and loop over the entire config

sullen marlin
#

Wasn't that slow

remote swallow
#

nothing is slow if you thread.sleep

river oracle
#

๐Ÿง  genius

sullen marlin
#

Storing the bb uuid or something in the chunk would optimise it enough

#

That way you only have to get/iterate maximum 4 or so things like you say

river oracle
#

bounding boxes have UUIDs damn I need to look at the docs

#

oh nah but I can just store cords

remote swallow
#

couldnt you also combine bounding boxes that cross chunks

jagged monolith
#

When in doubt, consult the docs.

remote swallow
#

when in doubt of the docs consult stash

sullen marlin
river oracle
#

ohh okay

#

yeah no makes sense

river oracle
#

ahhh how I love not reinventing the wheel

remote swallow
#

if i were to copy the wheel and change something about it am i re-inventing the wheel

river oracle
#

no you are improving the wheel

#

well

#

as long as its an improvement

#

otherwise its called a waste of time

remote swallow
#

so im improving the wheel by stealing alex's more pdc code and renaming the classes and adding it to my lib

river oracle
#

I just shaded it...

remote swallow
#

i dont like the class name

river oracle
#

oh then thats totally worht it

remote swallow
#

instead of DataType ill get PDC

#

do you load after papi

tender shard
remote swallow
#

ikr

#

its so good

tender shard
#

naming it PDC makes no sense

#

if at all you should name it PDT

remote swallow
#

for me it does

tender shard
#

C stands for container

#

PersistentDataContainer.ITEM_STACK?

#

that doesnt really make sense

remote swallow
#

my brain would remember it more

fervent prawn
tender shard
#
import com.jeff_media.morepersistentdatatypes.DataType as PDC;
remote swallow
remote swallow
tender shard
#

are you shading papi?

#

because you shouldnt

#

do you have the papi player extension installed and enabled?

#

/papi ecloud download player

#

show your pom.xml

remote swallow
#

./papi reload

tender shard
#

?paste

undone axleBOT
tender shard
remote swallow
#

so you arent reloading 10 times if you install 10 expansions

tender shard
#

hm well

#

I mean reloading it takes like 0.07 seconds

remote swallow
#

true ig

tender shard
#

paste your pom.xml

remote swallow
#

could be a papi version mismatch

#

what event is that on?

tender shard
#

hm that looks good

remote swallow
#

who is seva

#

placeholder api is me.clip

tender shard
remote swallow
#

should placeholder api come from me.clip for it to work will all papi versions

fervent prawn
primal goblet
#
File file = new File("spigot.yml");
        FileConfiguration yml = YamlConfiguration.loadConfiguration(file);
        yml.set("messages.unknown-command", Major.MU("&cUnknown command. Type \"&e/help&c\" for help."));
        try {
            yml.save(file);
        } catch (Exception e) {}

the spigot.yml is not saving? am i did that wrong?

ionic thicket
#

what is better between

if(sender instanceof Player && hasPermission){}

and

if(sender instanceof Player){
if(sender.hasPermission)
}

i mean is there a difference?

remote swallow
remote swallow
remote swallow
primal goblet
fervent prawn
humble tulip
#

Wait the file didn't change?

primal goblet
hazy parrot
#

you probably cant get spigot.yml like that as root path is relevant to plugins folder iirc

humble tulip
#

There's probably a way to change it at runtime

primal goblet
#

hmmm

remote swallow
#

i just checked and the file, file config, settings and saving is all correct

ionic thicket
hazy parrot
remote swallow
primal goblet
remote swallow
primal goblet
hazy parrot
remote swallow
#

you beat me to it

tender shard
ionic thicket
#

ty

remote swallow
tender shard
#

no

primal goblet
#

ik the code, thank you guys

tender shard
#

the world container is the server folder

remote swallow
#

it would get that folder contents

tender shard
#

the world container is the folder where world, world_the_end etc are

remote swallow
#

not the parents contents

tender shard
#

so it's where spigot.yml is

hazy parrot
#

oh, no getParent then ig

tender shard
#

a better name would have been Bukkit.getServerRoot() or sth

remote swallow
#

pr it

humble tulip
tender shard
#

or, the complicated way lol

File rootFolder = new File(Bukkit.class.getProtectionDomain().getCodeSource().getLocation().getPath());
humble tulip
#

just do this

tender shard
#

or ```java
File serverFolder = new File(System.getProperty("user.dir"));

primal goblet
humble tulip
#

it won't

#

but you can just set it onEnable

#

or onLoad

#

that way when your plugin is removed, it wont have any changes

#

Your plugin shouldn't really be modifying spigot.yml anyways

primal goblet
#

hmm

#

i'll give it a try i'm gonna try the world container things first

humble tulip
#

just setting in onEnable is so much cleaner

#

idk why you want to modify the spigot.yml

tender shard
#

I finished my first java game! try it out, it's awesome

    public static void main(String... args) throws IOException {
        UUID uuid = UUID.randomUUID();
        String input = "";
        try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in))) {
            System.out.println("Guess the UUID: ");
            input = bufferedReader.readLine();
            if(uuid.toString().equals(input)) {
                System.out.println("Correct!");
                return;
            } else {
                System.out.println("Wrong! Try again");
            }
        }
    }
primal goblet
#

and... the container code is not working too,

tender shard
#

container code?

primal goblet
#

but from the static class SpigotConfig it works for me

primal goblet
tender shard
#

what does it return?

#

print out the return value

primal goblet
remote swallow
#

add getParent

tender shard
#

btw you can get spigot.yml like this:

humble tulip
#
try {
    Field fileField = SpigotConfig.class.getDeclaredField("CONFIG_FILE");
    fileField.setAccessible(true);
    File sipgotYML = (File) fileField.get(null);
} catch (ReflectiveOperationException e) {
    e.printStackTrace();
}
tender shard
#
Bukkit.spigot().getConfig()
tender shard
primal goblet
# tender shard what does it return?

it returns the full path for the server directory, it works 100% but i guess the issue from minecraft or smth is not let me change the spigot.yml file

humble tulip
#

he want the spigot.yml file

tender shard
humble tulip
#

the file

primal goblet
humble tulip
#

so he can modify the config and save it

primal goblet
#

thank you guys

humble tulip
#

lmfao

primal goblet
humble tulip
#

modifying the file was pointless anyways

#

DONT MODIFY THE FILE

#

i was just trying to help u

primal goblet
humble tulip
#

haha

#

good ๐Ÿ™‚

primal goblet
humble tulip
primal goblet
#

it sucks when i go to every spigot instance and change it manually so thats the system plugin.. auto is better

primal goblet
ionic thicket
#
        String comando = "declarewar";
        Player player = (Player)sender;
        
        if(command.getName().equalsIgnoreCase(comando)) {
            
            
            
            // CODICE DA ESEGUIRE SE IL PLAYER FA IL COMANDO
            
            
            
            if(player.hasPermission("red.declare.war")) {
                //CODICE DA ESEGUIRE SE IL PLAYER ESEGUE IL COMANDO E SE HA IL PERMESSO RED.DECLARE.WAR
                player.sendMessage("RED");
            }
            else if(player.hasPermission("blue.declare.war")) {
                //CODICE DA ESEGUIRE SE IL PLAYER ESEGUE IL COMANDO E SE HA IL PERMESSO BLUE.DECLARE.WAR
                player.sendMessage("BLUE");
            }
            
            else {
                player.sendMessage("you cant do that");
            }```
humble tulip
#

what's the issue?

tender shard
#

why don't you just do ```java
SpigotConfig.unknownCommandMessage = "whatever";

#

I mean it's a public field

remote swallow
tender shard
#

oh ok

ionic thicket
#

yo, if i do not have any permission (im not operator), and i try to execute the command, the game executes the second condition an says "BLUE"

ionic thicket
tender shard
humble tulip
#

send your plugin.yml

ionic thicket
#

damn cant send it here

#

main: mainpack.KCMain
name: KC
author: Mute#8348
version: 0.0.0
commands:
rules:
usage: <rules>
description: Shows the server rules

declareWar:
    usage: <declareWar>
    description: Puts the server at war and causes consecquences.
ionic thicket
remote swallow
#

set it to default false then

ionic thicket
#

im using luckperms

#

and i dont have any permission there

tender shard
#

what the heck is this for

ionic thicket
#

and still does the code like if i had the blue

remote swallow
#

set it to default false in ur plugin.yml

tender shard
ionic thicket
#

String comando = "declarewar";

remote swallow
tender shard
tender shard
#

but they claimed to not be op

humble tulip
remote swallow
#

unless you have multiple commands going to that file you dont need to check the name

tender shard
ionic thicket
humble tulip
#

remove luckperms

#

try again

#

see what happens

#

if you were op you'd see RED

#

so you're not op

tender shard
#

yeah you definitely have the permission

remote swallow
#

im going to bed, alex ping me if something funny happens

ionic thicket
remote swallow
#

ty

#

ill give you an egg when i wake up

tender shard
#

i only accept greggs

remote swallow
#

ill give you a gregg

tender shard
#

thx

ionic thicket
#

ok it now says that i dont have the permission

humble tulip
#

lmfao

ionic thicket
#

removing luckperms

tender shard
#

then fix your permissions in luckperms

humble tulip
#

@remote swallow

ionic thicket
#

i can send you the screen of my player not having them tho

humble tulip
#

you're probably ina group that has the perms

ionic thicket
#

never touched groups, always worked on a single player

humble tulip
#

lol well luckperms is allowing you the permission

#

sooooooo

ionic thicket
#

if it works, im not touching it xD

humble tulip
#

just delete your luckperms data

#

ez fix

ionic thicket
#

ty

tender shard
#

then you'll see where it comes from

ionic thicket
#

didnt know that

#

didnt know a lot of stuff actually

#

and still dont

jagged monolith
#

https://luckperms.net/wiki Then read this if you want to learn luckperms

ionic thicket
#

aye

#

ty

mighty aurora
#

I have an issue with lineOfSight that I don't know how to fix. If I am not facing straight it will teleport me to the wrong location. As in if I look at the block that is on the same level as my feet(so if I was in it the upper half of my character would be exposed lower half inside the block) it will teleport me backwards... on top of this when I teleport it forces me to turn south every time but teleports me to the right spot... List<Entity> entities = p.getNearbyEntities(10, 2, 10); List<Block> block = p.getLineOfSight(null, 10); block.forEach(block1 -> { entities.forEach(entity -> { if(entity.getLocation() == block1.getLocation().add(0,1,0) || entity.getLocation() == block1.getLocation().add(0,2,0)) ((Damageable) entity).damage(2); }); if(block1 != null){ p.teleport(block1.getLocation()); } });

humble tulip
#
            entities.forEach(entity -> {
                if(entity.getLocation() == block1.getLocation().add(0,1,0) || entity.getLocation() == block1.getLocation().add(0,2,0))
                    ((Damageable) entity).damage(2);
            });
#

this does nothing btw

mighty aurora
#

It doesn't

#

its supposed to damage entities that would have been in the players path

humble tulip
#

yeah but it wont work

#

just p.teleport(block1.getLocation.add(0,1,0));

#

but before that

mighty aurora
#

Wouldn't that mean the player is moved 10 times?

humble tulip
#

p.teleport(block1.getLocation().add(0.5,1,0.5).setDirection(p.getLocation().getDirection()));

#

what?

#

that code is filled with bugs if you're doing what i think ur doing

mighty aurora
#

The player is supposed to be teleported up to 10 blocks forward(less if their are blocks in the way) and to deal a specific amount of damage to all entities that are in that path.

#

^ that is the purpose.

humble tulip
#

Yep that seems abt right

#

so that won't work

#

not as you expect

mighty aurora
#

So can you help me get it to work?

humble tulip
#

sure

mighty aurora
#

because I'm a bit lost at this point

humble tulip
#

p.getNearbyEntities(10, 2, 10);

#

why is y =2 there?

#

why not 10?

#

what if the player is looking up?

mighty aurora
#

Yeah I just thought of that

humble tulip
#
if(block1 != null){
    p.teleport(block1.getLocation());
}
#

if the player is looking at a flat wall, they will suffocate

mighty aurora
#

I wasn't sure how to get the block just before the block targetted

humble tulip
#

What if they're looking at a ledge

#

that doesn't work either

#

just check if the targetted block has 2 blocks of air above it

#
                        entities.forEach(entity -> {
                           if(entity.getLocation() == block1.getLocation().add(0,1,0) || entity.getLocation() == block1.getLocation().add(0,2,0))
                               ((Damageable) entity).damage(2);
                        });

For this, you're using == to compare locations

#

that wont work cuz block1.getLocation returns a copy, so does entity.getLocation

#

so they will never reference the same object

#

even if you used, .equals it's unlikely that an entity is ever on the corner of a block

#

furthermore, List<Block> block = p.getLineOfSight(null, 10); only returns non-air blocks since you passed null. There won't be entities in solid blocks

mighty aurora
#

Thats what the entities list is for

#

oh wait

#

nvm

humble tulip
#

what spigot version u using?

mighty aurora
#

1.19

humble tulip
#

great

#

use the raytrace feature

#

to get the entities

mighty aurora
#

But that just returns the closest entity...

humble tulip
#

yeah

#

well start another raytrace from there

#

with the same direction

#

and subtract the distance of the found entity from initial distance you were raytracing (which is 10)

#

so when you find one, you keep looking in that direction

mighty aurora
#

How would I start a raytrace from the new raytrace?

#

take the result and find the entity then just repeat the code but from the entity?

quaint mantle
#

Anyone know how I can change the other empty spots to all one block? Like a staned glass, im using deluxemenus

#

nvm i think i figured it out

tender shard
humble tulip
# mighty aurora How would I start a raytrace from the new raytrace?
    public static List<Entity> traceEntities(Player p, double distance) {
        Location startLocation = p.getEyeLocation();
        Vector direction = p.getEyeLocation().getDirection();

        List<Entity> traced = new ArrayList<>();
        while (distance > 0) {
            RayTraceResult result = p.getWorld().rayTraceEntities(startLocation, direction, distance);

            if (result == null)
                break;
            
            Entity entity = result.getHitEntity();
            traced.add(entity);
            Vector hit = result.getHitPosition();

            distance = distance - hit.distance(startLocation.toVector());
            startLocation = new Location(startLocation.getWorld(), hit.getX(), hit.getY(), hit.getZ());
        }
        
        return traced;
    }
#

try that

#

i didnt test it

bold flume
#
worlds:
  adSpawn:
    id: 66825460-4e92-46ac-b763-c2ad669f0fb7
    name: adSpawn
  world:
    id: 5027780b-152a-4d13-9c02-6474ad1c950d
    name: world
  test:
    id: 7cdecd8a-9f8e-4a8a-a095-138e9ae33053
    name: test

Is there anyway to store just the name value inside of an array for my plugin? I tried before but couldn't get it.

humble tulip
#

no need to have name if it already exists

#

config.getConfigurationSection("worlds").getKeys(false)

#

will return Set<String> containing [adSpawn,world,test]

bold flume
#

thank you so much!

humble tulip
#

np

tender shard
#
List<String> myList = new ArrayList<>();
ConfigurationSection worldsSection = getConfig().getConfigurationSection("worlds");
for(String world : worldsSection.getKeys(false)) {
  ConfigurationSection worldSection = worldsSection.getConfigurationSection(world);
  myList.add(worldSection.getString(name);
}
#

sth like this

#

might contain typos, I typed it directly into discord

bold flume
#
[20:59:02 ERROR]: Exception when MountMario attempted to tab complete wtp
org.bukkit.command.CommandException: Unhandled exception during tab completion for command '/wtp ' in plugin Projectmario vBeta 1.3
        at org.bukkit.command.PluginCommand.tabComplete(PluginCommand.java:150) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.Command.tabComplete(Command.java:93) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.tabComplete(SimpleCommandMap.java:240) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.tabCompleteCommand(CraftServer.java:2243) ~[paper-1.19.2.jar:git-Paper-307]
        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.tabComplete(CraftServer.java:2215) ~[paper-1.19.2.jar:git-Paper-307]
        at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.getSuggestions(BukkitCommandWrapper.java:74) ~[paper-1.19.2.jar:git-Paper-307]
        at com.mojang.brigadier.tree.ArgumentCommandNode.listSuggestions(ArgumentCommandNode.java:71) ~[brigadier-1.0.18.jar:git-Paper-307]
        at com.mojang.brigadier.CommandDispatcher.getCompletionSuggestions(CommandDispatcher.java:601) ~[paper-1.19.2.jar:?]
        at com.mojang.brigadier.CommandDispatcher.getCompletionSuggestions(CommandDispatcher.java:581) ~[paper-1.19.2.jar:?]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleCustomCommandSuggestions$5(ServerGamePacketListenerImpl.java:913) ~[?:?]
#
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.2.jar:git-Paper-307]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
#
Caused by: java.lang.NullPointerException: Cannot invoke "me.mountmario.projectmario.util.config.DataManager.getConfig()" because "this.data" is null
        at me.mountmario.projectmario.worldcreator.wtptab.onTabComplete(wtptab.java:22) ~[projectmario-Beta 1.3.jar:?]
        at org.bukkit.command.PluginCommand.tabComplete(PluginCommand.java:138) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
        ... 22 more
bold flume
tender shard
#

what's wtptab line 22?

#

anyway, "data" is null

#

also please use proper class names

#

"wtptab" looks like an obfuscated name lol

bold flume
#

ConfigurationSection worldsSection = data.getConfig().getConfigurationSection("worlds");

#

line 22

tender shard
#

data is null

bold flume
#

what

#

thats my file

tender shard
#

the error message even says that

#

you basically try to do null.getConfig()

bold flume
#

that is so confusing

tender shard
#

show the full class

#

?paste

undone axleBOT
bold flume
#

the full DataManager class?

tender shard
#

yes

#

no

#

the the wtptab class

bold flume
#

ok

tender shard
#

yeah you never assign any value

#

you just say "DataManager data" iin line 17

#

example:

#
String name = "mfnalex"; // name is now mfnalex
String anotherName; // anotherName is null - you never assigned a value
#

do you already have a DataManager object in a another class? If so, is it that one that you wanna use?

bold flume
#

yes

tender shard
#

in which class, the main class?

bold flume
#

multiple

#

i do the same thing in multiple others and it owrks

tender shard
#

no, it definitely doesnt work in other classes

#

your other classes must be different

#

please show another class that has a DataManager where it works

bold flume
#

should i send one?

#

ok

tender shard
#

in that class, you do "new DataManager" in line 31

#

that's why it' snot null there

#

are you fine with having a "new" DataManager object in every class? Normally I guess you would want all classes to use the same datamanger

#

and not have a different one in every class right?

bold flume
#

im fine with it

#

so just add a new data manager thing?

tender shard
#

then just change line 17 in wtptab to DataManager data = new DataManager(ProjectMario.getPlugin());

#

I still feel like you actually want all classes to share the same instance of the datamanger

#

otherwise it seems quite useless to me. although ofc I have no idea what it does, so maybe it's okay

bold flume
#

its like red

#

very red underlines

tender shard
#

it will show a proper error if you hover over it

bold flume
#

unexpected token

tender shard
#

show your current code again pls

bold flume
#

fixed it

#

i pasted the wrong thing

tender shard
#

kk

bold flume
#

i feel stupid

ionic thicket
#

is there a method like onDisable or onEnable that executes the code in loop?

tender shard
tender shard
#

onDisable and onEnable gets called exactly once

#

what are you trying to do?

ionic thicket
#

exactly

tender shard
#

you try to have some code that runs like every tick or every second?

ionic thicket
#

yea

tender shard
#

?scheduling

undone axleBOT
ionic thicket
#

i want to check if at least one variable is true in every second

tender shard
#

example:

#

the link I sent above explains it in detail

#

0 means no initial delay (run it right now), and 20 means "also run it every 20 ticks" = 1 second

ionic thicket
#

oh ok

#

thank you

tender shard
#

np

bold flume
tender shard
#

show your datamanger class

bold flume
#

ok

tender shard
#

okay so you do set this.plugin = plugin

#

that means you probably pass in null into the constructor

#

which probably means that ProjectMario.getPlugin() returns null

#

so please show your main class

tall dragon
#

alex over here 3 am. still helping the people in need

#

what a trooper

tender shard
#

and you wanted to go to bed 2 hours ago lol

#

oh no

#

I confused you with EpicEbic

tall dragon
#

yeaa i guess our names can be similar

tender shard
#

well it's not my fault, you both have name.startsWith("Epic")

#

yeah and both have a pink name

#

lol

tall dragon
#

my profile gif is vastly superior though

bold flume
tender shard
#

you assign "plugin = this" in line 35

#

but you already create your tab completers before that

#

so plugin is still null

#

move "plugin = this" at the top of onEnable

bold flume
#

ok

tender shard
#

or, even better: use an init block

#

example:

#
public class MyPlugin extends JavaPlugin {
  private static MyPlugin plugin;
  
  {
    plugin = this; // We declare it here already. So in onEnable, it's already set
  }

  public void onEnable() {
    ...
  }
}
#

this is imho the best way to go

worldly ingot
#

Creative

tender shard
#

i always do it like this

worldly ingot
#

I do it onLoad() if I absolutely need to tbh

tender shard
#

yeah if you need a reference before onLoad, you fucked up big time anyway

#

still, I think this is easier to read and it makes more sense because the instance should never be null if the class has already been created

ionic thicket
tender shard
tender shard
#

I'll explain

#

so the method is runTaskTimer(someplugin, somecode, somenumber, somenumber);

#

somecode is this part

() -> {
  ...
}
#

it's a lambda, don't worry about it

#

the code I sent is perfectly fine

#

easily said, lambdas basically let you "pass code as variable/parameter"

ionic thicket
#

ookey

tender shard
#

the blog post also uses the scheduler for examples

ionic thicket
#

sure thank you

tender shard
#

np

ionic thicket
#

but

#

i dont have time now to read it, i will do it tomorrow

#

it's 3:30 here, can i sen my code a sec?

tender shard
#

you are missing the arrow

#

behind the ()

#

() -> { ... }

#

insert "->" between that

ionic thicket
#

i tought it was something of the editor xDDDD

tender shard
#

nah that's the lambda "symbol" lol

ionic thicket
#

well

#

ok ahahahah

tender shard
#

btw you don't have to call super.onEnable()

#

it doesnt do anything

ionic thicket
#

ill delete it

#

it was auto generated

tender shard
#

btw there's also no need to use "plugin.something" all the time

#

you can just directly use "something"

#

instead of "plugin.getCnofig()" just do "getConfig()"

ionic thicket
#

changed ๐Ÿ‘

bold flume
tender shard
bold flume
#

just figured it out ๐Ÿ˜„ we forgot to return the values

tender shard
#

oh ok lol

faint pumice
#

Hey guys, i'm trying to use the openEnchanting() method, but it doesn't do anything. When i switch to openWorkbench() it works fine, i don't know what is happening, see the code below

#
Player player = playerInteractEvent.getPlayer();
player.openEnchanting(null, true);
tender shard
#

the location has to be a valid enchantment table IIRC

#

i know, you are using the "force" flag, but apparently there were NMS changes and now you indeed need a table

#

it can probably be anywhere

faint pumice
tender shard
#

as long as it's in the same world

tender shard
faint pumice
#

thanks anyway haha i'll comeback to say if it worked

tender shard
#

oki ๐Ÿ™‚

worldly ingot
#

You're correct, alex. Yeah. You need an actual table now

#

It's how the levels are determined (i.e. bookshelves)

humble tulip
#

Is there no way around this?

#

@worldly ingot

#

Maybe with nms

tender shard
#

NMS moment

#

why do I need to pass in the player's connection when I have to pass the player anyway

#

why can't the method automatically get the connection lol

mighty aurora
#

Quick question. If I find a block location using raytracing how would I go about getting the position before that block so that I can teleport them to it?

tender shard
#

@eternal night sorry for ping, but there's a weird thing I only encounter in paper. I know this is not paper but obv I cannot ask on their discord.

I am trying to send a chat message using Player#chat(String). On Paper, I get the following stacktrace: https://paste.md-5.net/exazalenip.bash
On Spigot, it works fine.

I have to add that the player that's sending the message is just a player I created myself from NMS, it's not an actual player. It however has a proper ServerPacketGameImpl and stuff.

warm light
#

okay but how can i give it a enderchest?

#

to hold

tender shard
#

by using getEquipment().setItemInMainHand(new ItemStack(Material.ENDER_CHEST))) ?

eternal night
#

Basically chat triggers all events but doesn't properly setup the state paper internally expects for handling signatures etc

tender shard
#

so I can just continue to use chat(String) and wait for a fix?

eternal night
#

@tender shard how old is your paper install m

buoyant viper
#

y r u banned from paper again

tender shard
#

tbh it's a bit older. but the customer who requested this plugin is apparently using a newer version. I'll retry with latest paper

eternal night
#

Grab a new one yea, iirc machine merged stuff related

tender shard
buoyant viper
#

dam

tender shard
#

I could have understood a temp ban but perm ban was a bit too much imho lol

#

anyway, I'll retry with latest paper, thanks lynx

#

I was still on paper 323 btw

tender shard
#

not all entities can hold items

#

what entity are you using?

#

@eternal night on latest paper it's fixed, thanks! I thought that I was doing sth wrong lol

warm light
tender shard
#

maaan why did I never got a reply to my ban appeal haha

#

I spent an hour on this issue before I pinged you lol

buoyant viper
#

?jd-s

undone axleBOT
strong parcel
#

I have started working with NPCs, and I put this in my pom.xml because I was told it would handle the remapping from mojang back to spigot automatically. However, Maven does not recognize the artifact ID. Any ideas as to what is causing this error? https://paste.md-5.net/bupiqacowa.xml

buoyant viper
rich pewter
#

Is there a way to use spigots persistent data storage to store data on the plugin instead of an ingame object like a block or entity? Say I want to store a list of players who meet some criteria.

buoyant viper
#

u could make a file in the plugin data folder

rich pewter
#

i was just wondering if there was a way without dealing with file read/writes

buoyant viper
#

@tender shard more custom PDCs when?

tender shard
#

got any suggestion?

buoyant viper
#

that guy right there

#

plugins

rich pewter
#

mee

eternal night
#

A pdc for a plugin would be kekw

buoyant viper
tender shard
#

PDC basically works for everything where vanilla can store NBT data

eternal night
#

I mean, implementable for sure

tender shard
#

yeah sure but what's the point lol

buoyant viper
#

its a novel idea ill give them that

eternal night
#

Well maybe you don't want to manage yaml

rich pewter
tender shard
#

why do people now ask me to send me my paper .jar

#

I mean it's understandable for spigot, where you have to run buildtools

#

but paper literally has a one click download lol

eternal night
#

It's hard to find

tender shard
#

yeah indeed

buoyant viper
#

true

tender shard
#

you have go to the website and click on download

eternal night
#

And if it's legacy you even have to answer a quiz

tender shard
#

that's indeed not so easy

tender shard
buoyant viper
#

legacy quiz bypass script when?

eternal night
#

Cool kids download from API

tender shard
buoyant viper
#

but that was yesterday

rich pewter
#

actually, it is kind of annoying to find a sub-version like 1.19.2. i have to scroll all the was past all the 1.19.3 builds

buoyant viper
#

or well yester-yesterday

tender shard
buoyant viper
#

oh

tender shard
#

silly hannah

eternal night
rich pewter
#

fair enough

#

but id rather answer a quiz than have to scroll

eternal night
tender shard
#

btw because someone asked about saving PDC in a "plugin" or sth

#

you could loop over all PDC keys, get their correct primitive datatype (paper has API for that, in spigot you gotta check it yourself), and then just throw that into a yaml

#

that's the only way I could imagine right now

eternal night
#

Or just implement the pdc interface yourself

tender shard
#

would be nice if PDC would have a method that turns the whole thing into a YamlConfiguration or sth

eternal night
#

It does internally

#

But that's horribly Borken

#

Broken