#help-development

1 messages Β· Page 2188 of 1

ornate roost
#

I coded a plugin that registrates if a player clicks a certian item, now i want to execute an @p command, how can i do it? Because Player#performCommand shows red

humble tulip
#

?paste

undone axleBOT
ornate roost
#

huh?

earnest forum
#

you cant use @p

#

just use the player's name instead

ornate roost
#

package com.cyan.elytrarace;

import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {

@EventHandler
public void onPlayerUse(PlayerInteractEvent event){
    Player p = event.getPlayer();
    if(p.getItemInHand().getType() == Material.PHANTOM_MEMBRANE); {
        Player#performCommand (/tp @p 0 200 0)
}
}
}
#

performcommand is red now

grave mason
humble tulip
#

Don't put /

#

You need to wrap strings

#

And replace @p with player name

#

Not sure if @p works

#

It may

ornate roost
#

yeah i asked around because i didnt know how to perform a command and thats what others told me

#

I just started so i dont have that much

humble tulip
#

A command is a string

#

So u need to put it in ""

ornate roost
#

i already learned the basics but ill watch it later

#

i didnt exactly know how to perform a command and another person told me itll work like that, but i guess ill never trust others again goodbye

humble tulip
#

Lol

#

I wonder if he tried to register the events

#

I dont think there's an onenable

#

It is

#

Check the curly braces at the end

#

first for the if, then the method, then the class

twilit pulsar
quaint mantle
undone axleBOT
twilit pulsar
#

i tried removing it, but then the other one got error

tender shard
eternal oxide
#

looks like you need one more }

twilit pulsar
#

it says

#

Expected }

#

Expected }

#

2 times

#

yea but when i add, it still says the same error

#

wait

#

itsn ot fixed

#

i think

#

really confusing.

humble tulip
#

?lj

#

?learnjava

undone axleBOT
final monolith
#

how to move an entity (with pathfinder) to a 20+ blocks location?

#

i want move

#

:/

quaint mantle
final monolith
#

oh, thats interesting

#

i will search about, thanks!

sterile token
#

Does bungeecord contains a packet for redirecting a player to a specific server? (Im creating a fake client and connecting it throw proxy. So i need to he based on minecraft protcol)

quaint mantle
#

A fake client doesnt have a connection. Thats why the proxy doesnt know about it at all.

crimson terrace
#

if pathfinder isnt that important that is

quaint mantle
final monolith
sterile token
#

A plain socket which do handshake and login packet

#

So its literally a fake client

crimson terrace
final monolith
crimson terrace
#

this is the method, I dont see anything about 20

final monolith
#

oh wait, i though you talking about another method

#

i will test this

crimson terrace
#

it returns false when the path is null

crimson terrace
final monolith
#

oh no, didnt works

#

the limit of 20 blocks apparently comes from Minecraft inself

crimson terrace
#

well that method is from minecraft

#

its nms with mojang mappings... could there be another reason? maybe the location targetted is not reachable?

final monolith
#

its a common issue, didnt work

crimson terrace
#

oh well

final monolith
#

"minecraft:" + material.name().toLowerCase() ?

crimson terrace
#

that

final monolith
#

yw

crimson terrace
#

?notworking

opal juniper
#

define not working

undone axleBOT
#

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

opal juniper
#

have you registered the listener

eternal oxide
#

Your Configuration is defined but not Initialized

#

config.addDefault will be throwing an NPE

final monolith
eternal oxide
#

yes you do, if that code is running

opal juniper
#

getConfig; != getConfig();

crimson terrace
#

its a runtime error

crimson terrace
crimson terrace
#

oh sorry

#

also: send the entire class please

#

?paste <- use this

undone axleBOT
final monolith
#

i think your listener class arent registered

crimson terrace
#

your main class aswell please

#

specifically the onEnable()

#

you have to register the class which the Listener is in, not only the Main class

final monolith
#

nooooooooooo

#

getServer().getPluginManager().registerEvents(new youAreAwesome(), this);

#

πŸ™‚

crimson terrace
#

that

chrome beacon
#

Which is why I told you to learn some Java before starting with Spigot

final monolith
#

To a listener class catch events, its needs to be registered

chrome beacon
#

They've already done it once

final monolith
#

to register a listener class, you need to use Bukkit.getPluginManager().registerEvents(new ListenerClass(), plugin);

crimson terrace
final monolith
crimson terrace
#

new

ivory flume
#

… new ListenerClass()

crimson terrace
#

not .class

final monolith
#

yeah, new youAreAwesome()

crimson terrace
#

I usually circumvent the whole Listener registration by doing it with reflections

opal juniper
#

gross

crimson terrace
#

me or the code

#

cuz both are true

opal juniper
#

the code

final monolith
#

nice code dude

crimson terrace
#

thanks, its stolen πŸ™‚

final monolith
#

oh lol

#

πŸ˜†

crimson terrace
#

basic dev things

quiet ice
#

Calling the class Reflections is a bit wrong for me

crimson terrace
#

its a dependency

quiet ice
#

I know, but it won't actually use the reflection API there

opal juniper
#

that is more lines of code than just a List.of and a for loop

final monolith
#

did you insert this into the onEnable(), right?

quiet ice
#

Not working as in not compiling?

crimson terrace
quiet ice
final monolith
opal juniper
#

wow you removed a dependency?

#

im so confused?

quiet ice
#

There are 100 ways of not working

final monolith
#

did you insert this into the onEnable(), right?

#

please, show us

#

?paste

undone axleBOT
crimson terrace
#

πŸ˜„

final monolith
#

lol

quiet ice
#

(the name is bad even if it were to use the reflection API)

final monolith
#

🀣

crimson terrace
#

meh, it works and its fine

final monolith
#

