#help-development

1 messages · Page 1567 of 1

sharp bough
#

its 2 am here

#

give me a brake

#

fk it im going to bed

#

gn everyone

hasty prawn
#

gn

sage swift
#

share

hasty prawn
#

What was it 🤔

proud basin
#

does saveResource display this message? Could not save messages.yml to plugins//messages.yml because messages.yml already exists

sage swift
#

could that be the problem

#

crazy

#

first you use 1.8, then you don't understand the config api

#

saveResource will try/not try to overwrite depending on the boolean at the end

hasty prawn
#

That's his reason for being here. You don't have to hate on everyone for not knowing everything you do.

sage swift
#

but you don't want to overwrite the existing file since that's the point of a config

#

so if you have an existing config it will be untouched

#

when you are testing delete the existing config before loading the plugin

proud basin
#

ah I see

#

I swear though before I was deleting the file

somber hull
#

So

#

Naming a sheep jeb_

#

doesnt make it rainbow...

hasty prawn
#

It's _jeb

#

I think

somber hull
#

o

#

weird

#

the nametag version is jeb_

hasty prawn
#

Oh maybe it is that then

somber hull
#

well then it doesnt work

#

lol

sage swift
#

jeb_ is an entirely clientside thing

#

must not be using vanilla 👀

somber hull
#

Im using optifine

#

That could be it

covert bluff
#
<repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>dmulloy2-repo</id>
            <url>https://repo.dmulloy2.net/repository/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.comphenix.protocol</groupId>
            <artifactId>ProtocolLib</artifactId>
            <version>4.7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

It keeps saying com.comphenix.protocol can't be found

hasty prawn
covert bluff
#

sdure

#

sure*

#

Just tried, still the same

hasty prawn
#

So it was .getType the whole time? Smh lol

sage swift
#

where did you get the dependency info

covert bluff
hasty prawn
#

🤦‍♂️

#

LOL

cunning ermine
#

smh

#

when it comes to compling a jar file

#

it still cant find the repo

sage swift
#

do you have the repo in your pom

covert bluff
#

I hate it when you get an error and you just can't find out which or what is wrong

cunning ermine
#

I tried invalidating all the caches

#

I'm assuming its at spigot's end

buoyant viper
#

@cunning ermine u tried this button?

#

assuming ur on intellij at least

cunning ermine
#

yh I did

#

should I try adding another spigot fork repo like papermc?

buoyant viper
#

spigots /should/ work

#

what if u take out the duplicate sonatype repo

#

?

#

i doubt it has any affect but

covert bluff
#

Still can't import protocollib as a dependency in Maven because it says it can't be found

cunning ermine
#

same error

buoyant viper
#

rip

#

what java version is gradle using

#

sometimes deps get cucked

#

if its set to project SDK then what sdk is the project on

cunning ermine
#

Im using JDK 16

buoyant viper
#

hmm

cunning ermine
#

gradle is 7.1

buoyant viper
#

should work..

cunning ermine
#

my project is in a multi-project format

#

its probs my script is poor or smthin

buoyant viper
#

hmm]

cunning ermine
#

looks like I fixed the issue

#

I switched from implementation(dependency)

#

to compileOnly(dependency)

buoyant viper
#

o

cunning ermine
#

probs the spigot should be compiled at the start

#

I thought implementation is same thing as compile

covert bluff
#
<repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>dmulloy2-repo</id>
            <url>https://repo.dmulloy2.net/repository/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.comphenix.protocol</groupId>
            <artifactId>ProtocolLib</artifactId>
            <version>4.7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

It keeps saying com.comphenix.protocol can't be found

buoyant viper
#

what if u change scope from provided to compile @covert bluff

covert bluff
#

I have actually tried both and even without the scope part

#

It's the same

buoyant viper
#

hmm

#

jeez every1s having dependency issues 2day

#

wtfrik

quaint mantle
#

hi

#

loadbefore: LiteBans

#

why that no work

buoyant viper
#

try

