#help-development

1 messages · Page 1357 of 1

paper viper
#

its nms i think

obtuse basin
#

U need NMS

sullen dome
quaint mantle
#

you need nms packaged version

#

are u using maven?

#

if so, change “spigot-api” to “spigot” and refresh your maven imports

sullen dome
#

does anyone has knowledge of JDA?

quaint mantle
sullen dome
#

can you maybe explain to me, what a guild is? i still dont get it, and couldnt find anything on google

sullen dome
#

if so, i dont know why guild#getMembers() only returns this:
[20:57:30] [Server thread/INFO]: [MB:UtilsBot(U:UtilsBot(***) / G:Rivex-Network(***))]

i mean... there are like 40 people on my dc

upper vale
sullen dome
#

i have no clue what that means xd

upper vale
#

pretty sure you need to enable a gateway intent and specify a cache policy when you are creating the JDA instance

deft sedge
#

How would i detect what a player eats, is it an event?

sullen dome
upper vale
sullen dome
#

almost

deft sedge
#

ok

#

and then how do i detect what they ate

outer crane
#

the paradox... which event is it 👀

upper vale
#

javadocs

sullen dome
#

guess event.getItem()?

outer crane
#

JavaDocs are this reading thing

deft sedge
#

k

outer crane
#

actually pretty simple

deft sedge
#

ill read docs

dusty herald
#

?jd

outer crane
#

you open them, read and learn

deft sedge
#

yea ik

#

thx

sullen dome
#

oh theres a cmd for the docs lol

dusty herald
#

yes

deft sedge
#

it's .getitem

sullen dome
#

i guess this is right?
builder.setMemberCachePolicy(MemberCachePolicy.ALL);

#

looks like

dusty herald
#

.getitme doesn't exist

deft sedge
#

ik

#

i can't english

dusty herald
#

.getitem doesn't exist

deft sedge
#

ok .getItem

upper vale
#

Does anyone know how to keep a ResultSet open after closing a Connection in a try-with-resources statement? I want to store the ResultSet and loop through it at a later time after closing the connection with a try-with-resources statement.

dusty herald
#

that doesn't exist either

sullen dome
#

it does

dusty herald
#

it's .getItem()

#

not .getItem

deft sedge
#

Ok thanks

sullen dome
#

oh boy

deft sedge
#

FOR the INFO

sullen dome
#

joch, love you for such stuff

#

like every ide has autocomplete

deft sedge
#

my life is .getI and then tab

#

and then it just does it

sullen dome
#

yeah

sullen dome
#

who dont use autocomplete, isn't a human

#

change my mind

upper vale
sullen dome
#

dafuq why so complicated lmao

#

fuck discord lol

upper vale
#

facts

sullen dome
#

i mean... i only want to get a member from it's minecraft-uuid

#

like

#

from username and discriminator, but it always is null, because of this intent stuff i guess

dusty herald
#

imagine discord implementing Minecraft account connections

sullen dome
#

dafuq

#
verify:
  5b22ca46-9470-41f4-8c79-d54f29bf2e40:
    username: Rivex
    discriminator: '1886'

i mean... i have it... so yeah

dusty herald
#

wouldn't be better to use their ID instead of their username and discriminator?

#

since those change

sullen dome
#

idk... discriminator doesnt change iirc

dusty herald
#

it does

sullen dome
#

wtf

#

true, with nitro

#

nvm

upper vale
#

Why do you need to get all members tho

#

just get that 1 person

dusty herald
#

they're not using it for just one person

#

that was an example

upper vale
#

o

sullen dome
#

i dont need. but i did to see how tf members are readable

#

i mean... i wanted to see why it returns null

#

and it seems because of the intents

ivory sleet
upper vale
#

pretty sure it does... unless they changed it

ivory sleet
#

Thought it returned a rest action

#

¯_(ツ)_/¯

upper vale
#

oh wait

sullen dome
#

retrieveMembers is deprecated tho

upper vale
#

yeah it returns completable future but its deprecated now

#

yea

ivory sleet
#

Oh lol

quaint mantle
#

I'm running some tasks for mysql and I want to run it async, which would be better? CompletableFuture's runAsync or Bukkit's async scheduler?

upper vale
deft sedge
#

Material.LEGACY_RAW_CHICKEN is raw chicken right. .RAW_CHICKEN doesn't exist

upper vale
#

isnt it uncooked_chicken or smth

ivory sleet
deft sedge
#

oh i'll try that

upper vale
#

wait no

#

CHICKEN = uncooked chicken

#

COOKED_CHICKEN = cooked chicken

deft sedge
#

maerial.UNCOOKED_CHICKEN isn't a thing

upper vale
#

i meant cooked lol

dusty herald
#

they didn't say it was?

ivory sleet
deft sedge
#

ohhh

#

ok

#

ur right

#

nvm

deft sedge
upper vale
#

anyone know if its possible to close a connection and preparestatement but leave the resultset open

sullen dome
dusty herald
#

yes

#

very much yes

sullen dome
#

kl

#

k

upper vale
#

trying to store the resultset to be looped in a seperate method but closing a connection automatically closes all child resources :/

lost matrix
upper vale
#

F

lost matrix
upper vale
#

just to clean up the code a little bit instead of create a connection and prepared statement every time, and instead make a utility method like such as the following but for querying rather than updating

  public void executeUpdate(@Language("SQL") String sql, Object... placeholders)
      throws SQLException {

    try (Connection connection = source.getConnection();
         PreparedStatement statement = connection.prepareStatement(sql)) {

      for (int index = 0; index < placeholders.length; index++) {
        statement.setObject(index + 1, placeholders[index]);
      }

      statement.executeUpdate();
    }
  }
lost matrix
# upper vale F

I mean if your result set is scrollable (since JDBC 2 iirc), then you can reuse the ResultSet itself by calling ResultSet#beforeFirst, rather than having to copy the data out of it.

#

Wait you want to store the actual ResultSet for later iteration?
Thats a bad idea as its just a cursor. You need an open connection for that.

upper vale
#

Can I shove everything in the result into an object and return that instead or is that a bad idea

ivory sleet
#

what object? I mean sounds fine

sullen dome
#

[21:24:20] [JDA MainWS-WriteThread/WARN]: CloseCode(4014 / Disallowed intents. Your bot might not be eligible to request a privileged intent such as GUILD_PRESENCES or GUILD_MEMBERS.)
what?