no console errors?

final monolith
#

🀣

quiet ice
#

I am calling it now: it does not compile because either:
a) The class "youAreAwesome" does not exist
b) The class "youAreAwesome" does not have a no-args constructor

#

Even better lol

final monolith
#

config is null

crimson terrace
#

geol

final monolith
#

omg

quiet ice
#

?di

undone axleBOT
final monolith
#

HELP ME

#

SOMEONE

crimson terrace
#

no

final monolith
#

DONT LEAVE ME HERE

eternal night
#

your config is null

#

the instance

#

not the value inside it

quiet ice
#

Pass config to the awesome class

#

Via DI

brittle lily
#

How do I get rid of multiple ItemStacks?
Sometimes I should create 4-5 ItemStacks and I'm setting ItemMetas for each them. Its being really long code..

final monolith
earnest forum
#

make a method

#

takes in like name, type, lore, etc

#

and returns itemstack

quiet ice
crimson terrace
quiet ice
#

There are some people on here I really want to kill for their stupidity

quaint mantle
#

hey so sometimes the ConfigurationSection#get(String) returns LinkedHashMap instead of ConfigurationSection?

opal juniper
#

depends if it has been saved to disk iirc

quiet ice
#

(not that I will, I do not have time for that)

crimson terrace
quaint mantle
final monolith
quaint mantle
#

well yes but why doesn't it just return ConfigurationSection

final monolith
#

java cannot do this

opal juniper
#

id need geol to weigh in here, but am pretty sure once it is saved to disk it will be a config section, otherwise it is a memory section. Or something like that

final monolith
quiet ice
#

...

#

Oh god

final monolith
#

and you need to work inside that object

quiet ice
#

The reason it returns a LinkedHashMap is simply because someone inserted a LinkedHashMap in there

quaint mantle
#

someone...

quiet ice
#

Though it is a bit strange that it does not convert it to a config section

final monolith
quiet ice
#

?stash time to question the source code heh

undone axleBOT
final monolith
#

= you

quaint mantle
#

...

#

NO

eternal oxide
quaint mantle
#

I am not modifying it

#

only loading

quiet ice
quaint mantle
#

it should be a config section

quiet ice
#

How exactly do you load it?

#

Probably yaml right?

quaint mantle
#

just as normal

#

yaml

#

yeah

eternal oxide
#

to get it as a Map from a ConfigurationSection/MemorySection you getValues(true)

vale ember
final monolith
#

how change the blocks limit of a PathNavigation? (moveTo method)

#

hey i didnt say that with that inttention

#

im sorry dude

opal juniper
final monolith
opal juniper
#

well, you can manually move the entity?

final monolith
opal juniper
#

no as in generate the path with a custom pathfinder and then move it manually

final monolith
#

πŸ€”

quiet ice
#

@quaint mantle Yeah, no clue why this happens

#

Could be a spigot bug, who knows

#

Could also be a snakeyaml issue

final monolith
quaint mantle
#

the issue is, my system is relying on a yaml section being 1 type

opal juniper
#

forget i said anything

final monolith
#

πŸ€”

quaint mantle
quaint mantle
#

oh cool

quaint mantle
#

it needs a key

quiet ice
#

Yeah, you need to do it on the parent

quaint mantle
#

it has no parent bc im doing new MemorySection()

quiet ice
#

Myeah, I think this is the cause

#

You should use YamlConfig not whatever system you have in place

quaint mantle
#

cause?

#

?

dusty sphinx
#

are spigot builds for release candidates planned to be available this update cycle

chrome beacon
#

Probably no

quaint mantle
#

oh I see why it is returning LinkedHashMap btw

#
object:
  - a: 1
    b: 2
  - c: 3
    d: 4
```Its this yaml section
quiet ice
#

You should have something like

[... load yaml via YamlConfig ...]
ConfigurationSection section = cfg.createSection("path.to.broken.section", (Map<?, ?>) cfg.get("path.to.broken.section"));
quaint mantle
#

get("object") returns a map not configSection

quiet ice
#

Hence the cast to map

#

.createSection() takes in a map

quaint mantle
#

Oh now i get what you doing

#

converting to configSection

#

Ic

quiet ice
#

Technically you want to do check whether .get really returns a map or not, but you should understand what I mean

quaint mantle
#

yup

acoustic pendant
#

Hello! I was thinking in creating a skyblock plugin, but i don't really know how to make a region for all islands, could someone help me what to use?

short raptor
#

???????? what is this about

#

Why is it taking issue with those two lines in my config file and nothing else

#

And it doesn't even seem to be affecting the functioning

quiet ice
#

Did you accidentally add a tab in there?

short raptor
#

Do I have to always use spaceS?

quiet ice
#

Yeah ... because yaml

short raptor
#

There didn't seem to be a tab but I retyped the spaces anyway

#

I'll test it again

tender shard
short raptor
tender shard
#

send your full config

#

as text

#

?paste

undone axleBOT
short raptor
#

Ok

#

I retyped the spaces on 9 and 10 and it's still annoyed about something

tender shard
#

seems correct. are you sure the file included in your plugin is exactly the same as the one you sent?

short raptor
#

Yea I just copypasted it out of the config that's on the server

tender shard
#

huh then I have no idea

short raptor
#

The error doesn't seem to affect the functioning of the thing at all either

#

Like it says it can't parse it blah blah but it still finds all the strings lol

tender shard
#

I have no idea :/

short raptor
#

I might try server restart

#

Still happening after a restart

#

Oh well it doesn't stop the plugin from wokring

#

Maybe it will go away eventually

tardy delta
#

put it in a yaml validator

tender shard
#

I did

quiet ice
#

snakeyaml moment

short raptor
#

Oh wait I'll copy the url

#

I'm dumb

tardy delta
#

google yaml validator and click first thing that shiws up

short raptor
#

Yea I found it

#

Still valid

#

I don't think this error is actually an error

#

Or something

final monolith
#

guys, why entities with sleeping animation turns invisible if goes 16 blocks of distance?

short raptor
#

I copypasted the yaml out of the validator into the file and it still takes issue with that

#

This error is just bs

short raptor
#

After the restart it comes back until I do that command again

harsh totem
#

I have this code that's supposed to give hero of the village 10 but when I finish a raid I get hero of the village V. any ideas?
The schedule is there because if it isn't there, the default minecraft code overrides it and gives hero of the village V

    public void Hero(RaidFinishEvent event){
        PotionEffect effect = new PotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE, 120000, 10));
        Set<UUID> heroes = event.getRaid().getHeroes();
        heroes.forEach(id -> {
            Player player = Bukkit.getPlayer(id);
            if (player == null) return;
            Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                @Override
                public void run() {
                    player.removePotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE);
                    player.addPotionEffect(effect);
                }
            }, 2L);
        });```