loadbefore: [ LiteBans ]```
or ```yaml
loadbefore:
  - LiteBans```
granite stirrup
#

loadbefore is for worlds?

proud basin
#

How can you fix it so when you use ' in a a yml file it doesn't display 2 of them?

buoyant viper
#

@granite stirrup

granite stirrup
quaint mantle
#

no loadbefore aint for world

#

load

#

is for worlds

#

i think u have

#

load: POSTWORLD

#

and load: STARTUP

quaint mantle
covert bluff
#

yo wtf is this

sage swift
#

but not through the api methods, those always save with single quotes

covert bluff
#

this is my code

public final class Main extends JavaPlugin implements Listener {
    private final Map<InetSocketAddress,Integer> playerVersions = new ConcurrentHashMap<InetSocketAddress,Integer>();


    @Override
    public void onEnable() {
        // Plugin startup logic
        ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Handshake.Client.SET_PROTOCOL,PacketType.Login.Server.DISCONNECT) {
            @Override
            public void onPacketReceiving(final PacketEvent event) {
                final PacketContainer packet = event.getPacket();

                if (event.getPacketType() == PacketType.Handshake.Client.SET_PROTOCOL) {
                    if (packet.getProtocols().read(0) == PacketType.Protocol.LOGIN) {
                        playerVersions.put(event.getPlayer().getAddress(),packet.getIntegers().read(0));
                    }

                } else {
                    playerVersions.remove(event.getPlayer().getAddress());
                }
            }
        });
    }

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

    public int getVersion(final Player player) {
        return playerVersions.get(player.getAddress());
    }

    @EventHandler
    public void onPlayerQuit(final PlayerQuitEvent event) {
        playerVersions.remove(event.getPlayer().getAddress());
    }

    @EventHandler
    public void onPlayerLogin(final PlayerLoginEvent event) {
        getServer().getLogger().info(String.valueOf(getVersion(event.getPlayer())));
    }

#

No idea what's up

#

I am new to protocollib

proud basin
sage swift
#

"look at that ' thing" will work the same as 'look at that '' thing'

proud basin
#

Sorry should of explained it better I mean that's it does that''s

fervent chasm
#

Hello, I was wondering how I could apply potion effects my npcs using the citizens api

quaint mantle
#

is it possible to make command alias using the setExecutor thingy mobob

fervent chasm
#

you can create aliases for commands in the plugin.yml file

quaint mantle
#

yea ik but

#

that aint working for me

#

bcuz im overide other commands

#

and it wont work if i just set an alias

torn shuttle
#

"5 more minutes and 300 other hilarious jokes you tell yourself at 7:19 am" a book written by me is now on sale in my onlyfans

quaint mantle
#

δ

torn shuttle
#

how am I still working on this

quaint mantle
#

bcuz gae

#

i caught someone duping in my server thismorning

#

he fricking put diamond blocks and em blocks

#

everywhere

#

alll thru village chests

#

now players are stacked

covert bluff
#
 @EventHandler
    public void onPlayerLogin(final PlayerLoginEvent event) {
       getServer().getLogger().info(String.valueOf(ProtocolLibrary.getProtocolManager().getProtocolVersion(event.getPlayer())));
    }

why this is show print 754 when im join on 1.12.2 and 754 = 1.16.4 and server is 1.16.5

quaint mantle
#

just does

covert bluff
#

Stop it

quaint mantle
#

well

#

it does just does

covert bluff
#

is supposed to say something like 354 because am 1.12.2

#

BUT IT IS say ing this

quaint mantle
#

?

#

wdym

covert bluff
#

am join the server on version 1.12.2 but it is print 754 why?

fervent chasm
#

Hello, I was wondering how I could apply potion effects my npcs using the citizens api

covert bluff
#

supposed to print 340.......

quaint mantle
#

u make no sense

covert bluff
#

is supposed to print 340 the getgproroction version manager method

#

because am joining server on 1.12.2 version

#

but it is show 754 ijntead which is 1.16.4

torn shuttle
#

are you using one of the version porting plugins? maybe it's spoofing your version

covert bluff
#

u mean things liek viaversion?

torn shuttle
#

yeah

covert bluff
#

Ok letm e try removing The plugin

quaint mantle
#

i hate it when i get a sharp booger

#

bcuz when u pick it

#

it make nose hurt

fervent chasm
#

I thinnk you are in the wrong channel bud

quaint mantle
#

nop

#

uhh

#

why did powershell

#

randomly ope

tired dagger
#

Lol, I think I found a bug. It kicks you if you tab complete this and try to send it in chat

quaint mantle
tired dagger
#

hmm?

quaint mantle
#

send me the command

#

i wanna try

tired dagger
#

Wdym the command? It's a plugin I'm working on. You mean the code?

quaint mantle
#

oh

#

nvm

#

i thought it was a built in command

#

bcuz u said u found bug

tired dagger
#

Well, the autocomplete causes the bug

quaint mantle
#

k

#

how to override a command

#

like

#

litebans:ban

#

how override it

covert bluff
#

you do

tired dagger
#

Grab the listeners and set it to cancelled

quaint mantle
#

k

#

but

#

im making a ban gui

tired dagger
#

? what are you trying to override then?

#

Like when you click it runs the command?

quaint mantle
#

i want to make it

#

atm i have /ban and stuff

#

but /litebans:ban

#

still does normal litebans thing

tired dagger
#

ohh

quaint mantle
#

i want to make it so it dont

#

ye

tired dagger
#

You may be able to change the alias in the config

quaint mantle
#

i tried adding litebans:ban as a command

#

and that made error

#

then i did it as an alias

#

and that did nothing

tired dagger
#

Like you changed the alias in the config?

quaint mantle
#

yk plugin.yml?

tired dagger
#

the litebans config

quaint mantle
#

can u change ti in there?

#

i got all the commands working tho

tired dagger
#

Possibly

quaint mantle
#

just not

#

the litebans:

#

thung

#

./ban

#

does my thing

#

./litebans:ban

#

does litebans thing

#

i want mekt litebans:ban do my thing

tired dagger
#

ohh

obtuse basin
#

Is there any way getting the offline time of an player?

quaint mantle
#

idk

tired dagger
#

you mean you just want to do /ban and it pops up your gui?

quaint mantle
#

no

#

that is wat it does already

#

i want /litebans:ban

#

to open it aswell

#

im just gonna cancel the event for it

tired dagger
#

Yeah, that's what I thought.. Hmm. That's like the built in back-up function for the plugin. Like, it runs it directly from the plugin. Eg. /minecraft:stop obv runs the vanilla minecraft and /bukkit:ver runs from bukkit obv

#

I'm not sure

quaint mantle
#

k

#

becaus

#

advanced bans

#

does it

#

it makes essentials:ban

#

but dw i got it sorted

tired dagger
quaint mantle
#
    @EventHandler
    public void preProcessCommand(PlayerCommandPreprocessEvent event) {
        if(event.getMessage().equalsIgnoreCase("/litebans:ban")){
            event.setCancelled(true);
        }
    }
#

will this work

torn shuttle
#

hm I fucked up

#

time to use strings

quaint mantle
#

whats the point of an offlien server

#

¯_(ツ)_/¯

tired dagger
#

The mojang servers don't check for authentication so you can use cracked accounts

quaint mantle
#

bad

tired dagger
#

Indeed

quaint mantle
#
    @EventHandler
    public void preProcessCommand(PlayerCommandPreprocessEvent event) {
        if(event.getMessage().equalsIgnoreCase("/litebans:ban")){
            event.setCancelled(true);
        }
    }
#

why thus no work

tired dagger
#

Especially dangerous because some hacked clients allow you to use a custom name. Thus, if you login to a server as the owner's player name and its permissions system is based only on name and not UUID. Yeah... imagine the rest

covert bluff
#

It's also possible to do on the official Minecraft launcher through .minecraft/launcher_accounts.json

#

Which is why authentication plugins like Authme Reloaded are needed when it comes to cracked servers

tired dagger
#

Ahh, I didn't know you could do it just by editing that file

covert bluff
#

Yup, you can

#

But when you open the launcher, you have to turn off your internet first

#

After you launch the game, that's when you can re-enable it

quaint mantle
#

kids with cracked accounts trigger me

tired dagger
#

Interesting

quaint mantle
#

they are the perfect trget

#

to bully

covert bluff
#

I don't see how cracked accounts are accounts

quaint mantle
#

they aint

covert bluff
#

They're just usernames without passwords

tired dagger
#

try without the '/'?

quaint mantle
#

eh

#

im not worried

#

abt it

covert bluff
#

It includes the /

quaint mantle
#

my staff are all dumb

#

i doubt they know

#

u can do /litebans:ban

tired dagger
#

got em

quaint mantle
#

i had to teach them how to go gmc

tired dagger
#

omg

quaint mantle
#

i watch console sometimes

#

and they do /vanish

#

when u can just /v

tired dagger
#

haha

quaint mantle
#

and they do /gamemode spectator

#

when u can /gmsp

#

it annoys me

tired dagger
#

You can actually even do '/sp'

quaint mantle
tired dagger
#

ah

#

Don't have WE on this test server

quaint mantle
#

ow

tired dagger
quaint mantle
torn shuttle
#

yeah I fucked up, accidentally tried to rely on invoking methods on generic class objects passed through constructors

#

damn it

covert bluff
#

what are invoke methods

sweet torrent
#

What is the Spigot block code for sand?

#

It seems to not exist on the docs

quaint mantle
sweet torrent
#

Other than LEGACY_SAND

torn shuttle
#

just using reflections to try to run methods from classes, I wanted to mass instantiate objects via reflections but have managed to corner myself

fervent chasm
#

how can I add potion effects to a citizen NPC?

quaint mantle
#

and right click to throw

#

ezpz

torn shuttle
#

I still feel like this is somehow possible, but I've been at it for well over 12 hours now so I think what I really need is some sleep

#

this is really dumb

fervent chasm
#

usssinnggg the appiii orrr the citizen PLUGIN

sweet torrent
#

Disregard my question, am dumb

torn shuttle
#

man see you do C# for a week and suddenly you assume things in java work a certain way and they don't

quaint mantle
#

is it possible to use query to get a list of online players

obtuse basin
tired dagger
#

yea

torn shuttle
#

is there any way to pass a class into another method as a way that will still allow me to invoke its methods while still allowing me to pass multiple different classes into that constructor and without forcing me to run instanceof or some other comparison check for every class I add?

tired dagger
#

Lambda?

fervent chasm
#

how to add potion effect s to an entity object?’

torn shuttle
#

how would lambda help here?

#

I don't see it

tired dagger
torn shuttle
#

no, not at all

tired dagger
#

Hmm? It allows you to pass a class into a method and call other methods

#

It's essentially an Anonymous class passed as an argument in a method

torn shuttle
#

yeah that's not really what I was looking for

quaint mantle
#

hey could i ask how can i obfuscate my plugin like this one?

torn shuttle
#

?paste

undone axleBOT
tired dagger
#

ah, okay

torn shuttle
tired dagger
torn shuttle
#

since extendedClass is just Class I can't use it to invoke anything without first casting it

#

and I can't cast it without comparing it to something

#

and I can''t compare it to something without having to manually add an entry for every type of thing I want to compare it against

#

which I specifically don't want to do

quaint mantle
tired dagger
#

Ugh

#

I can't believe I just now thought of this

#

I can use a 2 dimensional array for my commands

torn shuttle
#

I feel like there has to be a solution to my issue without doing a deep rewrite

tired dagger
#

Send pic

grand coral
#

How I can bind a minecraft plugin with a discord bot? Anyone knows?

torn shuttle
#

I posted the code above

grand coral
#

That I can print logs in a channel

grand coral
torn shuttle
#

use an api from some other plugin unless you want to waste a large amount of time

limber dust
#

hook into the discordjda api

tired dagger
torn shuttle
#

I'm stuck with the fact that I want it to be generic but also able to invoke methods

#

which java doesn't like

#

hm

#

I can pass the more specific CustomConfigFields class which all of these classes extend but the issue is I am pretty sure it will then invoke things from the non-extended class

tired dagger
torn shuttle
#

maybe if I do everything through interface and then override the interface in the extended classes...

#

that is so stupid it just might work

#

hm

tired dagger
#

I don't understand what the extendedClass is suppose to do

torn shuttle
#

the main thing it should be doing is storing the Class so I can invoke a method via reflections

#

right at the bottom

tired dagger
#

You see, i don't know what reflections are

torn shuttle
#

it should also be doing another thing but that one doesn't really matter

tired dagger
#

So I can't help you out there xD

torn shuttle
#

hm

#

well I'll give it another shot after some sleep, it's been about 14 hours I think

runic mango
#

if you use this syntax in plugin.yml is there any way to let the console bypass the permission check?

#

makes sense, thanks

crude charm
quaint mantle
#

how to use essentials xmp

#

also whats xmp

crude charm
opal juniper
waxen plaza
#

?paste

undone axleBOT
quiet ice
waxen plaza
eternal oxide
#

you need to read the error. It tells you everything

waxen plaza
#

I know but I don't understand why it returns null

#

it never did this

eternal oxide
#

its null because you are trying to obtain an rsp too early. They are nto registered yet

waxen plaza
#

is it because vault api has to load first?

quiet ice
#
  • always obtain it lazily my man
#

No, Vault AND the Eco plugin has to load first

eternal oxide
#

The perfect senario is you check for vault, then if found you runTask to get teh rsp, so it runs 1 tick after the server is started

quiet ice
#

That is another way to do it

waxen plaza
#

my plugins depends on vault so I don't need to check

eternal oxide
#

yes you do

waxen plaza
#

really?

eternal oxide
#

you can;t get an rsp untill its registered itself

quaint mantle
#

its a messaging thing

quiet ice
#

you have no use for it

quaint mantle
#

bruh

#

just tell how to us

eternal oxide
quiet ice
#

I don't know - and given that the plugin is niche I doubt anyone uses it

waxen plaza
#

after I register all commands and events

quaint mantle
quiet ice
quaint mantle
#

temparary

#

and it says

#

2013

eternal oxide
waxen plaza
#

yes

#

It's just so weird because it works perfectly on other versions

eternal oxide
#

are you depend on vault or softdepend?

waxen plaza
#

depend

eternal oxide
#

is it an eco you are trying to hook?

waxen plaza
#

no

#

permissions

eternal oxide
#

is there a reason you are hooking vault for perms and not using player.hasPermission ?

waxen plaza
#

not sure really I just knew that lots of plugins use Vault

#

Your saying it's not necessary for perms?

torn shuttle
#

...did I just spend 4 hours making up an issue that didn't exist

#

seriously

eternal oxide
#

if you are just testing for permissions then you don't need vault

waxen plaza
#

So permission plugins will work without vault?

eternal oxide
#

every online player has #hasPermission

#

yes

waxen plaza
#

Didn't know that

eternal oxide
#

they all push directly to superperms in Bukkit

waxen plaza
#

ok, I'll remove Vault and try again

torn shuttle
#

ffs

#

I trolled myself

#

yep

#

it works, it would've worked if I did the simple thing to start with but I didn't test it

thorn shuttle
#

The spigot update URL broke

#

How are people fixing it

#
<?php
$userVersion = isset($_GET['v']) ? $_GET['v'] : 'unknown';
try{
    $url = 'https://api.spigotmc.org/legacy/update.php?resource=46812';
    $handle = file_get_contents($url);
    echo $handle;
    $latestVersion = $handle ? $handle : 'unknown';
    echo $latestVersion;
} catch (Exception $ex) {
    echo $userVersion;
}

It aint working.

UPDATE:
User-Agent header is required now.

quiet ice
#

Tip: you can remove the ?__cf_chl_jschl_tk__= and everything after that

#

I dont quite get where the issue lies, I get 1.17.1b just as intended

thorn shuttle
#

when accessed through a browser.

#

But through code I get a 403 or some other empty response every time

quiet ice
#

Yea, cf will block you from automating it I belive. Lemme check for sure

sand rune
#

Guys , how to make items in GUI clickable to sendMessage

quiet ice
#

nvm, wget and curl works - so you might be doing something wrong with your code

timid kraken
#

how do i make my plugin log in the console properly, System.out.println() logs it but it does not show the [PLUGIN_NAME]: Log

quiet ice
#

getLogger().info() or plugin.getLogger().info()

timid kraken
#

oh thanks!

wicked saffron
#

Hello, I use PluginMessages on my Spigot 1.12.2 plugin, but the message GetServer is lost when I use it on PlayerJoinEvent. Anyone know how to fix this problem ?

sand rune
#

Guys , how to make items in GUI clickable to sendMessage

#

1.8

quiet ice
#

InventoryInteractEvent (InventoryClickEvent)

waxen plaza
#

?paste

undone axleBOT
sand rune
#

Ok but the code , how to check if it the Button

waxen plaza
quiet ice
sand rune
#

@quiet ice
What the code to make items in GUI clickable

quiet ice
#

that is done by default

waxen plaza
quiet ice
#

That might be because you are not running spigot 1.8.9

sand rune
#

Guys. what's the code for Inventory Click Event For GUI

limber dust
#

public void event(InventoryClickEvent event){
}

quiet ice
#
class ClickListener implements Listener {
@EventHandler
public void onClick(InventoryClickEvent e) {
// DO
}
}
limber dust
#

magic

sand rune
#

I know that

#

What I write inside it ?!

#

@quiet ice

quiet ice
#

I sure love spoonfeeding

sand rune
#

What I write inside it ?!@quiet ice

limber dust
#

e.google

quiet ice
#

google wont help you there

#

this is a more complicated problem

stiff topaz
#

In my GUI shop I want to use the itemstack amount to show the amount of stock? Is it possible for the stack size to be over 64?

sand rune
#

Ok tell me what I write inside it @quiet ice

stiff topaz
#

aww

#

that would be a really nice feature

sand rune
#

@stiff topaz
What I need to write inside inventory click event for gui

quiet ice
#

it is possible but would also bork a few things

thorn shuttle
#

it needs userr-agent.

quiet ice
#

You likely want something like

ItemStack spoonfeeding = this.is;
ItemStack bad = e.getCurrentItem();
if (spoonfeeding.equals(bad)) {
    // code
}
limber dust
#

beautiful

sand rune
#

See ur dm @quiet ice

waxen plaza
#

Why can I start my 1.8.9 server with java 16 but I can't start my 1.13.2 server?

quaint mantle
#

Hey what's the best way to detect if a block is a real solid block and not snow/slab/stairs etc

quiet ice
waxen plaza
quiet ice
#

It will run with 1.17

#

There are also at least one 1.8 fork that can run at J11 natively, J16 shouldn't be much of a difference

waxen plaza
#

I'll test and see but everytime something seems to work it doesn't 🙂

quiet ice
#

Many of minecraft's libraries are still at J5 - J8 and it runs as intended

quaint mantle
#

hey, was wondering why i'm getting a "null" error with this..? new to Java sorry for being bad

package com.ankledev.tabfix;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

import org.bukkit.event.player.PlayerCommandSendEvent;

import java.util.ArrayList;
import java.util.Collection;

public class TabCompleteFix extends JavaPlugin implements Listener {
    
    @Override
    public void onEnable(){
        getServer().getPluginManager().registerEvents(this, this);
    }
    
    @EventHandler
    public void onTab(PlayerCommandSendEvent e){
        Collection<String> cmds = new ArrayList<>();
        for(String cmd : e.getCommands()){
            if(cmd.contains(":")){
                cmds.add(cmd);
                
        e.getCommands().removeAll(cmds);
        
            }
        }
    }
}
waxen plaza
#

ok good to know

quaint mantle
#

(when the uesr joins)

quiet ice
#

ah, that isn't a NPE

quaint mantle
#

idk what that is

#

im sorry D:

quiet ice
#

It is a CME and I think I know what went wrong here

#

You can't modify collections while you iterate over them, so you need to create a clone first

quaint mantle
#

so i should Collection<String> ecmds = e.getCommands();?

quiet ice
#
        for(String cmd : new ArrayList<>(e.getCommands())){
            if(cmd.contains(":")){
                cmds.add(cmd);
                e.getCommands().removeAll(cmds);
            }
        }

should solve the issue

quiet ice
quaint mantle
#

oh

#

im thinking "clone" literally, sorry lol

#

was also curious about .contains(

#

it says CharSequence in Eclipse..

but will CharSequence get fooled into becoming a string?

quiet ice
#

there is the .clone() method

#

String extends CharSequence

quaint mantle
#

thats what i thought

quiet ice
#

I do not know why exactly CharSequence exists, but it does

quaint mantle
#

yeah it freaked me out a little

#

i was worried i'd have to like

#

.contains(new CharSequence(":"))

#

but i didnt

quiet ice
#

You could do cmd.indexOf(':') != -1 which could be a bit faster, but eh noone will care

quaint mantle
#

i tried that

#

and got the error

#

and thought "oh thats causing the error"

#

i actually got a larger error 😳

#

oh i didnt change it all sorry

#

im such a noob i feel really bad for flooding this channel im so sorry

quiet ice
#

yeah, I got confused for a sec there

quaint mantle
#

it works :D thank you so much @quiet ice

quiet ice
#

Also, there is another way of doing that that could help you, lemme write it up

quaint mantle
#

is it with Packets

quiet ice
#

No, I mean another way of iterating over this collection

quaint mantle
#

oh

waxen plaza
#

@quiet ice the plugin works like a charm now, thanks.

quiet ice
#
        Iterator<String> iter = e.getCommands().iterator();
        while(iter.hasNext()){
            String cmd = iter.next();
            if(cmd.contains(":")){
                cmds.add(cmd);
                iter.remove();
            }
        }

avoids the need of cloning the collection

quaint mantle
#

ahh

#

would you need the cmds.add though

quiet ice
#

technically you don't need it, right

quaint mantle
#

i wasnt sure haha

#

i try to condense code as much as possible idk why

quiet ice
#

programmer instinct is the reason

quaint mantle
#

i dont want to flood this channel with chat, but i did use skript for a while, then i used skript-reflect for a while while, and now im transferring into Java

#

a

#

toooooooo

supple elk
#

hey guys

#

I'm running this code here, and the registerPlayer() function is called on a PlayerJoinEvent

#

Everytime I join the server it registers the player again

#

oh

waxen plaza
#

Unregister the player when he leaves.

supple elk
#

I should do it by player UUID

#

I'm a dumb ass

supple elk
waxen plaza
supple elk
#

I do

#

that's what the null check is

#

it's cause of player instance I think

#

so I need to use UUID

waxen plaza
#

yes, uuid

somber lintel
#

Any guides on unit testing plugins around?

ivory sleet
#

Mockbukkit

#

But it’s a disaster

#

Well unit testing in spigot is

#

You essentially need to emulate an entire server

somber lintel
#

Yeah I'm concerned about all these statics

ivory sleet
#

The only major static thing is the Bukkit class

#

Just go with Plugin#getServer anyways

#

It’s properly injected

misty zenith
#

i want to create custom mob ex villager
then i try to extend EntityVillager class but it couldn't find the class

#

why

eternal night
#

1.17 NMS does not use mappings during runtime

#

or are you talking about your IDE ?

misty zenith
#

i don't know this is from ide or i do wrong

eternal night
#

what version are you using

#

spigot wise

misty zenith
#

i think latest 1.17

#

wait i check

eternal night
#

what build tool are you using ? maven ?

misty zenith
#

1.17-R0.1-SNAPSHOT

misty zenith
eternal night
#

did you follow this example layout ?

#

for 1.17

misty zenith
#

wait let me check them

eternal night
#

md5 explained rather straight forward how NMS in 1.17 functions

tardy delta
#

is there a way to check if the block from the blockbreakevent is part of a naturally generated tree?

smoky oak
#
//Main class
public static FileConfiguration structures;

public void onEnable(){
  structures =  YamlConfiguration.loadConfiguration(configFile);
        InputStream defConfigStream = this.getResource(configFile.getName());
        if (defConfigStream != null) {
            structures.setDefaults(YamlConfiguration.loadConfiguration(new   InputStreamReader(defConfigStream, Charsets.UTF_8)));
        }
//Loaded this way since it's not supposed to be edited
}

//Debug method
public static void echoKeys(Player player){
        Set<String> r = Echo.structures.getKeys(false);
        for(String e : r){
            player.sendMessage(e);
        }
}

The length / size of the set is 0. Why? The file contains keys and values.

#

also @tardy delta only way i can think of is logging when a tree is generated

tardy delta
#

hmm

smoky oak
#

you could check if there wood would have been generated naturally but that would be prone to errors

#

wait

eternal night
#

I think you wanna stick to this.getClass().getClassLoader().getResource

smoky oak
#

well thing is

#
Boolean dd = Echo.structures.contains(args[0]);```
That returns 'true' for the keys
#