upper vale
#

did you tick the Guild members intent thing on the website?

sullen dome
#

oh

#

fml

#

where exactly?

upper vale
#

lmao

#

its in the bot account

sullen dome
#

ah got it

#

does that save, or do i need to re-invite it?

upper vale
#

it saves

sullen dome
#

it still only shows itself and the server as members weirdly

carmine urchin
#

How would you detect each arg in a chat message with asyncplayerchat event?

lost matrix
quaint mantle
#

hey how do i disable the an player kicking other player when the player is already playing? on bungeecord

dusty herald
#

can't

#

if you mean bungeecord kicking someone if they're already connected to the proxy

quaint mantle
#

i mean

lost matrix
#

Cant you listen for the handshake and just refuse the players connection attempt if someone with this name is already playing?
Sounds possible to me.

quaint mantle
#

ill try

#
@EventHandler(priority = EventPriority.HIGHEST)
    public void onLoginEvent(PlayerHandshakeEvent e) {
        instance.log("debud");
        ProxiedPlayer player = (ProxiedPlayer) instance.getProxy().getPlayer(e.getConnection().getName());

        if (player.isConnected()) {
            e.getConnection().disconnect(TextComponent.fromLegacyText("disconnected"));
            instance.log("debug1");
        }
    }
#

returns null at the proxiedplayer method

lost matrix
#

On the handshake there is no connection established jet. Thats what you want to prevent.

#

You get the PendingConnection from the PlayerHandshakeEvent.

quaint mantle
#

like getConnection() or getHandShake()

lost matrix
#

You should be able to figure out which of those two returns a PendingConnection object if you have a half decent IDE

quaint mantle
#

sorry findout that is getconnection

#

didnt notice it in eclipse

#

so i got the pending connection and how do i check if the player is already playing?

lost matrix
raw swallow
#

is there a way to get the command on the option #TabCompleteEvent ?

lost matrix
#

Is it for your own command?

quaint mantle
#

idk which to use just isConnected() but that kicks me even when im not connected

raw swallow
carmine urchin
lost matrix
quaint mantle
#

so like this? instance.getProxy().getPlayer(e.getConnection().getName()).isConnected()

#

that doesnt work

lost matrix
quaint mantle
#

idk how

#

could you tell me?

lost matrix
#

You have a very simple task.
Check if a name or uuid is already associated with an established connection

quaint mantle
#

so i need to check if uuid is connected already? or

lost matrix
#

Is it for a server in offline mode?

quaint mantle
#

yes

lost matrix
#

Then UUIDs are not the way to go.

quaint mantle
#

yeah so name

#

how do i do that with names idk everything i try it doesnt work

lost matrix
unreal kayak
#

hello how do I make plugin enable after all worlds load?

sage swift
#

do everything in a runnable in the enable

quaint mantle
#
        instance.log("debud");

        if (instance.getProxy().getPlayer(e.getConnection().getName()).isConnected()) {
            e.getConnection().disconnect(TextComponent.fromLegacyText("lol"));
            instance.log("debug1");
        }
sage swift
#

but i think that should happen by default

kindred solar
#

guys

unreal kayak
kindred solar
#

i cant connect to my mongoDB

quaint mantle
#

do load: POSTWORLD in plugin.yml @unreal kayak

eternal oxide
#

@quaint mantle Your bungeecord should be in online mode (and configured) so its authenticating with Mojang.

kindred solar
# kindred solar i cant connect to my mongoDB
     ConnectionString connString = new ConnectionString(
            "mongodb+srv://user123:pass123@database.gpcfc.mongodb.net/database?retryWrites=true&w=majority"
    );
``` it is giving an error here
unreal kayak
#

thx

quaint mantle
#

the server i develop for is only for cracked users

lost matrix
eternal oxide
#

ah ok

quaint mantle
#

yeah im like trying to disable the kicking the players after the player connects with the same name

quaint mantle
#

something like authme does with You logged from another location

unreal kayak
lost matrix
quaint mantle
#

do i do codeblock or paste?

lost matrix
quaint mantle
#
22:19:49 [WARNING] Error dispatching event PlayerHandshakeEvent(connection=[/127.0.0.1:5920] <-> InitialHandler, handshake=Handshake(protocolVersion=340, host=localhost, port=25577, requestedProtocol=2)) to listener pavlyi.astreans.auth.listeners.BungeePlayerListener@15aab8c6
java.lang.NullPointerException
    at pavlyi.astreans.auth.listeners.BungeePlayerListener.onLoginEvent(BungeePlayerListener.java:103)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.md_5.bungee.event.EventHandlerMethod.invoke(EventHandlerMethod.java:19)
    at net.md_5.bungee.event.EventBus.post(EventBus.java:46)
    at net.md_5.bungee.api.plugin.PluginManager.callEvent(PluginManager.java:399)
    at net.md_5.bungee.connection.InitialHandler.handle(InitialHandler.java:315)
    at net.md_5.bungee.protocol.packet.Handshake.handle(Handshake.java:44)
    at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:105)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
    at```
#