tardy delta
#

i mean a for loop and a lambda would look more elegant

harsh totem
tardy delta
#

why applying it after two ticks tho

#

i know

harsh totem
#

The schedule is there because if it isn't there, the default minecraft code overrides it and gives hero of the village V

#

I said

tardy delta
#

i guess the max level is 5

harsh totem
tardy delta
harsh totem
#

not survival

#

the plugin gives the effect of X

tardy delta
harsh totem
#

not minecraft's code

harsh totem
harsh totem
#

Well I changes it to this so that the delay only happens once

    public void Hero(RaidFinishEvent event) {
        PotionEffect effect = new PotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE, 120000, 10));
        Set<UUID> heroes = event.getRaid().getHeroes();
        Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
            @Override
            public void run() {
                heroes.forEach(id -> {
                    Player player = Bukkit.getPlayer(id);
                    if (player == null) return;
                    player.removePotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE);
                    player.addPotionEffect(effect);
                    RaidLevels.remove(event.getRaid());
                });
            }
        }, 2L);
    }```
#

but I still get level V and not 10

#

any ideas?

tardy delta
#

your ide should tell you about that too

#

unless youre using java7 or lower

sterile token
#

Nice to see you again with nitro

tender shard
#

they even used lambdas in the code they sent πŸ˜„

tender shard
#

wassuuup

sterile token
#

I love ho you asked and you

#

Hahaha

#

Its like a developer communication

#

hahaha

tender shard
harsh totem
tender shard
harsh totem
#

so

#

help me please

tardy delta
harsh totem
iron glade
harsh totem
tardy delta
#

runTaskLater(() -> { /* your code */ }, delay)

iron glade
#

what java version are you using then?

tender shard
# harsh totem how would you have done this?
    @EventHandler
    public void Hero(RaidFinishEvent event) {
        PotionEffect effect = new PotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE, 120000, 10));
        Set<UUID> heroes = event.getRaid().getHeroes();
        Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> heroes.forEach(id -> {
            Player player = Bukkit.getPlayer(id);
            if (player == null) return;
            player.removePotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE);
            player.addPotionEffect(effect);
            RaidLevels.remove(event.getRaid());
        }), 2L);
    }
vale ember
#

should the name in AttributeModifier be snake case or camel case?

generic.attackDamage or generic.attack_damage

tardy delta
#

just do runTaskLater

sterile token
tender shard
#

I once did

sterile token
#

Oh ok

#

Alex, as i have seen you can use it to create a client right?

tender shard
#

erm well if with "client" you mean a bot etc, yes

sterile token
#

Yeah

#

I want to cretae a bot

#

But good bot

#

No the one who do bots attach

tender shard
#

why waste time create good bot when bad bot do trick

sterile token
#

I want to create a bot which still afk in the server

#

What do you think?

tender shard
#

that's exactly what I did

sterile token
#

You do it for PMS?

#

Plugin message channel?

#

πŸ˜‚

#

I want to do it with that reason

tender shard
#

it was a commission, no idea what the dude needed it for

sterile token
#

mfalex

#

Oh you sell it

#

I suppouse you wont help me

#

Because they paid for it

tender shard
#

at least I cant show you the source code

sterile token
#

Also where did you find the lib documentation?

jagged quail
#

rip

sterile token
jagged quail
sterile token
chrome nova
#

Is there any way to bypass world guard mob-spawning false with your own plugin? I tried setting the priority to the highest

tender shard
sterile token
#

And you using commandSender

tender shard
sterile token
sterile token
# jagged quail

Look he call it sender, and them he is doing instanceof commandSender. Instead of doing instanceof sender

sterile token
#

No matter

#

mfale thanks i ill try to do the bot

#

Did you find it diff?

vital moon
#

where do we download Java 17 at?

tender shard
#

or using your package manager

tender shard
vital moon
#

trying to download on a windows machine

tender shard
sterile token
vital moon
tender shard
sterile token
vital moon
#

I have orcale downloaded already, trying to run buildtools and just says I need java 17 when I have JDK 17 installed

tender shard
#

you also have to use java 17 to run buildtools

vital moon
#

yes but I cannot locate where to download it

tender shard
#

C:\LocationToJava17\bin\java17.exe -jar BuildTools.jar ...

sterile token
#

mfalex

#

Sorry for bein annoying

#

But i have been wondering to doa proxy bot since 2021

#

So i will try do it

#

I wont give up

vital moon
jagged quail
#

java is confusing

tender shard
#

wrong quote

tender shard
jagged quail
#

i never learnt it

tender shard
jagged quail
#

im following a tutorial to make my first plugin

#

πŸ—Ώ

vital moon
jagged quail
#

maybe i'll get better in the future if my 2 brain cells can contain information

tender shard
# jagged quail

the thing above you sent is called "casting". You know, you only have a CommendSender object. It MIGHT be a player but you don't know yet. so you cannot access any player related methods unless you tell java "okay we can treat this commandsender as player, because I know it'll be a player"

sterile token
#

oliveryou never did a plugin? Lol i thought you halready kno

#

Not bein rue

tender shard
#

also what tutorial do you follow? send link pls

sterile token
#

mfalex

jagged quail
# tender shard also what tutorial do you follow? send link pls

In this video I show you the standard way to create commands as well as how to create a custom command handler to create your commands in an easier way.

πŸŽ“ Take my FREE Java course today by starting a free trial of Skillshare:
https://wornoffkeys.com/java-for-free

πŸ“Ί Updated playlist:
https://www.youtube.com/playlist?list=PLaxxQQak6D_e-4s_rDzmUq...

β–Ά Play video
sterile token
#

Its fucking annoyingmy claim plugin

#

When the build flag is active and player is claim member, it told me as i cannot build on that claim

tender shard
tender shard
jagged quail
#

idk how to make it show the version loading

humble tulip
#

Ah shit here we go again

tender shard
#

that cannot work

jagged quail
#

should that work

tender shard
jagged quail
#

oh

humble tulip
#

Use plugin. Get Description. Get version

jagged quail
#

i know alex is cringing rn

tender shard
#
getLogger().info("MyPlugin version " + getDescription().getVersion() + " is loading");
sterile token
sterile token
tender shard
sterile token
#
@EventHandler(priority = EventPriority.HIGHEST)
    public void onBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        Block block = event.getBlock();
        Claim claim = this.plugin.getClaims().getClaim(block.getLocation());
        if (claim == null) return;
        if (claim.getLocation().equals(block.getLocation()) && claim.getOwner().equals(player.getUniqueId())) {
            this.plugin.getClaims().delete(claim);
            player.sendMessage("Β§4Claim Β§f" + claim.getUuid() + " Β§4has been deleted");
            return;
        }
        if (claim.getLocation().equals(block.getLocation()) && !claim.getOwner().equals(player.getUniqueId())) {
            event.setCancelled(true);
            return;
        }
        if (claim.getOwner().equals(player.getUniqueId())) return;
        if (!claim.getFlags().contains(Flag.Build) && claim.getMembers().contains(player.getUniqueId())) {
            event.setCancelled(true);
            player.sendMessage("Β§f[BlockBreak] Β§cBuild flag is not enabled");
            return;
        }
        if (claim.getMembers().contains(player.getUniqueId())) return;
        event.setCancelled(true);
        player.sendMessage("Β§f[BlockBreak] Β§cYou cannot build on Β§f" + claim.getUuid() + " Β§c claim");
    }```