so im a bit at a loss

#

why does one method work and one doesnt

wary harness
#

player?

opal juniper
#

Yeah they do

wary harness
#

for that I will just recommend making hasset and just put specifc block location to

#

it and later when they brake it

#

just check if that location is in set or list

#

and stop code there

ivory sleet
#

Looks alright

opal juniper
#

I’m not sure of a better way though

runic mango
#

does anyone know whats wrong with this? I'm trying to change config files, the command runs properly but the config file doesn't seem to get changed

wary harness
#

which he loses after restart

#

set can be saved to some file on restart

#

still not sure does that works on normal blocks

#

or just tiles

exotic scroll
#

how to detect when player have hit an player?

wary harness
vague oracle
#

EntityDamageEvent

exotic scroll
wary harness
#

google it

vague oracle
#

?Jd

#

😦

#

?jd

wary harness
vague oracle
#

Didn’t work

wary harness
#

oh xd

quaint mantle
#

Hello! I need help with something I don't understand:

#

What is this char?

smoky oak
#

probably that R symbol in a circle

#

or a flag unicode character

quaint mantle
#

It looks like that at every end of line

smoky oak
#

would you mind opening your log and posting the symbol here?

quaint mantle
#

sure

quiet ice
#

It is the carriage return character

smoky oak
#