io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:311)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:432)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.ByteToMessageDecoder.handlerRemoved(ByteToMessageDecoder.java:253)
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:515)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:447)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at```
#

io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.lang.Thread.run(Unknown Source)
lost matrix
#

Unless...

#

They are literally blocking the whole channel

quaint mantle
#

so paste?

lost matrix
#

NullPointerException @ BungeePlayerListener line 103
Pretty much what i expected.

quaint mantle
#

yea

lost matrix
#

Let me guess. Its this line:
if (instance.getProxy().getPlayer(e.getConnection().getName()).isConnected()) {

quaint mantle
#

yes

lost matrix
#

Nice. Then fix it. NPE is Java 101.

kindred solar
quaint mantle
#

what?

lost matrix
kindred solar
#

you're right xD sry org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/mongodb/ConnectionString here's the error

quaint mantle
#

the class is not found

lost matrix
quaint mantle
#

7smile7 could you tell me how to replace the error?

kindred solar
#

i already imported everything

#

and gave the right dependencies

lost matrix
lost matrix
kindred solar
lost matrix
kindred solar
#

i ill show u my pom file

#

?paste

queen dragonBOT
quaint mantle
#

@lost matrix idk how to do that

kindred solar
lost matrix
kindred solar
quaint mantle
#

idk which methods to check and get

lost matrix
# kindred solar here's my pom file

Add

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.2</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

In your pom

lost matrix
quaint mantle
#
instance.log("debud");
        ProxiedPlayer p = instance.getProxy().getPlayer(e.getConnection().getName());

        if (p.isConnected()) {
            e.getConnection().disconnect(TextComponent.fromLegacyText("lol"));
            instance.log("debug1");
        }
urban trout
#

hey so when i have 2 of the same lines on a scoreboard it just resets to an empty line

#

what do i do to solve that because i need 2 of the same separators?

kindred solar
quaint mantle
#

try

<dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver</artifactId>
            <version>3.11.3</version>
        </dependency>

kindred solar
#

add or replace

#

?

quaint mantle
#

replace with the you have there

<dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>4.2.2</version>
            <scope>compile</scope>
        </dependency>
#

add <scope>compile</scope>

#

ye

#

oh yea sry forgot the <scope>

lost matrix
quaint mantle
#

ohh

#

and @lost matrix how do i fix that?

fathom timber
#

What is mongodb?

kindred solar
#

database

fathom timber
#

Oh

lost matrix
quaint mantle
#
ProxiedPlayer p = instance.getProxy().getPlayer(e.getConnection().getName());

        if (p.isConnected()) {
            e.getConnection().disconnect(TextComponent.fromLegacyText("lol"));
            instance.log("debug1");
        }
#

these

kindred solar
quaint mantle
#

?paste

queen dragonBOT
lost matrix
quaint mantle
#
Bukkit.getLogger().info(ChatColor.DARK_BLUE + "Chereza enabled")

I'm using kotlin and i have error when im trying to use + for chatcolor like in java. How would i use?

quaint mantle
lost matrix
quaint mantle
#

wdym? i already use maven?

kindred solar
#

okok

quaint mantle
urban trout
#

how would i get placeholderapi placeholders into my scoreboard plugin

lost matrix
lost matrix
urban trout
#

on that just a tad confused

lost matrix
urban trout
#

nop

#

eclipse

lost matrix
# urban trout eclipse

maven is not an IDE
If you dont use maven then dont bother with APIs from other developers.

lost matrix
quaint mantle
fathom timber
#

ignore mynaming sense

#

?paste

queen dragonBOT
lost matrix
urban trout
storm tiger
paper viper
#

its a smiley face tho!

lost matrix
storm tiger
#

haha cute but not wanted lol.

paper viper
#

lol

storm tiger
#

default font?

lost matrix
storm tiger
#

1 sec

#

default texture pack

lost matrix
#

Ah ok. What version are you on?

storm tiger
#

pretty outdated 1.8

#

has something todo with my compiler though

lost matrix
#

That was a known bug back in the days.
Just search for some forum posts from half a decade ago.

quaint mantle
#

did this and gives me error https://paste.md-5.net/hiyolifule.bash

@EventHandler(priority = EventPriority.HIGHEST)
    public void onLoginEvent(PreLoginEvent e) {
        instance.log("debud");
        String playerName = e.getConnection().getName();
        ProxyServer proxyServer = instance.getProxy();
        ProxiedPlayer proxiedPlayer = proxyServer.getPlayer(playerName);

        if (proxiedPlayer != null) {
            instance.log("hahah");
            e.setCancelled(true);
        }
    }
storm tiger
#

going to take me years lol

lost matrix
quaint mantle
#

like try catch?

lost matrix
quaint mantle
#

umm so how do i fix that

#

im new to bungeecord

storm tiger
#

if im not wrong connection would be null on prelogin

lost matrix
quaint mantle
#

well just idk

cloud berry
#

imagine learning java before learnning the apis

quaint mantle
#

i did learn java a bit

lost matrix
quaint mantle
#

which event?

lost matrix
#

The event you are currently listening to

quaint mantle
#

and that information?

quaint mantle
#

so like getConnection()

fathom timber
#

Caused by: java.lang.ArithmeticException: integer overflow

#

Line 55:

sullen dome
#

what is line 55

fathom timber
#

wait

#

i may have fixed it

#

yeet nvm

sullen dome
#

just ?paste

#

?paste

queen dragonBOT
sullen dome
#

hate that bot

fathom timber
#

bout to get made fun of for my naming sense

#

😎

lost matrix
fathom timber
#

fwcool is what they wanted alright

quaint mantle
#

whats npe

fathom timber
#

i asked

#

NullPointExcepetion

sullen dome
#

the Integer is basically too high

#

i guess

fathom timber
#

yeah but how would I fix that?

#

Thats what the tutorial u gave me showed lol

#

and these throw an error aswell

#

what route should i go?

lost matrix
sullen dome
#

i cannot see any Math.toIntExact on the tutorial

#

70 thousand years? lol

fathom timber
#

wait

sullen dome
#

thats a lot

fathom timber
#

lmfao

#

15 = 70k+ years

#

:pog:

lost matrix
#

You need to work with deltas

#

Or unix timestamps which are longs

sullen dome
#

ask 7smile7, he likes to help :)

#

i am out of math

fathom timber
#

FR REAL

#

lmfao

#

anyways so

lost matrix
#

delta is just the difference between two values.
So the delta of 1000 and 1005 is 5
...

fathom timber
#

bro thats the first time ive ever heard that term

#

👀

#

the more u know

sullen dome
#

same

fathom timber
#

seen*

fading lake
#

it might be called difference in some places

fathom timber
#

How would I do a Unix timestamp?

#

See why I hate cooldowns @sullen dome

#

OMG

#

NVM I SLOW

fading lake
#

System.currentTimeMillis() gets the epoch millisecond

sullen dome
#

if you work with simple integers and a runnable, you probably dont even need to use currentTimeMillis

#

if i remember right

#

i looked, but dont have my old ffa plugin anymore

fathom timber
#

When the teacher says: Development is going to use math, me: the f* is a epoch

fading lake
#

wtf is math

fathom timber
#

fr

paper viper
#

is it a dead langauge?

fathom timber
#

yeah like honestly

#

i may just google "Cooldown APIs"

fading lake
#

like python?

fathom timber
#

so i dont have to do it 👀

fading lake
#

what are you struggling with lol

fathom timber
#

bro

obtuse basin
#

What's the best way checking if a world exists by worldname in if clause?

sullen dome
#
if(Bukkit.getWorld("worldname").isLoaded())```
i guess
#