tender shard
#

btw you should directly check out a tutorial that uses maven

harsh totem
#

So I have this HashMap private HashMap<Raid, Integer> RaidLevels = new HashMap<Raid, Integer>();
When a raid starts this is registered to the Hashmap @EventHandler public void BadOmen(RaidTriggerEvent event){ RaidLevels.put(event.getRaid(), event.getPlayer().getPotionEffect(PotionEffectType.BAD_OMEN).getAmplifier()); }
when a raid is finished I execute this PotionEffect effect = new PotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE, 120000, RaidLevels.get(event.getRaid()));
and it gives me Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.HashMap.get(Object)" is null

#

I output the HashMap after the RaidLevels.put() and it's ok

#

idk what is wrong here

tender shard
humble tulip
#

What message are you getting?

sterile token
harsh totem
tender shard
humble tulip
sterile token
#

Yes

humble tulip
#

Are you sure

sterile token
#

I ill check it

jagged quail
sterile token
#

I dont wanna happenwhat happened yestetday

tender shard
#

you can still follow the youtube tutorial for the actual content

jagged quail
#

it is building using maven

tender shard
#

huh?

#

but he doesnt have any pom.xml

sterile token
jagged quail
vale ember
#

hey, i changed the swords attack damage and it's attack speed got reset to the base 4 but i want it to be regular 1.6, should i just add -2.6 attack speed with attribute modifiers or is there a better way? and how do i make it look like vanilla sword (just hide attributes and manually add lore?)

tender shard
jagged quail
tender shard
#

maven good

jagged quail
tender shard
#

btw that message is useless because spigot itself automatically prints messages like that

sterile token
#

minion, uuid match

jagged quail
#

/heal in console does this

#

so it works

#

need to test in game

sterile token
#

mfnalex what did the bot tht you receive comission from?

humble tulip
#

what did the bot?

tender shard
#

you mean what it did?

#

nothing. it just logged a player in and then kept them standing there doing nothing

humble tulip
#

What kinda bot? Discord bot or mc bot

sterile token
#

Someone paid him to do a bot that connecto to server and still afk until server goes don

#

Is exactly what we are looking minion

humble tulip
#

I'd still prefer being able to add the player thru bungee itself without connecting a player

sterile token
#

Also i dont know why their discord is like dead

humble tulip
#

But geyser can work

#

I personally don't like it as a soln

sterile token
#

And that type of packets are delivered by a player connection

ivory sleet
#

yep

#

if you wanna send a message with plugin messaging from spigot server A to B it requires at least 2 players online, one online per server

sterile token
#

Conclure the one that will works is a fake client staying afk right?

ivory sleet
#

yeah you could mock a player in principle

humble tulip
#

Conclure u think it's possible to create a fake proxyplayer and connect to each spigot server?

ivory sleet
#

technically it would be

sterile token
#

What do you mean by mock?

humble tulip
#

I dont understand netty enough to do it

sterile token
#