wait

#

you mean newline?

quiet ice
#

Not that one

#

the carriage return, not the newline

quaint mantle
#
[13:42:30] [Server thread/INFO]: Guardian | Commandes disponibles
[13:42:30] [Server thread/INFO]: /g journal type enable  » s'inscrire à un journal
[13:42:30] [Server thread/INFO]: /g info player  » afficher les informations à propos du joueur
[13:42:30] [Server thread/INFO]: /g freeze player  » changer le mode gel du joueur
[13:42:30] [Server thread/INFO]: /g inspect   » basculer votre mode d'inspection
#

hmm what's the difference?

quiet ice
#

To display line breaks in minecraft, you use the line break symbol (\n), you are using \r

quaint mantle
#

Yeah but I don't understand: in my english config I don't have the issue

quiet ice
#

\r is irrelevant in minecraft since chat has no "pointer" that can be reset

quaint mantle
#

but I do have it in french

quiet ice
#

Then show the two configs

elfin minnow
#

how do i generate vanilla structures on lets say a interact event

quiet ice
#

what syntax is that

quaint mantle
#

toml

quiet ice
#

no, the syntax inside the multiline string

quaint mantle
#

mini message

oak flame
#

hey, i have basic java knowledge and im trying to make a plugin that disables creeper block damage. the code framework itself works but i have no idea how to actually turn off creeper damage and what to import. any idea?