or check if the world container isn't null

obtuse basin
eternal oxide
#

there is no isLoaded

sullen dome
#

then use the second idea

eternal oxide
#

but if (Bukkit.getWorld("name") != null) will work

sullen dome
#

@fathom timber try out this, should work for what you need.

    private Map<UUID, Integer> cooldown = new HashMap<>();
    private BukkitTask task;

    private void useAbility(Player p) {
        if (cooldown.containsKey(p.getUniqueID())) {
            //still on cooldown
            return;
        }
        //use ability
        cooldown.put(p, 15); // 15 means 15 seconds cooldown
        task = Bukkit.getScheduler().runTaskTimer(Main.getPlugin(), () -> {
            if (cooldown.get(p.getUniqueID()) > 0) {
                cooldown.put(p.getUniqueID(), (cooldown.get(p.getUniqueID())) - 1);
            } else {
                cooldown.remove(p.getUniqueID());
                //cooldown removed.
                task.cancel();
            }
        }, 0L, 20L);
    }
}

use ability means what you wanna have on cooldown.

fathom timber
#

bro

sullen dome
#

yeah

fathom timber
#

my brain 💥

#

macho ill look into maps b4 i use that

fading lake
#

do I smell not storing hashmaps as Map 🤔

obtuse basin
#

Me never used Maps

sullen dome
#

HashMaps are easy:

it contains a key, and a value.

if you save Player as key, and it's Rank as a value, you can for example later get his rank from that map.

sullen dome
fading lake
#

dont save a player as key save the UUID

sullen dome
#

because?

fading lake
#

because it takes up memory and can cause leaks

fathom timber
#

do i see single letter variables

fading lake
#

if you store the uuid you can properly track it and make sure it doesnt implode in on itself when the player quits

chrome beacon
#

You can also use weak maps

eternal oxide
#

player object can go stale and no longer reference the actual player

fading lake
sullen dome
#

updated the code

fading lake
obtuse basin
#

and when u use Playernames it can cause on a name change it will be seen as a complete different palyer

fading lake
#

correct

#

only noobs use playernames tho

rugged topaz
#

does anyone know of a good linux software to fork multiple minecraft servers and interact with them easily (thru the console)?

fading lake
#

or saving player data under the players EntityId :squint:

sullen dome
#

thats why i didnt used the name lol.
didnt knew that memory issue

fading lake
#

pterodactyl?

obtuse basin
green prism
#

Hi guys, can i do a question for a tip to search an API here?

chrome beacon
#

There are also rare cases where 2 players have rhe same name

rugged topaz
#

never heard of it

obtuse basin
# rugged topaz is pterodactyl good?

https://pterodactyl.io/ It's an web-based panel for servers

fading lake
sullen dome
fathom timber
#

bc ud you be logging PlayerRightclick and left click etc

sullen dome
#

it works for almost everything

rugged topaz
sullen dome
#

//use ability can be running an command, sneaking, whatever

#

whatever is on cooldown

green prism
#

Do you know an API for connect Minecraft and Telegram? I'm asking for a good and without plugin API

sullen dome
#

telegram xd

green prism
#

Yea

fading lake
#

telegram

fathom timber
#

oh

obtuse basin
#

... why

sullen dome
#

well i better shut my mouth lol

#

wouldnt go good

green prism
#

Telegram is very famous in Italy

obtuse basin
fading lake
#

telegram requires you to use its bots feature tho

sullen dome
#

telegram is mostly used by people telling you that corona doesnt exists right now

green prism
#

Idk any API for mc-discord

sullen dome
#

JDA

sullen dome
#

f

fading lake
sullen dome
#

Es existiert sehrwohl

fathom timber
#

@sullen dome would Main be my plugin name?

sullen dome
#

your main class

fathom timber
#

ah

green prism
#

Telegram is used for p.rn, Gaming and Technology in Italy

sullen dome
#

i know, i shouldnt call it main

fading lake
#

LOL

sullen dome
#

dont judge me please :(

fading lake
chrome beacon
sullen dome
#

i would prefer JDA for MC-Discord, but do whatever you want

obtuse basin
green prism
#

Ok thanks, i'm going to try JDA

sullen dome
#

yes i know

green prism
#

Bye bye my potatoes

#

Good night from Italy

sullen dome
#

good night 🌙

fading lake
#

Good night from the UK

sullen dome
#

from germany

fathom timber
#

How would I use Player player = ;

eternal night
#

This chat never fails to amaze me

chrome beacon
#

Good night from Sweden :)

sullen dome
#

where do you use it

fading lake
#

wdym

fathom timber
#

in my main class without command executor?

#

like

fading lake
fathom timber
#

or Player player;

sullen dome
#

what do you want to put on cooldown

eternal night
#

You can retrieve a player instance through a lot of different methods. Bukkit.getPlayer(uuid) could work

fathom timber
#

ahhhh

eternal night
#

But like, the player has to actually be online for this

sullen dome
#

if you for example want to have a command at cooldown, that command execution would be the //use ability

eternal night
#

Bukkit.getOnlinePlayers() returns a collection of all players currently on the server

fading lake
#

you could always use Bukkit.getOfflinePlayer if you wanted it more secure, then at least you have the offlineplayer.isOnline method

#

then from that you can use OfflinePlayer#getPlayer

sullen dome
#

the question is where he uses it. onEnable wouldn't do anything tho

fathom timber
#

shi

#

where do i put it?

sullen dome
#

wdude

fading lake
#

deflates

sullen dome
#

what do you want to be on cooldown

#

a command

fathom timber
#

A command

sullen dome
#

an action

fathom timber
#

I would've been done if this was an event

sullen dome
#

i see

fading lake
#

he's trying to put a cooldown on onenable :turkish_laughing_man:

sullen dome
#

gimme a sec

fathom timber
#

u good bro

#

KEKW

#

LOSER

#

jk ❤️

fading lake
#

NO U

fathom timber
#

oh 😦

fading lake
#

:)))))))))))))

abstract relic
#

u cant use external emojis

#

without nitro boosting the server

fathom timber
#

oh did someone use an external emoji

#

who would do that

abstract relic
#

think he tried to

fading lake
sullen dome
#

soo