With netty would be more diff

humble tulip
#

Yes but a cleaner impl

sterile token
#

Because you have to use lot of reflections to get the spigot ad bungee netty instance

#

But yeah i would prefer doing it with netty rather than plugin message

humble tulip
#

You won't have to deal with spigot if eberything goes on in bungee

sterile token
#

Sorry?

#

I dint understand

humble tulip
#

Reflection would be needed though I'm pretty sure

ivory sleet
#

The biggest issue I can see here would be proper authentication and stuff like that

#

just connecting to the server socket isnt that hard

sterile token
#

Talking about what conclkure?

#

The netty one or the bot one?

ivory sleet
#

well im talking about mocking a player

sterile token
#

what its mocking?

ivory sleet
#

it can mean different things

sterile token
#

Conclure im already doing that

ivory sleet
#

in this case faking is a good synonym

humble tulip
#

Yep that's what i wanna try

sterile token
#

Im connecting a socket to proxy, sending handsahke and login packet

ivory sleet
#

yeah good for you

sterile token
#

Idk why

#

What can be conclure?

ivory sleet
#

idk

sterile token
#

Conclure do you want to see the full code?

ivory sleet
#

uh sure Ig

sterile token
#

Allright

#

i ill send the zip

ivory sleet
#

send a github link or sth

tardy delta
#

imaging not using gh

sterile token
#

ok i will upload it

#

Conclure please ait

#

I really want to make this works

#

Its my main achive

ivory sleet
#

yes and it has been for quite some time

sterile token
#

do you remember i talk about this many time?

#

I think more than 50 times

opal juniper
#

Im so fucking confused

sterile token
#

why olie?

tardy delta
#

welcome to my life

sterile token
#

Why are you annoying

#

Its simple the logic:

Plugin message channel on spigot side require a 1 player atleast, so im faking a client which connect to proxy

opal juniper
#

So i am looking at this value of out, its purely sin(1) * 2*32

tardy delta
#

use an alt lol

opal juniper
#

hang on let me get my calc

sterile token
#

conclure i have already upload it

#

Where do i need to send the link

#

here or dm?

ivory sleet
#

here

sterile token
#

ok

opal juniper
#

WTF

crisp steeple
#

dependency injection

chrome beacon
#

?di

undone axleBOT
tardy delta
#

?di

undone axleBOT
tardy delta
#

aa

ivory sleet
#

that works, altho dependency injection is favored

crisp steeple
#

?di just for good measure

undone axleBOT
ivory sleet
#

I mean depends on how you're going to scale your project in the future

humble tulip
#

?di to make sure u see

undone axleBOT
opal juniper
#

so sin(1) is about 0.84147098
2^32 is 4294967296

why is java giving
0.84147098 * 4294967296 = 2147483647

tardy delta
#

getPlugin does some weird stuff with the classloader iirc

opal juniper
#

whattttt

humble tulip
#

Maybe it's bigger than integer.maxvalue

sterile token
humble tulip
#

I thought it's supposed to go negative then though

opal juniper
#

that must be it

tender shard
#

static final fields are instantiated when the class gets loaded

humble tulip
#

Static variables are declared when the class loads

tender shard
#

so obviously way before onEnable

humble tulip
#

Not declared

ivory sleet
#

If an integer multiplication overflows, then the result is the low-order bits of the mathematical product as represented in some sufficiently large two's-complement format.

opal juniper
#

not being funny, thats not very big

#

2 billion ish

humble tulip
#

No

#

Not makenit final

#

Can we see?

ivory sleet
#

use a lazy class

opal juniper
#

im just search and replacing int -> long

ivory sleet
#

since your main class is gonna be loaded its gonna cause some issues storing your plugin instance as a constant in your main class

humble tulip
#

Use a class that you call onenable

ivory sleet
#

^

sterile token
#

Conclure i sent the repo?

#

I cannot remember now

#

Some people told me that i the client was being kicked cause of not sending keepalive packet or anwering the ping packet

humble tulip
#

Conclure are classes loaded into memory when you first reference them or are they loaded before and the jvm just decides to do stuff associated with it when it's first referenced?

#

I feel like you'd know this cuz ur big🧠

ivory sleet
#

whenever a field or method from the class is invoked, then it gets loaded (or explicitly loaded with classloaders)

#

so this excludes using merely Class.class

humble tulip
#

Does that mean a HUGE class can theoretically lag the application?

ivory sleet
#

no not really

#

I guess to some extent, but in general no

crisp steeple
#

probably, just depends on the use case i guess

humble tulip
#

Yes

#

It's how you inject dependencies

ivory sleet
#

PSJahn yes, you most likely are going to have dependencies

crisp steeple
#

yeah using it for dep injection is fine

ivory sleet
#

since your command executor is gonna be a pretty low level class, thus depending on higher level classes

sterile token
#

lol

#

I was ignored

#

Hahaha

ivory sleet
#

verano

#
        while (true) {
            System.out.println(Util.readVarInt(this.input));
        }
sterile token
#

That was for testing pupoue

ivory sleet
#

ah okay

acoustic pendant
#

Hello! I'm trying to use "WorldEditPlugin" that is supposed to be in the API but I can't use it. How can i solve this?

ivory sleet
#

but anyway why dont you make it to a spigot plugin?

sterile token
#

Yes that my goal in the future

#

Just for testing i do it like that

chrome beacon
acoustic pendant
sterile token
chrome beacon
acoustic pendant
#

sure

#

<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>6.1.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

sterile token
#

allright

#

Big problem

#

Im connecting a fake non premium

ivory sleet
#

yes

#

exactly

sterile token
#

Oh lmao

#

Fucked game

ivory sleet
#

I would deal with this by letting this fake client send a special packet