oak flame
# oak flame hey, i have basic java knowledge and im trying to make a plugin that disables cr...

package me.tobias.anticreeper.commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.tobias.anticreeper.Main;

public class CreeperDamageOff implements CommandExecutor{

private Main plugin;

public CreeperDamageOff(Main plugin) {
    this.plugin = plugin;
    plugin.getCommand("creeperdamage off").setExecutor(this);
}

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    // TODO Auto-generated method stub
    Player p = (Player) sender;
    
    if(p.isOp()) {
        //block-creeper-block-damage = false
        return true;
    }
    return false;
}

}

vital ridge
#

Is there needed to add properties in HikariCP so I wont disconnect from my database or this doesnt rly happen in hikaricp connection pool? before, I randomly got disconnected from my database without using HikariCP and I got recommended that.

undone axleBOT
teal flower
smoky oak
#

@oak flame you can do an EventListener for creeper explosions i think

teal flower
#

like here

blissful folio
#

I noticed the way to send packets has changed, how can I send packets now?

quaint mantle
elfin minnow
#

how do i generate vanilla structures on lets say a interact event

blissful folio
quiet ice
#

I assume I hate to parse it in a diff checker, that will take a while, so be patient

chrome beacon
#

You will have to use obfuscated names or follow the guide in the 1.17 release post