#
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (cooldown.containsKey(p.getUniqueId())) {
                //still on cooldown
            } else {
                
                //execute your command
                
                cooldown.put(p.getUniqueId(), 15); // 15 means 15 seconds cooldown
                task = Bukkit.getScheduler().runTaskTimer(Main.getPlugin(), () -> {
                    if (cooldown.get(p.getUniqueId()) > 0) {
                        cooldown.put(p.getUniqueId(), (cooldown.get(p.getUniqueId())) - 1);
                    } else {
                        cooldown.remove(p.getUniqueId());
                        //cooldown removed.
                        task.cancel();
                    }
                }, 0L, 20L);
            }
        }
        return false;
    }```
this should help you out
fathom timber
#

👀

sullen dome
#

obv you need to implement your command args checks etc, but you guess how it works

fathom timber
#

this makes no sense to me bro

fading lake
#

deflates #2

fathom timber
#

i mean i dont even know nms and i could learn it faster than this

#

not wrong #2

sullen dome
#

thats why i made the comments

fading lake
#

I feel like making a cooldown thing that they can just shade in their repo, cause that way they wont have to look at the code and implode

sullen dome
#

you wanna send a message on cooldown?
replace //execute command with sendMessage.

#

its easy

deft sedge
#

I have a function that returns the item meta of whatever item it finds with the material type above, how do I store the return value of that into a variable. I tried this but it didn't work

#

CheckforMaterial is the class name

#

and scanPlayerInv is the function name

topaz cape
#

that didnt work too

deft sedge
#

?help

#

?spigot

deft sedge
#

thanks

eternal oxide
deft sedge
#

@eternal oxide how do i get the return value of a function:

#

?

kindred solar
#

some1 understands mongodb?

deft sedge
#

im looking at java stuff right now and it doesn't make much sense

#

wait

#

i might have figured it out

unreal quartz
deft sedge
#

yea

topaz cape
# eternal oxide Then you are doing something wrong elsewhere
            PermissionAttachment attach = p.addAttachment(this);
            rank.put(p.getUniqueId(), rankname);
            FileConfiguration file = RanksFile.getFile();
            for (String perm : file.getStringList(rankname + ".Permissions")) {
                attach.setPermission(perm, true);
            }
            for (String perm : file.getStringList(rankname + ".Denied Permissions")) {
                attach.setPermission(perm, false);
            }
            attach.getPermissible().recalculatePermissions();
            rankattachment.put(p.getUniqueId(), attach);```
deft sedge
#

So like this right?

topaz cape
#

i dont think im doin something wrong

unreal quartz
eternal oxide
#

thats all correct. if you are actually calling it and yoru this variable actually refers to your plugins main class

deft sedge
#

well it returns the item meta of a book in the players invenotry

topaz cape
#

its the main class

deft sedge
#

so yea

topaz cape
#

but i dont get the perms

#

if i do Player.sendMessage

#

it works

eternal oxide
#

are you using some other perms plugin that is erasing all perms?

#

and at what point in yoru plugin are you running this code?

topaz cape
#
    public void login(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        //if (isMySQLConnected) {
            String rankname = getRankName(p);
            PermissionAttachment attach = p.addAttachment(this);
            rank.put(p.getUniqueId(), rankname);
            FileConfiguration file = RanksFile.getFile();
            for (String perm : file.getStringList(rankname + ".Permissions")) {
                attach.setPermission(perm, true);
            }
            for (String perm : file.getStringList(rankname + ".Denied Permissions")) {
                attach.setPermission(perm, false);
            }
            attach.getPermissible().recalculatePermissions();
            rankattachment.put(p.getUniqueId(), attach);
        //}
    }```
#

i didnt want to start with PlayerLoginEvent

eternal oxide
#

is this event in yoru main class?

topaz cape
#

also thats the only plugin

topaz cape
eternal oxide
#

Then there is nothign wrong in that code

topaz cape
#

then why it doesnt work 😦

#

my brain

eternal oxide
#

No clue, if thats the only plugin That code is correct

topaz cape
#

wait should * permission work?

eternal oxide
#

Do you have any other code that alter or affects perms?

#

no

#
  • is not a valid permission for Bukkit
vital ridge
#

yo, anyone knows a good packets tutorial?

#

Im trynna send packets on entitydamageevent

topaz cape
#

i tried all other perms and never tried *

eternal oxide
#

if you want to implement * perms you must fetch all known permissions (with children) from Bukkit and apply them yourself

ivory sleet
#

Nuxoria uh well

#

((CraftPlayer)player).getHandle().playerConnection.sendPacket(...)

ivory sleet
#

I think

eternal oxide
#

permissions can have child nodes

topaz cape
#

so Bukkit.* doesnt work

#

im gonna try fetch all perms'

eternal oxide
#

You currently don't seem to have a single permission working. I'd not be trying others

topaz cape
#

yeah i know

daring sierra
#

fetch me their children evil milk bucket

eternal oxide
#

@topaz cape I'd try a simple test of player.hasPermission to test your perms.

topaz cape
#

yeah im doin that

eternal oxide
#

Well, from the code you have shown there is no reason it would not be working.

#

There has to be something you have failed to tell us

topaz cape
#

a normal spigot version

#

no other plugins

#

the only place that has todo anything with perms

topaz cape
#
                 if(perm.endsWith("*") || perm.equalsIgnoreCase("*")) {
                     String[] permparts = perm.split(".");
                     String permful = "";
                     for(int i = 0; i == permparts.length -1 ;i++) {
                         String dot = ".";
                         if(i == 0) {
                             dot = "";
                         }
                        permful =  permful + dot + permparts[i];
                     }
                     for (Permission perms : getPerms()) {
                         if(perms.getName().startsWith(permful)) {
                         attach.setPermission(permful, true);
                         }
                     }
                 }```
#
    public List<Permission> getPerms() {
        List<Permission> perms = new ArrayList<>();
        for (Permission perm : Bukkit.getPluginManager().getPermissions()) {
          if (!perms.contains(perm)) {
              perms.add(perm);
          }
        }
        return perms;
    }```
sharp bough
#
                Location loc = target.getLocation();
                player.sendMessage(ChatColor.DARK_GREEN + "The location of " + target.getName() + " is X: " + loc.getX() + " Y: " + loc.getY() + " Z: " + loc.getZ() + " in world " + loc.getWorld());```
why does that look weird? i get the poss , X,Y,Z but they have too many digits
paper viper
#

because its stored in floats

sharp bough
#