tardy delta
#

offline mode?

sterile token
#

tho

tardy delta
#

nvm

acoustic pendant
ivory sleet
#

and then you handle that special packet, so if bungee/spigot encounters the special packets you make sure to undergo a special login

sterile token
#

Oh ok

#

Good idea

#

But now i want to fix this

#

without caring for premiuym

ivory sleet
#

and then you might have to inject some other stuff to make sure that this fake client is a player

sterile token
#

Just do the player keep afk on the server

ivory sleet
#

mye

sterile token
#

Allright

#

What do i need first

#

I already doing login packet

#

See the code

ivory sleet
#

id say inject into netty

#

(server sided)

sterile token
#

how

#

I dont know lmao

#

I tried many times

#

The most shity part is that they dont have a getter

#

😑

#

i would pay someone

#

But they will ask too much

chrome beacon
acoustic pendant
#

okay, i'll try

sterile token
#

conclure?

acoustic pendant
ivory sleet
#

ye verano

#

just get the ProxyServer instance, believe the impl BungeeCord has a direct field to the nio event thing instance

#

so just reflect that

sterile token
#

Okay

#

I ill try

#

And them what i modify?

#

I inject my own channel into netty?

ivory sleet
#

myeah sth like that

#

or if you create a decorator around existing stuff

#

and then inject the decorator

sterile token
#

decorator?

ivory sleet
#

a design pattern

#

google it

sterile token
#

Ok

ivory sleet
#

x)

sterile token
#

sorry

ivory sleet
#

no its fine

sterile token
#

i never heard it

#

dont make me feel small :D

minor garnet
#

why i get that exception?

sterile token
minor garnet
humble tulip
#

Well can we see how you spawned in the armorstand?

sterile token
#

Oh you are coding a plugin?

minor garnet
charred blaze
#

String currentDir = System.getProperty("user.dir"); reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(currentDir + "/" + "nicks.txt"))));

humble tulip
#

Huhhhh

#

Can we see spawnBullet?

#

File file = new File("nicks.txt");

#

Just do that

#

Why generate a skull every time

#

Do it once and save it

sterile token
humble tulip
#

But why generate one everytime to check if it's similar

charred blaze
humble tulip
#

Save them to a set or map or something

sterile token
charred blaze
humble tulip
#

Well pass that file into the fileinputstream

crisp steeple
#

well what is your error?

charred blaze
humble tulip
#

It's not but it's hard to read your code

humble tulip
#

Why don't u just add some data to the pdc and check if the skull has that data

#

Instead of checking issimilar

charred blaze
humble tulip
charred blaze
#

in

#

pluginname/nicks.txt?

charred blaze
#

ok wait lemme try

humble tulip
#

No you need to do new File(plugin.getDataFolder, "nicks.txt") ; for that

charred blaze
crisp steeple
#

sooo are you getting an exception? or is the broadcast just not getting triggered

#

well can you send the error then?

charred blaze
#

[19:13:34 WARN]: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
[19:13:34 WARN]: at java.util.ArrayList.rangeCheck(Unknown Source)
[19:13:34 WARN]: at java.util.ArrayList.get(Unknown Source)

humble tulip
#

Ur trying ti read an empty list

charred blaze
humble tulip
#

Size 0

#

Pretty sure it's empty

crisp steeple
#

it seems like there is a problem with however you are creating the skull

charred blaze
#

41kb

humble tulip
#

Can i see your code?

crisp steeple
#

what

charred blaze
humble tulip
#

Yes but where do you read from the reader

charred blaze
#

can i send it in dm?

humble tulip
#

?paste

undone axleBOT
humble tulip
#

Copt it there and send the link here

charred blaze
#

i dont want other people see it.

#

Dm please

crisp steeple
#

why not lol

tardy delta
#

why not reading it as yaml?

#

Β―_(ツ)_/Β―

crisp steeple
#

yeah just using a plain text file is probably not a great idea either

tardy delta
#

its probably classified

charred blaze
crisp steeple
tardy delta
#

i think he has the compiled code of a virus in that txt file

#

just use a Set<UUID>

crisp steeple
#

you dont want to be interacting with a player object if theyve logged offline

tardy delta
#

because it wont take effect ingame

crisp steeple
#

well for one itll change the next time they log in, so there could end up being 2 of the same player in your list

#

and also it could cause issues when you try to use certain methods on it

tardy delta
#

then store the OfflinePlayer object

crisp steeple
#

well then just store their uuid, and use Bukkit.getOfflinePlayer when you need the offline player

tardy delta
#

wouldnt know why

#

what are you even trying to do?

#

thats not much info

humble tulip
#

Just save to a file or something

tardy delta
#

use a Set<UUID> and check if set.contains(player.getUniqueId())

humble tulip
#

Or in their persistent data container

eternal oxide
#

set their mode in the Players PDC. then set the right mode when they log back in

tardy delta
#

and then that ^^

eternal oxide
#

?pdc

ancient plank
#

i love pdc

tardy delta
#

mmh could work even better

#

i always forget to use pdc

sterile token
#

What the heck means the number 3 in minecraft protocol?

#

Because after doing handshake and login packet, im reading the socket input stream. And the input its literally a number "3"

#

@ivory sleet reading socket input stream is literally saying shity number 3

crisp steeple
#

3

sterile token
#

yeah

#

I dont know what means

tardy delta
#

3 is 3

sterile token
#

But what means on protocol?

#

I dont understand the shity protocol

tardy delta
#

what packet?

sterile token
#

Because its said x0F shit

tardy delta
#

or isnt that a packet

sterile token
#

I dotnt know

#

Im doing handshake and login packet

#

And after that im reading the input stream

tardy delta
sterile token
#

Say 0x0F but what shit is x0f?