oak flame
smoky oak
#

have you tried googling?

chrome beacon
#

?eventapi

undone axleBOT
oak flame
#

yeah i only saw forum threads that basically told me to look for a plugin somewhere

oak flame
smoky oak
#

anyways

#

about my earlier question

chrome beacon
smoky oak
#

anyone here knows how FileConfiguration works?

chrome beacon
#

Yeah what about it?

smoky oak
#

because it contains keys and i can get those keys

quiet ice
#

I don't see any meaningful difference.
I guess you'd need to open a bug report (or look for a previous one) there

smoky oak
#

but Set<String> r = configuration.getKeys(false) returns a empty set

#

correction i can use those keys

#

getting them doesnt work

chrome beacon
#

That's odd

#

Could you show the config file and how you're loading it

smoky oak
#
public static FileConfiguration structures;
//Declared in class, loaded in onEnable
structures = YamlConfiguration.loadConfiguration(new File("structure.yml"));
        InputStream defConfigStream = this.getResource(configFile.getName());
        if (defConfigStream != null) {
            structures.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
        }
  structures.getStringList("Copper");//THIS returns the string list defined( [CCC, CCC, CCC] )
  structures.contains("Copper");// True.
  structures.getKeys(false);//THIS returns A EMPTY OBJECT! WHY?
chrome beacon
#

I'm honestly not sure

smoky oak
#

structure.yml:

Debug:
  - "CCC"
  - "CXC"
  - "CCC"