how do i limit it to only show the first numbers

paper viper
#

rounding

topaz cape
#

or getBlockX

paper viper
#

search up about rounding these digits

#

yeah

eternal oxide
#

getBlockX() etc

sharp bough
#

thanks

vital ridge
#

when he attacks a player

#

but like

#

I dont think i can do it with this code

#

I mean i cant make a horse stand up by sending a player packet

#

Id need the horse to do the packet

ivory sleet
#

wat

#

lol

vital ridge
#

okay wait

#

nvm

#

i figured something out but

#

where i can find

#

certain packets

#

it asks for a byte

#

im using this method

#

horse.world.broadcastEntityEffect(horse, b0);

#

now i need the b0

#

the byte aka the rearing byte

daring sierra
#

stop

ivory sleet
#

edit messages is a thing 😄

half dove
#

Hey I was wondering how do I mutliple Tab Completer. I dont know much about them and didnt saw a tutorial for multiple ones.

ivory sleet
#

multiple?

#

elaborate

half dove
#

yes something like /skycore perms add. Where perms and add is auto completed (or rather if you press tab)

ivory sleet
#

oh that's quite simple

eternal oxide
#

you check args length to decide what you need to set

ivory sleet
#

well you'd still only need one TabCompleter instance for that

half dove
#

ahh I think I understand it now thank you :)

vital ridge
#

Can anyone tell me where could i find EntityEffects?

#
sheep.world.broadcastEntityEffect(sheep, b0);
#

this here asks for bytes

#

so i assume there are bytes listed with entityeffects

#

someone in spigot forums made iron golems swing their arms

#

and that required a byte

#

so i need to find one for sheep grass eating

kindred solar
#

Guys, some1 already had this error? Plugin x v0.1 has failed to register events for class aa.aa.aaa.aaaa because com/mongodb/client/MongoCollection does not exist

unreal quartz
unreal quartz
kindred solar
#

i already did that

abstract relic
#

i think

#

that your obfuscator

#

is messing with it

kindred solar
# unreal quartz you need to shade whatever library you’re using for mongo
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
kindred solar
abstract relic
#

are you obfuscating your plugin

#

or did you change the error message

#

also whats your mongo dependency

#

in pom

kindred solar
kindred solar
abstract relic
#

hmm

#

why is your plugin name x

#

and is the package/class aa.aaaaa.aaaa.aaa

kindred solar
#

no, i just censured the names

radiant aspen
#

D: im feeling really dumb rn

#

anyone know how to get the amount of items crafted with ItemCraftEvent?

abstract relic
unreal quartz
#

you can try getting the recipe and getting the amount there

radiant aspen
#

nope, that doesnt work

#

already tried that

unreal quartz
#

but if it’s a shift click you’re probably gonna have to do some disgusting math

radiant aspen
#

ye :/

#

or, I can just ignore it

#

and if anyone reports it as a bug

#

I pretend it doesnt exist

abstract relic
#

e.getCurrentItem()

#

?

radiant aspen
#

nope, tried that also doesnt work

vocal cloud
#

bug == feature

abstract relic
#

Event#getCursor

radiant aspen
#

also doesnt work

#

they all return 1

abstract relic
#

doesnt the event get called multiple times? then

radiant aspen
#

cuz even if you craft multiple items the actual result item is only amount 1

abstract relic
radiant aspen
#

no it doesnt

abstract relic
#

so if u shift click that

radiant aspen
#

yup

#

it only says amount 1

#

and only calls event once

abstract relic
#

you can check if Event#isShiftClick()

#

and then Event#getRecipe()

#

and compute the total amount using that

kindred solar
radiant aspen
#

ye but id like to avoid doing dum math stuff if possible

abstract relic
#

dont think it is

#

@kindred solar xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </execution> </executions> </plugin>

daring sierra
#

am bad at algae-bruh

abstract relic
#

put this as plugin

radiant aspen
#

guess II could just get the inventory inventory.getcontents sort it smallest to biggest then itemstack.getAmount for an easy 1 liner

abstract relic
#

that's disgusting

radiant aspen
#

which is my problem

abstract relic
#

also worse performance 🙂

kindred solar
abstract relic
#

can u dm ur pom?

kindred solar
#

yes

radiant aspen
#

        Optional<Integer> amount = Arrays.stream(event.getInventory().getMatrix()).filter(Objects::nonNull).map(ItemStack::getAmount).sorted().findFirst();
#

eh doesnt look too bad.....

ivory sleet
#

Isnt OptionalInt a thing

abstract relic
#

why bother with that

#

when u can just use Optional<Integer>

ivory sleet
#

depends

radiant aspen
#

I mean I just instantly converted that to .orElse(1)

#

since it shouldnt ever be null anyways

ivory sleet
#

well either way you would use mapToInt instead of map then

radiant aspen
#

since if theres nothing in the inventory the event wont be called

ivory sleet
#

iirc

abstract relic
#

i mean this is so much slower than just calculating the amount manually lol

radiant aspen
#

wdym manually?

ivory sleet
#

its probably negligible

covert urchin
#

I'm having an issue getting the age of wheat crops in the nearby area with this bit of code:
The error I'm getting is: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockState cannot be cast to org.bukkit.block.data.Ageable

        int count_wheat = 0;
        for( Block b : getNearbyBlocks(loc, 32, 5) )
        {
            BlockData bd = b.getBlockData();
            Ageable block_age = (Ageable) b.getState();
            if(bd.getMaterial().equals(Material.WHEAT) && block_age.getAge() == block_age.getMaximumAge())
            {
                count_wheat++;
            }
        }
abstract relic
#

like getting the recipe, getting the amount of item stacks in the recipe and then computing how many items the player could have crafted on shift click

radiant aspen
#

right and how woul you compute how many items on shiftclick? cuz thats what im doing here?

abstract relic
#

Dont think it's ageable even

covert urchin
#

¯_(ツ)_/¯

abstract relic
#

let me see what I did @covert urchin

covert urchin
#

that's what someone suggested last night, and I went to sleep before I could test it.

abstract relic
#

oh

#

nvm

#

b.getBlockData()

#

instead of state

covert urchin
#

but that says I can't cast

#

o.O

radiant aspen
#

just check if its an instance

covert urchin
#

like I can't even compile THAT

radiant aspen
#

if(b.getState() instanceof Ageable)

covert urchin
#

owait no yes I can