#

I dont understand LMAO

tardy delta
#

i aint understanding anything of bitwise

sterile token
#

bitwise'
He?

#

Im doing a plugin

arctic moth
#

Classic reddit support subs

sterile token
#

hyperd

#

do you know about protcol?

dreamy arrow
#

can someone help with buildtools install

#

there is an error

arctic moth
#

Peotocollib!

#

*?

tender shard
arctic moth
#

Haven't used it before

sterile token
#

i just doing a socket connect a spigot server

#

And sending handshake and login pacekt

tender shard
arctic moth
tender shard
dreamy arrow
tender shard
tender shard
arctic moth
dreamy arrow
#

wait wot thats not the end

arctic moth
undone axleBOT
dreamy arrow
#

i didnt fully save

#

there

tender shard
#

hm that's weird, I have no idea

#

you could try to cd into the SPigot directory, then manually run mvn clean package -U, then run buildtools again

tender shard
#

yes

carmine valley
#

Hey guys, I'm trying to make a spigot plugin that increases the player's KB the more they are hit, I've so far constructed the following code. One issue with it is that it stops knocking the player further once the knockback sends you 18 blocks away due to some Player class restriction(All other entities can be hit further than 18 blocks and don't have such a threshold, it's also might be because Knockback is managed by the client not the server "that's why anti-kb hacks are possible" and I don't want it to be a mod nor want it to have a custom client to run the plugin) I've tried to work around it by damaging the player artificially and sending them further away once after 3 hits of reaching the threshold, but it didn't quite work, the first "natural" damage doesn't knock the player at all, the second "artificial" hit does, how can I make both of them knock the player the desired amount? thanks in advance.

code:```cpp

public class Knockback implements Listener {
int heatValue = 0;

public void ArtificialHit(LivingEntity en, Vector v2, EntityDamageByEntityEvent event){
    en.damage(1);
    en.setVelocity(v2.subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue));
}

@EventHandler
public void onPlayerHitPlayer(EntityDamageByEntityEvent event) {
    if (event.getDamager() instanceof Player && event.getEntity() instanceof Player) {
        heatValue++;
        LivingEntity en = (LivingEntity) event.getEntity();
        Vector v2 = en.getLocation().toVector();

        if(heatValue >= 8){
            ArtificialHit(en,v2,event);
            try
            {
                Thread.sleep(1000);
            }
            catch(InterruptedException ex)
            {
                Thread.currentThread().interrupt();
            }
                 ArtificialHit(en,v2,event);
                }
            }
        }
    }
tardy delta
#

never let the thread sleep

tender shard
#

WTF

carmine valley
#

why not?

tardy delta
#

?scheduling

undone axleBOT
tender shard
#

Thread.sleep on the main thread?!

#

are you serious lol

tardy delta
#

cuz it will the block the whole main thread

tender shard
#

that will stop the whole server for one second

carmine valley
#

what should I do instead?

carmine valley
#

is there no other way but that scheduler :<

tardy delta
#

no

tender shard
#

well yes

#

you can create your own thread lol

#

but what's wrong with the scheduler

tardy delta
#

but the scheduler uses a pool of thread and thats faster

carmine valley
#

well, how about if I replace the damage() with an invisible explosion. wouldn't that knock the player back more?

tender shard
#

no

carmine valley
#

all I'm trying to do here is knock back more than 18 blocks

humble tulip
#

If it has a max velocity

carmine valley
#

I really didn't think it'd be that complicated

humble tulip
#

U can't hit the player back more than that

tender shard
#

what's the problem with using the scheduler?

humble tulip
#

Just tp the player small amounts

carmine valley
#

with the scheduler?

#

:/

tender shard
#

yeah in a repeating task

carmine valley
#

fineeee I will see what's that all about

tender shard
#

or apply the velocity over and over again

carmine valley
humble tulip
#

Yeah

#

U can apply a small velocity for x number of ticks maybe

carmine valley
#

why didn't you guys tell me from the beginning lol

tender shard
#

well you said that there's a max velocity for players. I haven't checked that, but if it's true, then you can simply apply the velocity every tick until you've pushed them far enough

humble tulip
#

Let x be the multiplier

tender shard
#

it's a dirty workaround at best

carmine valley
#

all I asked for is any way to knock the player more than 18 blocks

tender shard
#

yeah but you only said 1 minute ago that there's a hardcoded velocity limit for players

#

I didn't know that before

carmine valley
#

a guy yesterday told me that knockback is handled by the client not the server

#

that's why it knocks entities back more than 18 blocks but not players

carmine valley
carmine valley
tardy delta
humble tulip
#

I said it made sense if kb is handled by the client

#

Cuz antikb exists

tender shard
humble tulip
#

bzzz

dreamy arrow
#

bash: mvn: command not found

tender shard
#

yeah you need to have maven installed

dreamy arrow
#

that'ss wat it says@tender shard

carmine valley
#

just to be clear, does setVelocity ACTUALLY do the kb or does it sit how much kb the player will get the next time they are hit?

dreamy arrow
#

oh

ivory sleet
tender shard
#

but tbh my idea probably won't fix anything anyway

dreamy arrow
#

where to download from

tender shard
#

have you tried deleting EVERYTHING besides BuildTools.jar then try again?

compact haven
dreamy arrow
#

tried

compact haven
#

it has nothing to do with the knockback mechanism

carmine valley
compact haven
#

correct

carmine valley
#

the name is kinda deceiving

compact haven
#

it's really not lmao

carmine valley
#

I mean it's like setting a value, not actually doing a push

compact haven
#

you are setting a value

#

the effect is like a push, in certain situations

#

for example if they enable fly right after setVelocity(), their velocity is something like 0.55 or some shit

#

it fluctuates, Minecraft handles velocity. when you setVelocity, you're overriding hte previous velocity and the one you set is completely up to the circumstances of the world

#

if they are "pushed" into water, they might stop immediately

ivory sleet
#

^the velocity is a vector which can be seen as a force which translates into some sort of acceleration

compact haven
#

exactly that, when you call setVelocity, you're just overriding the previous value & it'll change from right after you set it

carmine valley
#

oh wow, thanks for the clarification

gleaming olive
#

can I make a zombie hit twice per second in 1.8.8?

vocal cloud
#

You can make a zombie hit twice in any version lol. Subtract health kek

midnight shore
#

What happens if I set the velocity of a player continously to 0,1,0 and then I set it in another method to 1,0,0?

gleaming olive
#

i dont want double damage
i want double attack speed
but that's only for players and not mobs

compact haven
#

tias

clever musk
carmine valley
tardy delta
#

yes

#

lmao use the scheduler

carmine valley
#

why I'm not using the scheduler is because I'm a bit short on time and I don't want to delve into something completely new to me

tardy delta
#

schedule the 2nd after some time with the scheduler

woeful crescent
#

what would happen if i set a repeating task with the wrong plugin? as in the plugin that does not contain the code for the task?

tardy delta
#
Bukkit.getScheduler().runTask(plugin, () -> {
  // set thing
}, seconds * 20);```
carmine valley
compact haven
tardy delta
compact haven
#