Copper:
  - "++CCC++"
  - "+CAAAC+"
  - "CACICAC"
  - "CAIXIAC"
  - "CACICAC"
  - "+CAAAC+"
  - "++CCC++"```
#

its a big issue tho

#

i need to iterate over every key in the config

#

but i cant

#

since i dont get the keys

#

urgh if anyone has an idea just ping me imma leave for now

#

i cant think anymore

blissful folio
#

How can I change an entityplayer's ping?

chrome beacon
#

Why do you want that

reef wind
#

which should be obvious

oak flame
#

if i want to ask for if(event.getEntity() == Creeper), do i have to import org.bukkit.entity.Creeper first?

quiet ice
#

you are looking for instanceof

#

after that, yes, it would work. But you can also do event.getEntity().getType() == EntityType.Creeper

oak flame
#

thanks you so much!

hardy swan
#

?javatutorial

#

hmm

#

i need a tutorial on the commands

subtle kite
#

?jd

hardy swan
#

not this

#

java tutorials

#

?jt

subtle kite
#

¯_(ツ)_/¯

hardy swan
#

?learnjava

undone axleBOT
hardy swan
#

GOT IT

#

im genius

oak flame
#

in my plugin.yml both the author and the commands are flagged as spelled incorrectly even though they arent, should i just ignore it?

hardy swan
#

pardon me

undone axleBOT
subtle kite
#

@oak flame screenshot it and put it in here

oak flame
subtle kite
#

that is something else ;0

#

give me 1 sec

noble spire
subtle kite
#

Commands

#

should look like that
put the author name like author: {name} ???
id about the author part

#

and

noble spire
oak flame
#

maybe you could check player input instead of movement, not sure if theres an event for that

noble spire
#

hmm, I'll have a look

#

good idea

quaint mantle
#

just put creeperdamage:

#

and for the main

#

u have to make it direct to the actual main class

urban lava
#

how do i use persistent dataholder

quaint mantle
#

so for example if my main class was called MainClass

#

and the package was

noble spire
#

?pdc

quaint mantle
#

me.crqpts.plugin

urban lava
#

thanks

quaint mantle
#

the main has to be

#

me.crqpts.plugin.MainClass

oak flame
#

thanks! i made separate classes for the off and on command which is why i left it in

quaint mantle
#

they have to both be in the same class

#

the class that extends "JavaPlugin"

#

if ur talking about onEnable and onDisable

oblique pike
#

Do i need to handle entity damage event if i want to increase mob damage or i can increase mob damage another way?

urban lava
#

how do i run a command in spigot

#

like

#

/scoreboard

#

because i think thats probably the best way to store whether or not the player is a healer or healable

oblique pike
#

why not persistent data container?

graceful turret
#

guys how to get portal position from PlayerChangedWorldEvent?

oblique pike
#

handling scoreboard teams may break some plugins

noble spire
urban lava
oblique pike
urban lava
#

sure

#

thanks

oblique pike
#

DM me

urban lava
#

so

#

ok

noble spire
#

if not also yaml

#

but yeah pdc is the best way

sand rune
#

Guys how to make /fly command, Enable fly for player and how to make player invs

#

Spectate

#

Ok I found it

#

Setallow flight

noble spire
#

yup

#

then for every other player on the server, you need to use Player#hidePlayer(plugin, player)

idle pike
#

Does spigot allow you to make the external download link bukkit?

sand rune
#

@noble spire

#

How to make player game mode spectate

sand rune
#

@noble spire @noble spire

oblique pike
#

Stop ping spamming wtf

sand rune
#

What I write in the setGamemode

fast onyx
#

there was a working and free /premium command?

stone sinew
#

new net.minecraft.server.v1_16_R1.PacketPlayOutChat(chat, ChatMessageType.ACTION_BAR, player.getUniqueId());
in 1.16 why is this saying The constructor PacketPlayOutChat(IChatBaseComponent, ChatMessageType, UUID) is undefined

chrome beacon
#

Why are you using NMS for actionbars

stone sinew
#

Just need an answer for the question. Not a question of my reasoning.

dense goblet
#

Unless you're coding in MS Word

noble spire
stone sinew
noble spire
#

hmmm okay

sand rune
#

How to teleport player from server to another and when I complete that , where I put the plugin , in BungeeCord or the Lobby Spigot server

stone sinew
#

Wanna keep the same methods

noble spire
#

1.8?

stone sinew
#

1.8.8 - 1.17.1

bronze notch
#

Is having an inventory listener for every GUI inventory bad practice?

stone sinew
#

When was the ChatMessageType parameter added?

noble spire
#

wait a sec

stone sinew
#

Those params work for 1.8 - 1.15 but not 1.16

noble spire
#

Get the version:

((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion();
stone sinew
#

?

sand rune
#

@noble spire
How to teleport player from server to another and when I complete that , where I put the plugin , in BungeeCord or the Lobby Spigot server

noble spire
#

Don't ask me 😳

noble spire
# stone sinew ?

If they're below version 1.15, then use the packets, otherwise use the inbuilt spigot function

stone sinew
sand rune
#

How to teleport player from server to another and when I complete that , where I put the plugin , in BungeeCord or the Lobby Spigot server

noble spire
#

NMS isn't good to use for that specific reason, it changes all the time, through all the different versions

sand rune
#

I realy Need this

noble spire
#

I can't help much more

sand rune
noble spire
#

explain what you're trying to do, I can't understand what you're asking

stone sinew
#

I need to know when the ChatMessageType param was added to spigot().sendMessage so I know which versions to use the api on.

noble spire
#

Okay, well that's a different question

sand rune
stone sinew
fluid cypress
#

using ItemStack.getData() is enough to make a perfect copy of an item? same enchantments, same durability, same name, everything that an item can have?

sand rune
#

@opal juniper
How ?

#

@opal juniper
And where I put the plugin when I finish

stone sinew
#

Perfect thx

opal juniper
opal juniper
sand rune
#

@opal juniper
Thanks !

opal juniper
#

You can serialise it to a string and then back again

opal juniper
quiet ice
#

good old java importing classes too eagerly

quaint mantle
#

this is a really bad structure and is bound to fail

#

use a refleciton wrapper instead

stone sinew
stone sinew
quiet ice
#

if anything a (well, actually a few) try-catch everything should resolve this issue

dusty sphinx
#

How can I "reschedule" a task? It's already scheduled and I want to schedule it to occur again. It is already running and I don't want to stop it.

fluid cypress
#

how do i get the content of a player inventory? besides the armor and left hand, i dont get it, there is no methor for that on the PlayerInventory interface, or i cant see it

stone sinew
quiet ice
quaint mantle
#

should just give u all the items

fluid cypress
#

right, bc thats inherited from Inventory

quaint mantle
#

yeah

quiet ice
#

alternatively, #iterator()

fluid cypress
#

thanks

fast onyx
#

how i can set the timezone of my server?

quaint mantle
#

i dont think u can

#

just will be the timezone of the host PC

fast onyx
#

oh

quaint mantle
#

mayb u can search javadocs for the date object

opal juniper
fast onyx
#

because on the console appears the timezone of the host pc

#

and not my own

#

and i want to set autorestarts

quaint mantle
#

just find out the offset

#

between ur timezone and the host pc's timezone

stray halo
#

Hello, does anybody know what changed in 1.17 with packets

#

I had a code that used packets and it doesn't work anymore in 1.17

oblique pike
#

Do i need to handle entity damage event if i want to increase mob damage or i can increase mob damage another way?

quaint mantle
#

whats in the spigotActionbar method?

#

could it be in that function?

#

or are you using a version below 1.9 for the test

stone sinew
quaint mantle
#

does ServerVersion have a .equals

stone sinew
#

And no its not caused by the spigotactionBar method. Already tried commenting that out.

stone sinew
quaint mantle
#

the enum

#

?

stone sinew
#

Its the object class. Nothing else

quaint mantle
#

because == and .equals is very different

#

== compares the exact class id

stone sinew
#

yeap

quaint mantle
#

and .equals compares the information in it

eternal night
#

class id

quaint mantle
#

well

#

i dont know how u explain

#

it

#

its like the thingy in thingy

eternal night
#

object identity 🙂

quaint mantle
#

yeah

#

im looking up javadocs rn and i cant find ServerVersion

stone sinew
#

Yeap .equals has the same issues.

stone sinew
quaint mantle
#

ah ok

#

sorry im not very experienced in packets

#

trying to help as best i can

#

brb

stone sinew
#

Packets arn't the issue. For some reason this exact same code doesn't work on this plugin but works on my other plugin lol

quaint mantle
#

do u have the packet object imported?

stone sinew
#

nope

quaint mantle
#

maybe import it

stone sinew
#

that causes the issue I'm avoiding lol

quaint mantle
#

well

#

the error is classdefnotfound

stone sinew
#

If I import it and the version doesn't match then it throws the error saying class not found.

quaint mantle
#

wait nvm i see what you're doing

wild inlet
#

I'd like an armorstand to move linearly along a path for about a second after it spawns, then die. Is there any way to accomplish this without delving into NMS?

Currently, I've tried no gravity + velocity, but no gravity disables velocity working.
Marker suffers a similar problem where the armorstand can't move with velocity.

fluid cypress
#

trying to make an exact copy from slot 22 to slot 23, just for testing, but it doesnt work, it only copies the material, but no durability, enchantments, etc

ItemStack[] current = inventory.getContents();
current[23] = new ItemStack(current[22].getType());
current[23].setData(current[22].getData());
inventory.setContents(current);

there is no error in console, what am i doing wrong?

quaint mantle
#

itemmeta?

#

forgot that

stone sinew
fluid cypress
#

the thing is i need to use setContents, the idea is store the inventory, to later restore it

wild inlet
#

Is this a serialization problem?

#

Unless you give more context as to why you can't

#

ItemStack#clone is your answer.

quaint mantle
quaint mantle
#

try do something like

#

i forgot how u do it

#

like mix in the version with the package thing

stone sinew
quaint mantle
#

net.minecraft.server.(add version here).Packet

fluid cypress
wild inlet
idle pike
#

If someone downloads 2 different versions of a plugin does it count as 2 downloads or 1

wild inlet
#

there's one in bukkit

wild inlet
stone sinew
quaint mantle
#

think you might have to

#

because its just gonna give u errors

fluid cypress
stone sinew
quaint mantle
#

whats the main differences between the plugins

#

anything big?

#

maybe you forgot something?

stone sinew
#

Don't mind the debug it doesn't run because of the error lol

quaint mantle
#

well im lost

stone sinew
#

Yeap

quaint mantle
#

honestly if this was me i would try import both jar versions

stone sinew
#

Can't

quaint mantle
#

this is on the plugin that works?

#

show the one that works

stone sinew
#

Not the same exact objects but same concept one sec

quaint mantle
#

doesnt 1.9 also have the api for action bar messages?

stone sinew
#

This is in a notepad that class I replaced with reflection because its for all versions not just 2

quiet ice
#

NoClassDefFoundError is a subclass of Error, with try-catch everything I meant catching the Throwable class. You'd also want to try-catch every if-else block as otherwise it'll short-circuit.
Though idk

#

This sounds really wrong imo

stone sinew
quaint mantle
#

yeah ok

main dew
#
    private boolean checkList(String[] args, Enum typeEnum) {
        for (Enum e : typeEnum.values()) {
            String arg = e.name();
            if (arg.equalsIgnoreCase(args[0]))
                return true;
        }
        return false;
    }```