ivory sleet
#

Ageable extends BlockData doesnt it

#

so you'd have to get the block data

radiant aspen
#

yes, but not every block is gonna be ageable

covert urchin
#

yea let's try this, I'll get back to y'all in a minute

radiant aspen
#

oh nvm im dum

ivory sleet
#

ofc but your statement there is always gonna be false

covert urchin
#

I'm trying to make a citizens 2 npc that goes around and collects all the wheat from the crops 😄

#

and I'm fairly certain that other than that one little screw up, that the rest of my code should completely work.

#

but this will be just the 2nd run

abstract relic
#

you need to do

#

smth like Ageable ageable = (Ageable) b.getBlockData()

#

that will work

radiant aspen
#

with an instance check

abstract relic
#

^^

covert urchin
#

that's what I got now

ivory sleet
radiant aspen
#

are you importing the right Ageable?

#

there is an entity ageable aswell

#

you need blockdata one

abstract relic
#

@radiant aspen you can do CraftItemEvent#getRecipe() to get a copy of the current crafting matrix

#

you can then just use that to compute how many items will be crafted

radiant aspen
abstract relic
#

@covert urchin Block#getState() != Block#getBlockData()

radiant aspen
#

code will be messyer

#

plus too much effort

abstract relic
#

telling him

#

that theyre not the same

covert urchin
#

now I'm just getting java.lang.ClassCastException: org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData cannot be cast to org.bukkit.block.data.Ageable

abstract relic
#

what

radiant aspen
#

send code @covert urchin

ivory sleet
#

yes because the block data instance does not instanceof Ageable

abstract relic
#

ooh

covert urchin
#

o.O

#

then what is?

abstract relic
#

he didnt add the instanceof check

covert urchin
#

because it's not getState() and not... what?

abstract relic
#

you need to check if b.getBlockData is an instanceof Ageable

covert urchin
#

oh

#

okay sec

radiant aspen
#

Swear we told you to do that like 5 times xD

covert urchin
#

what should the material be btw for the wheat crops?

#

is just Material.WHEAT correct?

abstract relic
#

@radiant aspen what does event.getInventory().getMatrix() return

#

the crafting matrix?

radiant aspen
#

yes

abstract relic
#

oh lol

#

nvm then

radiant aspen
fathom timber
#

Whats the crafting matrix?

real vapor
#

The slots where you put the ingredients

slim magnet
#

So I want to update a huge project from 1.12.2 to 1.13.3+ how do I do it
Any tips?

quaint mantle
#

u only gotta change anything that changed in the api

eternal oxide
#

set teh API version in the plugin.yml and see what breaks

slim magnet
#

:/

#

What are the big changes

#

from 1.12.2 to 1.13

#

in the API

eternal oxide
#

many

#

or a few

#

is the plugin not working?

quaint mantle
#

you'll know if it doesnt compile lol

#

check if it compiles -> check if it starts without errors on a server

#

yes to both, then it's fine

kindred solar
#

Guys, can some1 help me fixing this error? Plugin x v0.1 has failed to register events for class aa.aaaaa.aaaa.aaa because com/mongodb/client/MongoCollection does not exist.

deft sedge
#

I am trying to get the meta of this item. this is the function that gets the item from player inventory the code that I am trying to use to get the book meta from this item is

The reason I think this should work is I have used this to get a bookmeta of an item that a player has been holding.

quaint mantle
#

you dont have that class during runtime

#

u need to shade it into your plugin

kindred solar
#

you mean, add this to my pom file? ```xml
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

quaint mantle
#

yes and then change the scope field of the mongo library/libraries to compile

kindred solar
#

wdym

quaint mantle
#

<scope>compile</scope>

kindred solar
#

i already have that ```xml
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.2.2</version>
<scope>compile</scope>
</dependency>

quaint mantle
#

cool

#

also add <minimizeJar>true</minimizeJar> to the maven shade plugin config

#

it'll prevent classes you're not gonna be using during runtime to not compile with your plugin

#

= reduced file size

deft sedge
#

I am trying to get the meta of this item. this is the function that gets the item from player inventory the code that I am trying to use to get the book meta from this item is
BookMeta meta = checkformaterial.scanPlayerInv(player,
Material.WRITTEN_BOOK).getItemMeta();

#

any Ideas?

kindred solar
quaint mantle
#

yes

kindred solar
#

now should all work?

quaint mantle
deft sedge
#

bc that's what I thought I was doing

quaint mantle
#

should be that simple

deft sedge
#

k

quaint mantle
#

will get the first written book it comes across

#

null if no book is found

deft sedge
#

ok

kindred solar
#

Plugin x v0.1 has failed to register events for class aa.aaaaaa.aaaa.aaaaa because com/mongodb/client/MongoCollection does not exist.

#

same error

deft sedge
#

ill try that

#

thx

kindred solar
# kindred solar same error

i think its cuz of this line of code MongoCollection<Document> serverdb = coffeedb.getCollection("coffeeDB");

eternal oxide
#

open your jar with 7zip or any archiver and see if mongo class files exist

eternal oxide
#

in your jar

kindred solar
#

im only using one class

#

and its the main class

eternal oxide
#

open yoru JAR file

kindred solar
#

yes

#

i did that

eternal oxide
#

doe sit have a com folder?

kindred solar
eternal oxide
#

does that contain a mongodb folder?

kindred solar
#

no

eternal oxide
#

if there is no com folder you have not shaded mogo

kindred solar
#

cuz my package files name is : me.f1nndev.proj

eternal oxide
#

mongo is not

kindred solar
#

when i open the JAR file i have the me file and the plugin.yml

#

only

limber dust
#

when you shade a depend it adds the class files and folders into your jar, so in not having a com dir then you do not have the mongo depend meaning it isn't shaded

eternal oxide
#

yes, you have not shaded mongo

kindred solar
#