you need to use one of the two existing implementations, ExactChoice or MaterialChocie

tardy delta
woeful crescent
#

if one plugin disables my entire server is broken anyways haha

compact haven
#

at least I'm about 99.99% sure that it won't work, but it definitely doesn't mean it's law to not implement that class

carmine valley
woeful crescent
#

the program wants ticks. you are giving it seconds * 20, because there are 20 ticks in a second.

tardy delta
tardy delta
#

so 20 would be after a second

humble tulip
#

That'll freeze the server

compact haven
#

I assume he means a scheduled repeat

#

in any case, he just needs to try it and see

carmine valley
#

so if I do it like that ```cpp

if(heatValue >= 8){

Bukkit.getScheduler().runTask(plugin, () -> {
}, 2); damaged.setVelocity(damagedV.subtract(event.getDamager().getLocation().toVector()).normalize().multiply(heatValue));
}

compact haven
#

also keep in mind, 20 ticks = 1 second is the perfect case, there are cases when 4 ticks is 1 second

#

it all depends on what the server is doing at the moment

tardy delta
#

4 tps lmao

compact haven
#

exactly

fierce hawk
#

Hello. I am trying to use the ArmorEquipEvent (https://github.com/JEFF-Media-GbR/ArmorEquipEvent) to give a potion effect when a specific player head is equipped. And also to remove a potion effect when the player head is unequipped. What I have below works with recently created player heads. If a player leaves the game with the player head in their inventory, the player head will get "deactivated" meaning the potion effect will not be given.

if (event.getNewArmorPiece().getType() == Material.PLAYER_HEAD) {
    String texture1 = getBase64Skin((SkullMeta) event.getNewArmorPiece().getItemMeta());
    String texture2 = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTgxODUyOTQzZTM2YzhhM2YxZTNkMGU0OTEyNTQ5Y2JjMjA1ZDk0NzM5NGFkYmU2NWY0ZDgxZDYxMWJlMmM4NyJ9fX0=";
    if (texture1 == texture2) {
        event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 999999, 2, false, false));
    }
}
carmine valley
#

what do I fill as plugin in the scheduler? my main? or my Knockback class?

#

even when the scheduler is in the knockback class right? just making sure

carmine valley
#

thanks

undone axleBOT
carmine valley
fierce hawk
#

That fixed it. Thank you.

carmine valley
#

so ```cpp
new MCBrawl

#

I read the documentation, just make a method and a variable and make the method set the variable plugin?

#

oh a constructor?

#

I did it like that in main: getServer().getPluginManager().registerEvents(new Knockback(), this);

#

wouldn't that point to the main class?

#

oh I see

limber owl
#

this points to the class that you're using it in

tardy delta
#

knockbock

limber owl
#

this doesn't pass constructor, it passes the class

tardy delta
#

knock knock who's there

limber owl
#

thats okay

#

how can I disable pvp for player in 1.8

carmine valley
#

I'm confused, Knockback class isn't accepting the private Plugin

#

I did

limber owl
tardy delta
#

?di

undone axleBOT
carmine valley
#

it gives me a 1 related problem

#

in main

tardy delta
#

pass 'this' in as constructor param

iron glade
#

no need to use this.plugin, you can just do plugin

tardy delta
#

which refers to the current instance

#

imagine using this.variable

carmine valley
#

Confusion 100

iron glade
#

not for me

carmine valley
#

step by step please, first I make a private plugin variable right?

limber owl
#

hey, please show us the code you're making

carmine valley
#

in Knockback class

tardy delta
#

my brain went brr when i wrote if (this.datasource != null && this.datsource.isClosed())

undone axleBOT
iron glade
#

if I access the main class 50 times I'd write out "this." 50 times unnecessarily

limber owl
#

and everyone, he can't pass in this, in class that doesn't extend JavaPlugin class for parameter that asks for JavaPlugin

carmine valley
limber owl
carmine valley
#

I didn't put them, they caused errors and didn't understand what you guys were saying

tardy delta
#

i mean

carmine valley
tardy delta
#

i told you what to do

#

lmao

iron glade
#
private McBrawl plugin;
public Knockback(McBrawl plugin) {

this.plugin = plugin;
}```
limber owl
#

like this:

private static JavaPlugin instance;

onEnable() {
  instance = this;
}

public static JavaPlugin get() {
  return instance;
}