feral laurel
#

Does somebody know how the interactive shell from spigot got made? Are they using some library like spring-shell or what do they do?

main dew
quaint mantle
#

you could try using multiple classes

#

with an interface

quiet ice
#

catch Throwable, not exception

stone sinew
#

👍

quiet ice
#

NoClassDefFoundError is a subclass of Error

sharp bough
#

is it possible to get the particles a splash potion makes?

opal juniper
#

Yes

sage swift
#

Particle enum :+1:

sharp bough
#

for example
splash potion in inv
choose what potion to use
take the particles of that splash potion you placed in the inv
save and use that

quaint mantle
#

u can try multiple classes

quiet ice
#

then we would need to look at the bytecode of that method

quiet ice
#

or somethig else entirely is causing the class to load

stone sinew
quiet ice
#

But yea, using different classes that are loaded lazily is the easiest solution

quaint mantle
#

and its so far the only thing ive found on nms multiple versions no reflection

paper viper
#

"not as clean"

#

where did you get that from?

quiet ice
#

I believe that it has something to do with the sendPacket method but the question still is WHY, there are a few more classes that are requested before it that could fail but do not. It looks as if something else causes the issue

paper viper
#

thats pretty untrue (for the multiple classes not being clean thing), as NMS gets more complex you cant just use 1 class to store it all

paper viper
#

yikes

#

🥶

opal juniper
#

Questionable coding style

paper viper
#

bro at least cache them

#

or smthing

#

thats gonna be laggy as hell

quiet ice
#

the good thing is that this is the sort of class that you need to only code once and that you can forget about it later

paper viper
#

i'd even say use MethodHandles lol but thats not needed

#

and also no encapsulation

#

oh wait

#

its a utility class

#

what

quiet ice
#

the fact that the method does not return as early as possible is another thing that upsets me

paper viper
#

this doesnt make sense

#

lmao

stone sinew
paper viper
#

yea uh

#

use modules

stone sinew
#

Also keep in mind I did say I have since recoded it lol

stone sinew
stone sinew
#

Cleaner then multi classes

quaint mantle
#

also doesnt need to use a bunch of if statements for most of those

#

just get the version string from the package

paper viper
#

doesnt mean you dont change it

#

lol

#

not an excuse

quiet ice
#

you see, it is a bad decision to post bad code

stone sinew
paper viper
#

yeah no

#

that looks like a mess still

stone sinew
#

Alot cleaner then the past one xD

#

And far better performance to so 🤷