i already did that ```xml
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

eternal oxide
#

show me your mongo depend

kindred solar
#

i have 2

#
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>3.12.8</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>4.2.2</version>
            <scope>compile</scope>
        </dependency>
eternal oxide
#

try adding to your configuration section in your shade xml <artifactSet> <includes> <include>org.mongodb:mongodb:*:*</include> </includes> </artifactSet>

tepid estuary
#

just curious, but would there be any way to implement like unit tests for commands? (preferably junit)

eternal oxide
#

not sure thats totally correct

#

but try it

#

you just have to build, then check inside your jar

kindred solar
#

nop

eternal oxide
#

still just a me folder?

kindred solar
#

yup

eternal oxide
#

you'll need to work out the shade setting for the include then

kindred solar
#

😦

limber dust
#

you are building with maven right?

eternal oxide
#

its the middle section thats wrong. the :mongodb:

limber dust
#

just wanna double check

eternal oxide
#

good point on the build

kindred solar
eternal oxide
#

are you using artifacts to build?

kindred solar
#

i just did as the tutorial said

limber dust
#

? using that?

kindred solar
#

omg

eternal oxide
#

It would help if you actually answered the questions asked

kindred solar
#

guys wait

#

1 min

#

if this is what im thinking

#

im going to kms

limber dust
#

are you using what i sent in the screenshot?

kindred solar
#

yes

limber dust
#

then you aren't building with maven

#

meaning it ignores the pom.xml

bright jasper
#

So I know that player.connect on bungeecord might return before it connects(based on impl) but is there anything that will sync wait for the player to connect

kindred solar
sleek pond
#

Stack is pretty pog

kindred solar
eternal oxide
#

no clue. I don;t use InteliJ

#

I used Google

daring sierra
#

r e p l i t

ivory sleet
#

Elgar uses NetBeans ?

eternal oxide
#

Eclipse

ivory sleet
#

ah

kindred solar
#

still not solved

eternal oxide
#

I have tried Netbeans and InteliJ, but I prefer Eclipse.

kindred solar
#

i lost the entire day trying to fix it

#

failed to register events for class aa.aaa.aaa.aaaaa because com/mongodb/client/MongoCollection does not exist

eternal oxide
#

@kindred solar right click your project and select add Framework Support. See if Maven is already selected

#

if its not, then your project is not a maven project and you need to add maven

opal sluice
#

Hi, can someone explain me how the age state of cactus works ?

#

I tried to place cactus on top of others but the age stays at 0

eternal oxide
#

I mean exactly what I typed

kindred solar
#

should i create another project, should i?

eternal oxide
#

you shoudl have a maven projects somewhere on the right

#

not in that menu

kindred solar
eternal oxide
#

yes, open lifecycles

#

and run package

kindred solar
#

and then

#

build artifacts?

eternal oxide
#

check your jar

#

running package shoudl build everything yoru pom is set to

#

you don;t use artifacts when using maven

kindred solar
#

jar file still like this

eternal oxide
#

remove those libs from your project

kindred solar
#

and now

eternal oxide
#

in yoru maven projects click the reload/refresh button, top left of the window

#

show a pic of yoru project window

#

with expanded libs

sleek pond
eternal oxide
#

Things dreams are made of!

kindred solar
#

i think thats what u were saying

eternal oxide
#

yes

#

that looks good. its all maven references

#

run package again and it shoudl build your jar once more

kindred solar
#

now can i try it?

eternal oxide
#

open the jar and see whats inside

kindred solar
eternal oxide
#

I hope you didn't use the artifact again

kindred solar
#

no

eternal oxide
#

can you show the build log?

#

else run clean then package

kindred solar
#

it is saying that i used artifacts but i just double clicked the package thing

#

shouldn't i compile?

eternal oxide
#

no

#

you could run clean

#

it will clear out all old files

#

then run package

#

if it still says you used artifacts you'll need someone who uses InteliJ to help you

kindred solar
#

i think i should create a new project, copy all code

#

then run just with maven

solemn gulch
#

are there any good guides for setting up a bungecord network using docker so you can have a plugin creating and deleting servers

kindred solar
reef mulch
quaint mantle
#

oh what the hell

young knoll
#

You have a messed up config

reef mulch
#

Where?

#

I use Bungee Cord

ivory sleet
#

ok

limber dust
#

the jar that is compiled with maven will output in the target directory in your plugin source

storm tiger
#

is Redis threaded? like the Pub subs?

ivory sleet
#

Wym threaded

storm tiger
#

will it be on a different thread instead of minecrafts

ivory sleet
#

Idk depends on what lib you’re using

storm tiger
#

jedis

ivory sleet
#

Idk Jedis sucks ass

#

iirc it isn’t supporting multithreading that good or at least the cache

#

Then the pub system is probably fine I mean it has to do certain things on other threads but I doubt it’s that flexible (using jedis)

#

I recommend lettuce or jredis

quaint mantle
#

how do i listen for block set?

#

listen for setBlock(Block b) in like world gen and overall plugins

young knoll
#

Doubt you can easily

#

BlockPhysicsEvent might work for some

quaint mantle
#

lemme clarify my usage

#
Block Set by *** -> run checks, add to list if they all pass
eternal oxide
#

You can;t detect blocks changed by other plugins unless they also trigger physics events

reef mulch
eternal oxide
#

badly edited spigot.yml

proper notch
#

use a yaml lint to help find the issues

forest edge
#

Has anyone ever successfully spawned an item frame? I'm trying to spawn one using conventional methods (initialBlock.getWorld().spawn(initialBlock.getLocation(), ItemFrame.class); but I am having no success, as the itemframe can apparently not be hung at the location specified. I suppose my question is how can I make the location in the given block a location that the itemframe can be hung at?

quaint mantle
forest edge
#

hmm... I read through that thread, guess I will again

#

ah, my problem is that I am spawning it from inside of a block.

bright jasper
#

So I am trying to load a resource that is NOT in the bukkit plugin directory, I want an internal resource to be in the source code, so I simply put it in the resources folder

#

schema.sql

#
System.out.println(new String(Files.readAllBytes(Paths.get(getClass().getResource("schema.sql").toURI()))));
#

this says it is null though

#

I assume its not just a java issue and its a bukkit issue for reasons

eternal oxide
#

Bukkit plugin has a getResource()#

#

and saveResource()

bright jasper
#

Yeah so next problem, this is not a resource for bukkit, it is a Common library for a bungee/spigot plugin

#

ALSO

#

That is for loading from the plugin data directory

#

Which as I said is not what I wanna do, I want an internal resource as a java project usually would

eternal oxide
#

is it inside your jar?

bright jasper
#

Yes

#

I decompiled it, its directly in the root directory of the plugin jar which uses the common library which has it in the resource folder

eternal oxide
#

ok you are spouting a lot of words there but they don;t seem to mean what you think they mean.