#help-development

1 messages ยท Page 2203 of 1

chrome beacon
#

So what have you tried?

trail bluff
chrome beacon
#

Also looks like unmapped

trail bluff
#

I know that I need to send a packate with metadata, but I don't fully understand how to do it, and Google does not have anything specific about this for version 1.18

chrome beacon
#

You won't have setGravity() but a(), b() or c() and simillar

trail bluff
#

Version is 1.18

chrome beacon
#

I recommend using mappings so you don't have to use unmapped method names lile that

quaint mantle
#
@EventHandler
    public void onThunderSword(EntityDamageByEntityEvent e) {
        ItemStack thunderSword = CustomItems.createThunderSword();


        if(!(e.getDamager() instanceof Player)) return;
        Player player = (Player) e.getDamager();

        player.sendMessage("event triggerer is player");


        if(player.getInventory().getItemInMainHand().equals(thunderSword)) {
            player.sendMessage("you can strike!");

            e.getEntity().getWorld().strikeLightning(e.getEntity().getLocation());
        }

    }```
how come this if statement never fires?
chrome beacon
#

Well is it the same item

quaint mantle
#

it should be ahaha, my main hand is the thunderSword itemstack

sage merlin
#

why is getCommand(String) null

chrome beacon
chrome beacon
sage merlin
#

i did tho

chrome beacon
#

Check for typos

sage merlin
quaint mantle
naive bolt
#

on item pickup whats the best way to only send the message once not like 1000 times

chrome beacon
#

add a cooldown with a map and timestamp

chrome beacon
chrome beacon
#

?pdc

sage merlin
glass fog
#
#

Thanks!

quaint mantle
carmine valley
vocal pine
#

Another Minecart question - there's an extremely strange segment in AbstractMinecart fn MoveAlongTrack that makes zero sense to me; https://paste.md-5.net/havakilaye.cpp

It seems to make X & Z coords 50% bigger if it's moving along an axis and set position of Cart to there
On a corner it works out to put it in a different place on the rail (Which still seems strange because there's no check for direction)
(From testing it rewritten in Python with Minecart coord at 100.5, 100.5 (middle of block) and Rail coord at 100,100)

Can someone help me work out what this part actually does because I'm at a loss all day

The only way it makes any sense to me would be if Java does not use BIDMAS but I'm pretty sure it actually does?

sage merlin
#

for some reason none of my commands are doing anything

#

im running all these commands and nothing happens and i don't get a error

buoyant viper
#

are they registered in plugin.yml

sage merlin
#

and i did set the executor

sage merlin
tardy delta
#

Why are you checking if An empty set contains a player?

iron glade
#

please tell me you use ignoreCase

#

and if so it's even weirder that the L is uppercase

granite owl
misty current
#

can you set the velocity of an AOE cloud? I am but it seems to have no effect on the entity

naive bolt
#

how do i make this return the sub commands so they auto complete

#

like that

#

but commandname

humble tulip
#

u gotta make the class implement tabcompleter

#

and implement that

#

honestly, tho bukkit command system is horrible, use something like afc or lamp

tardy delta
#

I guess you want a map for subcommand lookup

naive bolt
#

maybe i should

humble tulip
#

u really should

dusk flicker
#

anything but the bukkit command system

#

its horrible

tardy delta
#

Just return a list of subcommands it should return

#

Based on the args length

naive bolt
humble tulip
#

that's what it looks like using lamp

tardy delta
#

Let your class implement tabcompletor

#

And return it in the only method it has

naive bolt
#

yea i did that

humble tulip
#

u gotta reutrn a list<string>

#

not list<subcommand>

#

can i see what ur subcommand class looks like?

naive bolt
vocal pine
#

Strange segment in AbstractMinecart fn MoveAlongTrack that makes zero sense to me; https://paste.md-5.net/havakilaye.cpp

It seems to make X & Z coords 50% bigger if it's moving along an axis and set position of Cart to there
On a corner it works out to put it in a different place on the rail (Which still seems strange because there's no check for direction)
(From testing it rewritten in Python with Minecart coord at 100.5, 100.5 (middle of block) and Rail coord at 100,100)

Can someone help me work out what this part actually does because I'm at a loss all day

The only way it makes any sense to me would be if Java does not use BIDMAS

humble tulip
# naive bolt

u can do subcommands.stream().map(SubCommand::getName).collect(Collectors.toList());

naive bolt
#

just trying it. You are amazing

#

it does keep completing forever but thats not a huge deal

#

how can i pass this through to the sub command

iron glade
#

guys Idk if I'm dumb or what but I have a

HashMap<UUID, UUID>``` and this listener ```java
    public void onSelectedPlayerLeft(PlayerQuitEvent e) {

        UUID target = e.getPlayer().getUniqueId();

        Iterator<UUID> iterator = plugin.trollManager.cachedTrollPlayers().keySet().iterator();

        while (iterator.hasNext()) {

            if (plugin.trollManager.cachedTrollPlayers().get(iterator.next()).equals(target)) {

                Player troller = Bukkit.getPlayer(iterator.next());

                plugin.guiManager.openPlayerSelectGui(troller);

            }


        }

    }``` why does this stop after it finds the first match?
harsh totem
#

Attribute

quaint mantle
#
public static void addRecipeThunderSword() {
        ItemStack thunderDustItem = CustomItems.createThunderDust();
        ItemStack thunderSwordItem = CustomItems.createThunderSword();
        ItemStack magicDustItem = CustomItems.createMagicDust();

        ShapedRecipe sr = new ShapedRecipe(NamespacedKey.minecraft("thunderswordcraft"), thunderSwordItem);
        sr.shape("DGD", // Dust, Glass, Dust
                 "GMG", // Glass, Sword, Glass
                 "DGD");// Dust, Glass, Dust
        sr.setIngredient('D', new RecipeChoice.ExactChoice(thunderDustItem));
        sr.setIngredient('G', Material.WHITE_STAINED_GLASS);
        sr.setIngredient('S', new RecipeChoice.ExactChoice(magicDustItem));
        Bukkit.getServer().addRecipe(sr);

    }```

java.lang.IllegalArgumentException: Symbol does not appear in the shape:83

whats wrong with my recipe?
tardy delta
#

Don't see An S

quaint mantle
#

oh wait whattt, im blind mb lmao

tardy delta
#

Read stacktraces

quaint mantle
#

FurnaceRecipe fr = new FurnaceRecipe(NamespacedKey.minecraft("magicpowderfurnace"), magicPowder, new RecipeChoice.ExactChoice(poisonPowderItem), 1.0f, 40);

now i have a list of items that can be inputs for the furnace but how do i get that list as the input?

crisp steeple
#

you could use a foreach

#

or just store iterator.next() in a variable but both methods are effectively the same

wind tulip
#

Anyone know why my IDE is not recognizing the Player#openAnvil(loc, b) method?

quaint mantle
#

Bro I need the index of the outset x the index how do I do that with offset

iron glade
# crisp steeple it calls iterator.next() 2 times

ty, I ended up using this and it works now

    public void onSelectedPlayerLeft(PlayerQuitEvent e) {

        UUID target = e.getPlayer().getUniqueId();

        plugin.trollManager.cachedTrollPlayers().keySet().stream().forEach(uuid -> {

            if(plugin.trollManager.cachedTrollPlayers().get(uuid).equals(target)) {

                plugin.guiManager.openPlayerSelectGui(Bukkit.getPlayer(uuid));

            }

        });

    }```
crisp steeple
#

gg

iron glade
#

Kinda funny it took me an hour

#

to figure this out

#

I really didn't see the error with the iterator thing

#

even tried a for loop

covert karma
#

whats the simplest way to raycast into the direction the player is looking and getting

  1. the block face that was hit
  2. the entity that was hit
#

i tried using BlockIterator but it just returns a Block object

meager mantle
#

Hello, could someone help me with something?
I am making a plugin in which I need to check if the user has a permission, but this permission is based on a "list" so to speak, which would be in the config.yml divided by groups, something like:

  default:
    - "text"
  vip:
    - "text vip"
  admin:
    - "text admin```
#

but what happens is that I want more groups to be added in the config.yml and with this a new permission would be created, example

  • testpermission.default
  • testpermission.vip
  • testpermission.admin
humble tulip
#

put subcommands.add(new SubCOmmand) in the constructor that takes the plugin as an arg and remove the constructor with no args

iron glade
humble tulip
#

trollmanager and whatnot

#

getTrollManager

misty current
#

?

granite owl
#

?

#

๐Ÿค”

misty current
#

just setting the velocity of an AOE cloud

#

the entity

granite owl
#

of what

misty current
#

setting the velocity of the entity called "AreaEffectCloud"

granite owl
#

how do you set an entities velocity

iron glade
granite owl
#

nvm

iron glade
#

eventhough it does work

humble tulip
#

youre probably adding or removing from a list while iterating

granite owl
#

but id suppose just as u can call setOp on an OfflinePlayer but it will fail

#

this may also apply to other api parts

misty current
#

setVelocity is a method from the Entity interface

granite owl
#

oohh

tender shard
quaint mantle
#

alex can you check sumtin for me

pastel juniper
#

Is there an easy way to make player tab show player display names???

sturdy reef
#

i tried using ActionBarApi but i get this error everytime i run the plugin

vocal pine
#

my entity has gone back to turning into a regular minecart on unload/reload DESPITE being a registered entity.. was fixed for a while but noo

i do know that it doesn't do this if i don't super the minecart entity type (but instead its own) - but then clients see it as a pig

so it seems like the better fix is to make clients see it as a minecart while the server doesn't

anyone know how i set the network ID of custom entity to appear as something else instead

sturdy reef
#

i added the file to the Modules

#

on intellji

#

but nothing happend

#

wdym by that

ivory flume
#

does PostLoginEvent from bungeecord only run when the player logs into the network? and wont' trigger as players switch servers?

vestal dome
#

how to delay ServerConnectEvent?

ivory flume
#

wdym delay

sturdy reef
#

?scheduling

undone axleBOT
ivory flume
#

thats bukkit api

#

ServerConnectEvent is bungeecord

#

you could force players, on swithcing servers, to use some command you made to switch servers

#

and delay that

sturdy reef
#

what is the dependency for actionbarapi

#

because i added the jar file into my project but i get this

#

package com.connorlinfoot.actionbarapi does not exist

fair sable
#

Hello, I am getting kicked from server when I try to send entityEquipment packet. When entityId is armor stand it works but when it is same player: https://cdn.discordapp.com/attachments/984344319643246632/984549369401475192/unknown.png

public class EntityEquipmentPacket extends AbstractPacket {

    private final ItemStack helmet;

    public EntityEquipmentPacket(int entityID, ItemStack helmet) {
        super(entityID, PacketType.Play.Server.ENTITY_EQUIPMENT);
        this.helmet = helmet;
    }

    @Override
    public @NotNull
    AbstractPacket load() {
        packetContainer.getIntegers().write(0, entityID);
        packetContainer.getSlotStackPairLists().write(0, Collections.singletonList(new Pair<>(EnumWrappers.ItemSlot.HEAD, helmet)));

        return this;
    }
}

AbstractPacket class just does some very simple setup so it shoudnt matter.
Any idea what I am doing wrong?

ivory flume
#

whats the difference between getServer().sendData and getServer().getInfo().sendData

#

oh you know what i don't even care nm

vestal dome
#

They just joined the network

#

and they are connecting* to that serer.

#

server*

#

I want to delay the event so I can load their data before they join

#

the under server has to have the data already loaded on Redis by the time they join the server.

pliant oak
#

what is the sing sound effect when you hit someone with a bow?

humble tulip
devout cosmos
#

How can I force a player's compass target to spin as if not in the overworld? Setting the location's world doesn't work and just points to the same coords in the current world

ivory flume
#

when using ServerConnectedEvent, using event.getPlayer().getServer().sendData returns a null server

#

is there a way to get a non-null server

#

when I do event.getPlayer().sendData, it doesn't send for some reason so i'm trying this but its notw orking

devout cosmos
# minor fox Which location are you altering

Another player's location, if the second player is in the nether and the first is in the overworld, the first's compass points to the players nether coords but in the overworld

radiant cedar
#

how can I seperate this into

slim brook
#

Hi ! I have a problem with my code. When I want get item.getItemMeta().getDisplayName() in my PlayerItemConsumeEvent I get the good name but when I did this condition if (item.getItemMeta().getDisplayName() == ChatColor.GOLD + "โˆ "+ ChatColor.YELLOW + "Ramens" + ChatColor.GOLD +" โˆ") { p.sendMessage("Vrai"); } else { p.sendMessage("Faux"); } And i Ate the item this say me "Faux" (false). But in check it's the same name

#
        p.sendMessage(item.getItemMeta().getDisplayName());```
#

Someone have idea ?

vocal cloud
#

Never rely on item names for validation

#

Use PDC

slim brook
#

PDC ?

vestal dome
#

Persistent data container

vocal cloud
#

?pdc

vestal dome
#

OR

#

NBT API

slim brook
vestal dome
vocal cloud
#

NBT API for outdated versions

vestal dome
#

doesn't matter

rugged cargo
#

it is so useful, and not very difficult to learn

vestal dome
#

it works on newer too

past sage
#

Looks like one got made - https://github.com/SpigotMC/BungeeCord/issues/3327
It's not been documented anywhere, but BungeeCord 1.19 has an API breakage - it's not possible to use the chat passthrough .chat() feature.

GitHub

16:12:01 [SEVERE] Task BungeeTask(sched=net.md_5.bungee.scheduler.BungeeScheduler@246f8b8b, id=14238, owner=net.william278.huskchat.bungeecord.HuskChatBungee@7eb9bffa, task=net.william278.huskchat....

vocal cloud
#

Does matter. Don't need it

slim brook
#

I use 1.8 version

vestal dome
#

you need it

#

you don't know what owners are going to use

slim brook
#

?nbt API

vestal dome
#

they might use 1.7 if they're stupid very legacy players or 1.19 if they enjoy the new terrain.

#

at least 1.12, some servers are using

vestal dome
#

and PDC didn't exist back then (on the bukkit api)

rugged cargo
#

you cant please everybody

vocal cloud
#

Well if you're forced to use an outdated version then you'll need to use NBT API

ivory sleet
#

๐Ÿ’€ legacy versions

ivory flume
#

there was an NBT api?

vestal dome
ivory flume
#

why did that get taken out

vestal dome
#

no no no

vocal cloud
rugged cargo
#

i think pdc replaced it. pdc is great to use. nice api

vestal dome
#

it can't

#

NBT is the base of minecraft..

#

NBTAPI adds access to NBT.

#

PDC also adds access to nbt (as far as I know)

devout cosmos
# minor fox May I see code?
                                    @Override
                                    public void run() {
                                        if (Plugin.isRunning() && Plugin.target != null) {
//                                            for (ItemStack compass : Plugin.compasses) {
//                                                
CompassMeta compassMeta = (CompassMeta) compass.getItemMeta();
//                                                Location targetLocation = Plugin.target.getLocation();
//                                                compassMeta.setLodestone(targetLocation);
//                                                Bukkit.getLogger().info("Location: " + targetLocation.toString());
//                                                compass.setItemMeta(compassMeta);
//                                            }
                                            for (Player player : Plugin.hunters) {
                                                Location location = Plugin.target.getLocation();
                                                if (location.getWorld() == player.getWorld()) {
                                                    player.setCompassTarget(location);
                                                } else {
//                                                    player.setCompassTarget(null);
                                                    player.setCompassTarget(player.getLocation());
                                                }
                                            }
                                        }
                                    }
                                }.runTaskTimer(Plugin.getPlugin(Plugin.class), 1l, 1l);```
#

lmao why'd it format it like that

rugged cargo
vocal cloud
#

?paste use pastebin

undone axleBOT
vestal dome
#

So uhh.

#

Yeah let me write a paragraph 1s

ivory sleet
minor fox
ivory sleet
#

You'd have to do sth like JavaPlugin.getPlugin(YourMainPluginClass.class)

#

(not Plugin)

ivory flume
#

i guess the separation of vanilla nbt and having PDC for plugins is nice..

ivory sleet
#

wait

#

your class is called Plugin?

devout cosmos
#

yeah

ivory sleet
#

lol nvm then

devout cosmos
#

its what i name the main class for all my plugins

ivory sleet
#

tho unlikely mojang would ever switch from their current nbt system

vocal pine
#

soo i have a fun question for u guys, i have a registered custom entity and i'm making item to spawn it
it passes itself to the superclass in it's constructor
however i have no idea what i need to pass to it in the spawn item (in place of EntityType.MINECART) and/or do in the loc argument constructor to super this

vestal dome
#

So, I have a PostLoginEvent listener, and I connect the player on the event itself, and so I have a ServerConnectEvent, so the question is, how can I delay the Event? I have to delay it to load the data to redis so the server under the bungeecord has the data.

#

[Bungeecord btw] <- not new but maybe someone doesn't know.

minor fox
eternal night
ivory flume
#

its a different event from Connect

rugged cargo
vestal dome
#

ServerConnectEvent is called when a connection is going to be made.

#

ServerConnectedEvent is after the connection has started.

#

if it's connected already, it's terrible..

#

because I cannot load it fast enough

ivory flume
#

why?

vestal dome
#

because I'm running against time?

#

bruh??

ivory flume
#

if the player is already connected, you can just use the data you sent to the server to now do whatever you need?

vestal dome
#

the POINT IS THAT

#

the DATA IS NOT LOADED.

#

it's loaded ON CONNECT.

eternal night
ivory flume
#

why do you need the data specifically at that time

rugged cargo
vestal dome
#

because I'm making a server where the servers can be offline and online at different times

#

the servers have to have the data already loaded at the time that the connection IS BEING DONE, it's not after.

#

because after, the server did not find the data, already threw 50 NPE's and life's not good.

vocal cloud
#

Then do it on the main thread so it delays it?

vestal dome
#

or LNG instead of LG

minor fox
vocal cloud
#

Oh boy aren't you the person who s trying to pair online and offline players?

vestal dome
#

because it's way more effective.

minor fox
#

Are you loading data from the DB to redis on bungee so that the backend server can access only redis?

sterile token
#

Why "Plugin" with cappital letters its hurts my eyes*

eternal night
vestal dome
eternal night
#

three lines later you have a server error with no trace of a plugin mutating anything

rugged cargo
silent vigil
#

Im trying to make a clickable message, and if clicked run a method, this is the code I have rn, any ideas?

player.sendMessage("Confirmation message.",
                                "Do you want to confirm?");
                        TextComponent message = new TextComponent ("Yes");
                        message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/command"));```
sterile token
vestal dome
#

the point is simple

#

how to delay ServerConnectEvent

#

it doesn't matter how why, what, or anything else.

minor fox
#

You can't just delay it

#

You need to freeze the whole main thread

vocal cloud
#

By running your code in the event? Unless the event is async

sterile token
minor fox
vocal cloud
#

If the event is async your solution is quite simple. Write yourself a fork.

sterile token
vestal dome
vocal cloud
#

No clue I'm asking you?

sterile token
minor fox
sterile token
#

Oh

#

Fuc** i dont know why i didnt do that before

vestal dome
ivory flume
#

isn't that kinda how the Log4J vulnerability orked

vestal dome
ivory flume
#

but not with gson

sterile token
#

Gson#from(String, Class) => Object
Gson#toJson(Class) => String

vestal dome
#

or use a lib Like Jackson

vocal cloud
vestal dome
#

I'm not complaining I'm asking how. And I really don't know, because Bungee is multi-thread (well uses multiple of them)

#

so I'm confused on how I should do things

minor fox
#

The reason I asked the initial question was because I think you have a flawed design/approach to the problem @vestal dome

vocal cloud
#

?jd

ivory flume
#

yes, and you get aggresive when we try to find out why

upper tendon
#

What's the best way to save data (like inventories and stuff) to files?

vocal cloud
#

Looks async to me

#

I still don't get why it needs to be so urgent lol

ivory sleet
#

but like

#

many of the player connection related events are synchronous to the connection

#

like with in spigot AsyncPlayerPreLoginEvent, the player cannot login until the event is handled

vocal cloud
#

I don't understand the urgency

vestal dome
ivory sleet
#

but its still asynchronous in relation to the server thread

vestal dome
ivory sleet
#

myes

#

idk what you're doing but yeah most events fired on the proxy is async

ivory flume
#

hello, i run PostLoginEvent to run this code:

            e.getPlayer().sendData("BungeeCord", out.toByteArray());

like im sending data to the server, but it's not working. any way to send packs on the moment the player joins? i want it to run only when th eplayer logs in and not when it switches servers

ivory sleet
#

or well, in relation to other processes happening

#

when the post login fires the player connection has yet not been fully established iirc

ivory flume
#

i added this bit

ProxyServer.getInstance().getScheduler().schedule(Main.getInstance(),
                () -> {
            e.getPlayer().sendData("BungeeCord", out.toByteArray());
            Main.getInstance().getLogger().info("SecondStar received connected event from: " + e.getPlayer().getDisplayName() + ", sending pack...");
                },
                1,
                TimeUnit.SECONDS
        );
#

so that it waits a second

ivory sleet
#

mye

#

is ready to be connected

vestal dome
#

iirc?

ivory sleet
#

if I remember correctly

ivory flume
#

yeah liek conclure might be wrong

humble tulip
#

Conclure is genius

ivory flume
#

so it might also be that he might not be on the server yet

#

which is why im waiting a second

#

it appears to be that is also what Bungee Resource Packs do

vestal dome
#

well if I call a connect event on PostLoginEvent it should take over the priority right??

ivory sleet
#

you have to remember bungee is a proxy

#

like sure the player does connect to the proxy, but that does not inherently imply the player is suddenly connected to backend as well

ivory flume
#

is there an event for like the first time the player is logged in and connects to a "backend"

ivory sleet
#

ServerConnectedEvent probably

#

believe it even says plugins can use it to send info

ivory flume
#

but does it run if you switch servers?

#

i hope not

ivory sleet
#

yes but then check if it was initial

ivory flume
#

huh

ivory sleet
#

yeah

ivory flume
#

wdym check if it was initial

ivory sleet
#

check with sth like ProxiedPlayer::getServer == null

#

might be you wanna use the pending connection instead

#

but you get the point

ivory flume
ivory sleet
#

basically

#

if I remember bungeecord correctly thats how it works

#

or if im just mixing this shit up with velocity

#

altho their designs are to some extent identical

ivory flume
#

i do want to use velocity one day but my server doesn't really need either or

#

im fine with either as long as they work

ivory sleet
#

yeye

rugged cargo
#

does having entities with large amounts of PDC data have any negative effects for the server?

#

by large amounts i mean like 10-15 different "attributes"

ivory sleet
#

probably not

ivory flume
#

didn't work, gonna try e.getPlayer().getServer().getInfo().sendData("BungeeCord", out.toByteArray()); instead

rugged cargo
#

k, im probably being more conscious of the server's performance than i need to, but my plugin seems "heavier" than some others. i could be wrong though. thanks for the answer though

ivory flume
#

you could try spark to get to see what your plugin does

#

just put it on the server and run the profiler for CPU profiling. also has a way to check the heap summary

vocal pine
#

Got two kind of complex questions about custom entities:

  1. I have it registered - In my item spawn I need to pass it's entity type to the constructor but when I try to get it from the registry I get a type mismatch, not really sure how I get it from the registry (it's summonable so I'm trying to work back from that but not finding anything useful)
  2. Because it is it's own type, clients see it as a pig - How do I give network ID of a Minecart
rugged cargo
#

well ok. so i did find one metric

#

that plugin alone is 3.4 MB, and my plugin is 98K

#

lol

ivory flume
#

its not meant to be included in your plugin

rugged cargo
#

just as a plugin itself. i got that.

ivory flume
#

i think, i've only used it on my server

rugged cargo
#

i was just comparing file sizes, and was surprised

ivory flume
#

ยฏ_(ใƒ„)_/ยฏ

rugged cargo
#

huh. i guess its just my computer. the profiler says the server is fine.

eternal night
#

I mean, your PDC lives in memory

#

and needs to be loaded from file

#

that is about it

#

but as with any in-memory storage solution, if you trash it with giant data sets that is on you

rugged cargo
#

every get a good idea for your plugin and have absolutely zero idea of how to approach it at all?

#

i do!!! :)

humble tulip
rugged cargo
#

:) my issue is more of a plugin architecture problem, but some research won't hurt

humble tulip
#

What're you trying to do?

rugged cargo
#

trying to make a plugin inspired by Tinkers' Construct, but with a few interesting twists in how upgrading the tools works

#

right now im trying to implement a fuel system for the upgrades, and ive got most of it. just missing one small piece.

river oracle
#

https://pastebin.com/ePprMPVN does anyone know why I would be getting a class not found error here? I'm just messing with nms and I'm curious why It works when I statically access the class,but if i instantiate the class I get a class def not found error its quite odd

normal isle
#

I am trying to add conditions to my plugin

#

Any idea what could be causing this?

river oracle
#

your onPlace event

#

has some wrong logic

rugged cargo
#

No! ๐Ÿคฃ

humble tulip
#

?paste

undone axleBOT
normal isle
#

Ye sure 1 sec

#

Might take a while

#

My pc and net are lagging

quaint mantle
#

No!

normal isle
#

Here

rugged cargo
# quaint mantle No!

i dont know why i found that so funny! i watched it 5 minutes ago and im still laughing ๐Ÿคฃ

quaint mantle
normal isle
#

No this is like an addon to oraxen

#

Like conditions

#

This custom block can be only placed on thos block

#

And only this block

#

But somehow

#

Its reversed

quaint mantle
delicate lynx
#

why does your if statement check dirt twice

#

and use == and not equals

rugged cargo
#

that else if is the problem. i agree with hyper

#

oh wait, the else if actually happens... i didn't look enough

quaint mantle
#
if (preventType == event.getBlockPlaced().getType() && placedOnType == event.getBlockAgainst().getType()) {
    event.setCancelled(true);
    player.dostuff
}
normal isle
#

Ok thx

#

I will notify if it works

quaint mantle
#

it will

rugged cargo
#

that looks good to me. lol, the confidence is great

#

well. i just realized my idea isn't thought out enough... oops

normal isle
#

It works

#

Thx

normal isle
#

๐Ÿ‘๐Ÿ‘„๐Ÿ‘

rugged cargo
#

#notcreepy

quaint mantle
#

#verycreepy

#

what the fuck

humble tulip
#

๐Ÿ‘€

normal isle
#

๐Ÿ‘ ๐Ÿ‘
.๐Ÿ‘ƒ.
.๐Ÿ‘„.

coarse finch
#

anyone know if papi has 1.19 builds, so i can test?

quaint mantle
#

doesnt seem so

coarse finch
#

sad

quaint mantle
silent vigil
#

Hey guys, im trying to open an inventory (specifically by a method), when a specific message in chat is clicked, anyone know how to do that?

rugged cargo
#

some recent activity. not dead!

quaint mantle
silent vigil
#
                        TextComponent message = new TextComponent ("Yes");
                        message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/command"));``` how would I be able to implement that here?
#

can I replace the run command?

quaint mantle
#

?jd-b

#

nice

silent vigil
#

wut?

quaint mantle
#

?jd-bc

silent vigil
#

??

quaint mantle
#

its not for you

#

not yet atleast

silent vigil
#

oh ok sorry

quaint mantle
#

i cant find any docs on textcomponent

#

are you on an outdated version?

compact wigeon
#

Hey, I have a plugin that I created that I would like to separate into two different plugins as it would make more sense to do so. I'm currently using a relational database to store player settings, but was wondering if I could get some advice on how to proceed. Should I use the same database for both plugins? Or should I use separate databases? Or is there something better to do that I am unaware of (something like accessing my database class from the new plugin)? Thanks!!

silent vigil
devout canyon
quaint mantle
#

?jd

quaint mantle
#

ohhh bungeecord chat is separate

dusk flicker
#

?jd-bcc

dusk flicker
#

dummy

quaint mantle
#

fuck u too babes

dusk flicker
#

โค๏ธ

quaint mantle
#

wish i could change your nickname

#

i can

dusk flicker
#

dont you dare

quaint mantle
#

but it would be "mod abuse" ๐Ÿ™„

dusk flicker
#

you aint a mod

#

so it wont be mod abuse

quaint mantle
dusk flicker
#

too bad

#

helper

quaint mantle
#

my knucles are infinitely strong

normal isle
quaint mantle
#

i punched a dent into my dresser

dusk flicker
#

hehe

#

i give you permission to change my nickname

quaint mantle
#

not .equals

normal isle
#

What?

quaint mantle
#

enum variants are constants

normal isle
#

Same thing

quaint mantle
#

no

#

you must obide by what i say

#

kidding

#

but its frowned upon to call .equals on constants, like enum variants

normal isle
#

I did exactly what you did

#

Nothing changed

quaint mantle
#

ik

#

its just a code smell

normal isle
#

Hmm

#

Bruh

#

Hiw can i fix it

quaint mantle
#

also

#

do what i said

#

why are you listening to PlayerInteractEvent

dusk flicker
#

java doesnt ignore shit

#

unless you tell it to ignore shit

quaint mantle
#

^

#

@normal isle instead of using the event specifically designed for things like this, you cheat your way into it

dusk flicker
#

L

dusk flicker
#

2

dusk flicker
#

3

quaint mantle
#

gave you the answer

quaint mantle
dusk flicker
#

fuck you

quaint mantle
#

โค๏ธ

dusk flicker
#

โค๏ธ

normal isle
#

?

#

It simply dosent work

#

I did exactly what you told me

quaint mantle
#

no the frick you didnt

humble tulip
#

Just making sure, inventoryclickevent and inventroydragevent is enough to stop ALL inv modification?

quaint mantle
#

inventoryinteractevent can substitute both of those

humble tulip
ivory sleet
#

Nope

humble tulip
#

so i have to listen to both

ivory sleet
#

Yep

quaint mantle
ivory sleet
#

No it doesnโ€™t have static getHandlerList method for one

humble tulip
#

๐Ÿ‘€

#

oh it atcually doesnt have a handlerlist

#

ig it isnt called then

quaint mantle
#

im gonna check something

ivory sleet
#

Itโ€™s basically gonna end up exploding like if you were to listen to Event or PlayerEvent etc

quaint mantle
#

i know that

#

ive tried

#

didnt work so well

ivory sleet
#

Ye

river oracle
#

https://pastebin.com/ePprMPVN does anyone know why I would be getting a class not found error here? I'm just messing with nms and I'm curious why It works when I statically access the class,but if i instantiate the class I get a class def not found error its quite odd

dusk flicker
#

my only bet, and I dont have a ton of experience with the new mappings, is you are using the mojang mappings and not converting back to the spigot mappings

river oracle
#

yep as you said that would be the issue I was moving projects for testing and I just figured out I'm not recompiling with the spigot mappings

river oracle
dusk flicker
#

lol

signal kettle
#

Hello everyone i'll continue the thing that he started with it but more comfy haha. So i wanted to created a mechanic that will e.g prevent players from placing dirt on other type of blocks then only one that i speciefie e.g Stone

quaint mantle
#

i literally gave him the answer

signal kettle
#

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;

public class CanBePlacedOn implements Listener {

    @EventHandler(priority = EventPriority.HIGHEST)
    public void OnPlaceBlock(BlockPlaceEvent event) {
        Block block = event.getBlock();
        Material material = block.getType();
        Player player = event.getPlayer();

        if (preventType == event.getBlockPlaced().getType() && placedOnType == event.getBlockAgainst().getType()) {
            event.setCancelled(true);
            player.dostuff
        }
    }
}
dusk flicker
#

what in the god shittery is that formatting you used

#

the java formatting exists

signal kettle
#

sry afai

quaint mantle
dusk flicker
#

i think they are

#

also conventions

#

?conventions

undone axleBOT
dusk flicker
#

oh they fucking are

signal kettle
dusk flicker
#

braincells are gone im going to bed

quaint mantle
#

goodnight

signal kettle
#

i compiled it with maven and create it in IntelliJ

quaint mantle
#

no you didnt compile anything

#

that isnt valid java

signal kettle
#

wdym bro

#

its for plugin not mod first of all

#

second of all your answer have red light because there isn't a thing like preventType

quaint mantle
#

because inferring things isnt a thing anymore

signal kettle
#

ah anyway i don't want to lose your time my friend

#

thank you any way for a few good tips

#

it's to hard for newbie like me so i'll just pay for some advanced developer that will make work it for me haha

#

have a good night mate

quaint mantle
#

pay?

signal kettle
#

ye

quaint mantle
#

dm me

eternal night
#

๐Ÿ‘€

upper vale
#

LMAO

ivory flume
#

here is the response

#
short len = in.readShort();
byte[] msgbytes = new byte[len];
in.readFully(msgbytes);

DataInputStream msgin = new DataInputStream(new ByteArrayInputStream(msgbytes));
String somedata = msgin.readUTF(); // Read the data in the same way you wrote it
short somenumber = msgin.readShort();```
#

that the example gives us

#

is the subChannel going to be Forward or the subchannel you specified

rugged cargo
#

is there a good way to format the lore text? kind of like iomanip if you're familiar with c++?

shadow gazelle
#

Is the location where an experience bottle breaks stored after the bottle breaks?

rugged cargo
#

more specifically a setw equivalent

shadow gazelle
#

Nevermind

ornate heart
#

might be a beginner question but doesn cancelling the PlayerInteractEvent cancel block placement as well?

shadow gazelle
#

There's a BlockPlaceEvent

ivory flume
#

anyone used the Forward bungee plugin messaging subchannel that can tell me whats going on

polar pagoda
#

do i need to make a class for every command i want to make?
ive already got the event stuff done but

polar pagoda
#

alr

#

well the method i used makes it just send the command back to me

waxen plinth
#

There are lots of options to make commands cleaner

polar pagoda
#

so its basically mocking me lol

waxen plinth
polar pagoda
#

alr

waxen plinth
#

It's showing usage

#

You're probably returning false

#

Or just set it up wrong

polar pagoda
waxen plinth
#

You're using ==

#

Also

#

Why are you doing a sender check for this, exactly?

polar pagoda
#

instanceof?

waxen plinth
#

There's nothing that depends on the sender being a player here

polar pagoda
#

in case the command is sent from the console

waxen plinth
#

But why would that even be a problem

#

It's not like you need to do any player specific actions to the sender like damage or teleport them

polar pagoda
#

true

waxen plinth
#

Literally all you do is send a message

polar pagoda
#

is there a tutorial video for this

#

ive tried like 3 different ways just now and it still does the same thing

#

fixed it with

CommandHandler commands = new CommandHandler();
        getCommand("discord").setExecutor(commands);

in the main class

silent vigil
#

Im having an issue comparing locations.

[23:11:27] [Server thread/INFO]: Location{world=CraftWorld{name=world},x=40.5,y=70.0,z=322.5,pitch=0.0,yaw=0.0}
[23:11:27] [Server thread/INFO]: Location{world=CraftWorld{name=world},x=40.5,y=70.0,z=322.5,pitch=0.0,yaw=0.0}```(2 different entries) and I have an if statment to check if they are the same, and it does not go through, any ideas?
humble tulip
#

you should use .equals

silent vigil
#

yea

#

arent those the same?

humble tulip
#

do location.equals(anotherLocation)

#

nope == check if two objects are the same

silent vigil
#

oohhhhh ok tysm

quaint mantle
#

on strings that may have unintended side effects

#

im pretty sure utf-8 and utf-16 strings wont work together on ==

humble tulip
summer scroll
#

Can I get ItemFrame object from an ItemStack?

#

I'm guessing not since it's an entity.

neat maple
#

How can I query this in 1.19 since this has been removed?

import net.minecraft.server.MinecraftServer;

MinecraftServer.getServer().recentTps
waxen plinth
#

Step 1. Don't

river oracle
#

wat

waxen plinth
#

I am sure there's another way to get tps

#

Average it yourself via the scheduler if you have to

#

Don't use nms

river oracle
#

couldn't you just run the calculations yourself

#

don't understand why you would need nms there

#

from a google search looks like you can do it with a scheduler as redempt said

dark arrow
#

is it possible to remove the zombie pathfinding ability in nms?

sullen marlin
#

Disable ai?

mellow gulch
#

is it a known issue that boats riding players don't update their position for the client that the boat is riding?

#

other players on the server see things as they are, but the player with the boat on their head sees the boat where it was, and then the boat teleports to them when they eject the boat.
i'm going to check jira now, but wnted to ask here also.

dark arrow
mellow gulch
dark arrow
mellow gulch
#

don't remove a new thing ever, i think that's your problem

#

you should get the goal from it's list of goals, then remove the one you want to remove from there.
the code you sent i'm pretty sure will just create a new instance of a NearestAttackableTargetGoal, and since it wasn't in the goal list, when you tell the game to remove it nothing of note happens

dark arrow
#

ok

quiet ice
dark arrow
#
public class runner extends Villager {
    public runner(Location location){
        super(((CraftWorld)location.getWorld()).getHandle());
        
    }
    
}```I am getting an error in the super line but i did the same for my other class and it does not have that error
#

Cannot resolve method 'super(net.minecraft.server.level.ServerLevel)'this is the error

mellow gulch
#

what package is Villager in?

dark arrow
#

import net.minecraft.world.entity.npc.Villager;

mellow gulch
#

EntityVillager's constructor takes EntityTypes<? extends EntityVillager> in addition to a world

#

(and optionally a VillagerType as a 3rd arg)

desert tinsel
#
if (!TntTag.games.isEmpty()){
            for (Game game : TntTag.games){```
but I still get error: `` generated an exception
java.util.ConcurrentModificationException: null
        at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013) ~[?:?]
        at java.util.ArrayList$Itr.next(ArrayList.java:967) ~[?:?]``
dark arrow
mellow gulch
#

ya that's fine, same class afaik

dark arrow
mellow gulch
#

i think so

dark arrow
#

but it gaves error

#

oh it got fized

#

wrong package was imported

fair sable
mellow gulch
dark arrow
#

((CraftWorld) player.getWorld()).getHandle().addFreshEntity(new NewMob(player.getLocation()), CreatureSpawnEvent.SpawnReason.DEFAULT);This is the code to summon a custom zombie created , but how can i use it to summon Passivemobs

mellow gulch
#

if i were you i'd make functions to modify the ai instead of extending the entities.
makes things a lot simpler, you can use API to spawn in whatever and then use functions to modify it's ai after. i did it for one of my minigame plugins and it works great, also makes it so you don't need to extend a bunch of entities, just make functions that use EntityInsentient, or whatever the mappings call it

#

also makes it so you can just make your own pathfinder goals and stuff, and just kinda inject them in.
named my utility class BrainSlug as a futurama reference lol

dark arrow
#

nice idea even tho somethings went above my head

mellow gulch
#

my code is old and i haven't had time to convert my projects to use the mappings, so it's still full of obfuscated method names and reflection and stuff.
but if the code was cleaner i'd send it over or submit it to see if they'd add it to the api or something.

viscid wharf
#

Can someone tell why chat preview always returns Type to preview in grey color?

#

I tried with ProtocolLib event nothing happened (seems not called)

mellow gulch
# covert karma bump

World.rayTraceEntities and World.rayTraceBlocks, or World.rayTrace, using Player.getLocation and Location.getDirection

covert karma
#

is it possible to make an item have enchantments but disable the enchantment glint?

faint harbor
covert karma
#

how would i do it using protocollib?

dense falcon
#
package fr.program.pranction.commands;

import fr.program.pranction.Pranction;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class MuteCMD implements CommandExecutor {
    Pranction plugin;

    public MuteCMD(Pranction plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("mute")) {
            if (sender instanceof Player){
                Player plr = (Player) sender;

                Player target = Bukkit.getPlayer(args[0]);

                if (!plugin.getConfig().contains("players." + target.getUniqueId())) {
                    plugin.getConfig().set("players." + target.getUniqueId() + ".name", target.getDisplayName());
                    plugin.getConfig().set("players." + target.getUniqueId() + ".banned", "false");
                    plugin.getConfig().set("players." + target.getUniqueId() + ".reason_ban", "N/A");
                    plugin.getConfig().set("players." + target.getUniqueId() + ".time_ban", 0);
                    plugin.getConfig().set("players." + target.getUniqueId() + ".muted", "true");
                    plugin.saveConfig();
                }

                if (plugin.getConfig().get("players." + target.getUniqueId() + ".muted") == "true") {
                    plr.sendMessage("[" + ChatColor.BOLD + ChatColor.LIGHT_PURPLE + "Pranction" + ChatColor.RESET + ChatColor.WHITE + "] Le joueur a deja ete reduit au silence !");
                    return false;
                } else {
                    plugin.getConfig().set("players." + target.getUniqueId() + ".muted", "true");
                    plugin.saveConfig();
                }

                StringBuilder reason_mute = new StringBuilder();
                String[] nargs = args;
                nargs[0] = null;
                for (String part : nargs) {
                    if (part != null || part != "null" || part != "NULL"){
                        reason_mute.append(part).append(" ");
                    }
                }

                Bukkit.broadcastMessage("[" + ChatColor.BOLD + ChatColor.LIGHT_PURPLE + "Pranction" + ChatColor.RESET + ChatColor.WHITE + "] Le joueur " + target.getDisplayName() + " a ete sanctionne par un moderateur pour : " + reason_mute);
                return true;
            }
        }
        return false;
    }
}

``` Hello why I am still getting the case "null"? (It's about the loop `for`).
wet breach
#

nargs[0] = null;

#

instead of using null, use the remove method

dense falcon
drowsy helm
#

Anyone know if a 1x4 matrix can have an identity or is it only when rows and columns are the same?

halcyon mica
#

I wonder what the point is of thread-locking palette interactions

humble tulip
halcyon mica
#

I can't inject biomes asynchroniously anymore

#

Anyone knows what's going on there

drowsy helm
halcyon mica
#

In particular, why it is thread locked now

eternal oxide
humble tulip
quaint mantle
#

someone can help me with my plugin? but need it general 1 because i need to do a share screen

ivory sleet
quaint mantle
#

i cant

#

I did not notice

flint coyote
#

Guess a youtube video or some screenshots are possible options then

quaint mantle
#

No matter I fixed it

heady pumice
dense falcon
#

Ah alr.

#

I try.

#

It does not change @heady pumice .

quaint mantle
#

someone know why it not spawn slime?

covert karma
#

you are not calling the method anywhere

dense falcon
#

You did not call your function @quaint mantle.

#
package fr.program.pranction.events;

import fr.program.pranction.Pranction;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent;

public class PlayerChated {
    public static void init(AsyncPlayerChatEvent event, Pranction plugin) {
        Player player = event.getPlayer();

        if (plugin.getConfig().getString("players." + player.getUniqueId() + ".muted") == "true") {
            player.sendMessage("[" + ChatColor.BOLD + ChatColor.LIGHT_PURPLE + "Pranction" + ChatColor.RESET + ChatColor.WHITE + "] Vous n'avez pas la permission de parler dans le chat publique !");
            event.setCancelled(true);
        }
    }
}

``` Why once I reloaded the server, I can speak and .muted is true?
glossy venture
#

@dense falcon always compare strings using a.equals(b)

#

otherwise it wont work

#

also it might load it as a boolean instead

#

also

#

tf is that structure

glossy venture
#

thats not how events work

dense falcon
#

It is.

glossy venture
#

unless youre calling it from an event somewhere else

#

tfdym

dire marsh
#

sir

#
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {

}
glossy venture
#
public class PlayerChattedListener implements Listener {
  private final Pranction plugin;
  public PlayerChattedListener(Pranction plugin) {
    this.plugin = plugin;
  }

  @EventHandler
  public void onChat(AsyncPlayerChatEvent event) {
    // your code
  }
}
#

then register thatr

#

@dense falcon

dense falcon
#

๐Ÿคฆโ€โ™‚๏ธ

glossy venture
#

and compare using stringA.equals("true")

#

instead of ==

#

that wont work sometimes

dense falcon
#

I didn't do it like that and my way is very good for information, it's exactly the same thing except that I have something to sort out. Then, I ask something about the reload not about the events.

dense falcon
dire marsh
#

shouldn't you be using getBoolean instead anyway

glossy venture
#

yeah

glossy venture
iron glade
#

why are you using get string to get a boolean

glossy venture
#

this is confusing as fuck

dense falcon
glossy venture
#

ok

#

well then change getString( to getBoolean( and remove the comparison

iron glade
#

you don't need == true

dire marsh
#

or just if(getBoolean)

glossy venture
#

or use .equals("true")

#

oh yeah

#

shit

dire marsh
#

xd

glossy venture
#

lmfao

iron glade
#

I remember back in the day when I did if(boolean == true) lmao

dire marsh
#

I don't think I have ever done that

glossy venture
#

ive probably done that by accident a few times

dense falcon
#

Fixed, and now?

glossy venture
#

try

#

qagain

iron glade
#

sometimes it helps tho visualizing stuff

glossy venture
#

yeah

#

when youre thinking in terms of a condition or comparison you sometimes write == true

#

or i do

#

at least

iron glade
#

yeah

#

it' not that big of a deal anyway

glossy venture
#

yeah

iron glade
#

same result

#

and if in some circumstances it helps to keep the overview, why not

glossy venture
#

true

dense falcon
#

Yeah it works, thanks guys.

glossy venture
#

aight

#

nice

iron glade
#

np

dense falcon
#

Just.

#

In the main file.

#

Do I have to do saveDefaultConfig ?

dire marsh
#

idk what you're doing but that method saves your config from your plugin resources/config.yml to your plugins/your_plugin/config.yml

#

or is that saveconfig

rapid goblet
#

Hello can anyone help me I have a server of spigot but after i updated the server to 1.19 it always shows (incomplete sets of tags received from the server) but my friends can join but I cant

granite owl
dark arrow
#

I have created a custom villager using nms but i am unalbe to summon it on command while on the other hand i am able to summon zombie

proper pawn
#

with 1.19 my npcโ€™s (entityplayers) donโ€™t work anymore. they need a new argument. โ€œprofilepublickeyโ€ what is this exactly? i canโ€™t find anything on the internet.

#

could someone help me?

#

ping me if you can help me

spare prism
#

?paste

undone axleBOT
spare prism
#
[14:43:47 ERROR]: Error occurred while enabling DiscordUtils v3.0.1 (Is it up to date?)
java.lang.NoClassDefFoundError: net/dv8tion/jda/api/entities/UserSnowflake

Why does this happen?
pom.xml: https://paste.md-5.net/abogatezay.xml

quiet ice
#

Maven or gradle?

spare prism
quiet ice
#

Oh lmao

#

Did Not scroll properly

radiant cedar
#

what can cause villagers to not get scared by a zombie

quiet ice
#

The pom Looks okay, albeit I would Not shade log4j

#

Are you Sure that you are building the maven artifact via mvn package or similar?

quiet ice
#

IntelliJ's maven Integration or IJ proper?

#

Yeah, #setItemMeta suffices

spare prism
dark arrow
#

I have created a custom villager using NMS but i am not able to spawn it I ma using `else if(args[0].equalsIgnoreCase("Villager")){
((CraftWorld) player.getWorld()).getHandle().addFreshEntity(new runner(player.getLocation()));

        }`
spare prism
quiet ice
#

Probably your issue then

#

Since I am an Eclipse User, I cannot Help you

void escarp
#

how does Enchantment#canEnchantItem() work? i'm getting true with diamond sword and quick charge 3

earnest forum
#

some enchants only work on some tools

quiet ice
#

What exactly did you do?

earnest forum
#

for example sharpness only works on swords and axes

quiet ice
#

He prob knows it

#

But idk what Quick charge is, so heh

#

The Pain of being non-english

earnest forum
#

quick charge i think is how long the charge resets when u hit someone

#

the new combat system charge thing

quiet ice
#

And Well 1.13+ is Not my area of expertise

earnest forum
#

wait

#

no

#

isnt quick charge a crossbow enchant?

#

oh wait nvm

#

thats his question

quiet ice
#

I would think so too

#

#canEnchantItem is basically a Switch on enum on the material

#

Iirc

earnest forum
#

i think theres a special enum

#

for enchant types

quiet ice
#

Yeah, but that is a Switch on enum then

void escarp
#

oh yeah nevermind it only worked because i was in creative

quiet ice
#

Ah lol

void escarp
#

ig creative allows you to put any enchantment on an item using an anvil

quiet ice
#

Yeah, Creative Mode is powerfull

#

But pain for devs to some degree

earnest forum
#

u canonly do that using give command

quiet ice
earnest forum
#

it does?>

#

maybe thats new

void escarp
#

i just disabled my plugin and it lets me put protection on a sword

earnest forum
#

that has to be new

quiet ice
#

Been Like that since forever I think

#

At least since 1.7.4

#

I never knew it to be different

earnest forum
#

i guess i just never tried it

void escarp
#

i was worried my plugin somehow did that. on survival mode, the prepare anvil event is not fired at all with incompatible enchants, but on creative it's fired and Enchantment#canEnchantItem() accepts the incompatible enchantment

earnest forum
#

i guess it just allows anything in creative

quiet ice
#

It is cancelled

#

Not Not fired

void escarp
#

yeah could be

#

but maybe the docs should indicate whether creative mode affects Enchantment#canEnchantItem()

quiet ice
#

But how does spigot know that the Player is in Creative?

void escarp
#

yeah im wondering the same thing

#

the prepare anvil event doesnt even have a player

quiet ice
#

There is something wrong there

#

It has a viewer

void escarp
#

it has viewers on the inventory

#

but even then, how does the enchantment or canEnchantItem know the player

earnest forum
#

what does the method pass in as argument?

void escarp
#

ItemStack

earnest forum
#

theres no way to tell what the itemstack's inventory from that object right?

void escarp
#

i dont think so

earnest forum
#

maybe decompile the sharpness class

#

or the enum

#

not even an enum actually just the Enchantment class

quaint mantle
#

Is there an actual way to change / add to server code with spigot?

earnest forum
#

yes

#

modify the jar

quaint mantle
#

wdym

earnest forum
#

theres tutorials online

quaint mantle
#

I mean with a plugin :P

earnest forum
#

no then

quaint mantle
#

no mixins?

earnest forum
#

what are u trying to achieve

quaint mantle
#

add more events

ivory sleet
#

Nope no mixins

earnest forum
#

you can create your own events

ivory sleet
#

You can fork

misty current
#

what happens if you call an abstract method in the constructor of an abstract class? does it call the overridden method in the child class?

ivory sleet
#

Yes

quaint mantle
misty current
void escarp
#

enchanted books have no getEnchantments?? (I mean it's empty map)

misty current
#

ngl i'd love to see mixins in spigot's api but it aint happening :c

ivory sleet
#

Mixins does not really fit into spigot due to the amount of api thatโ€™d probably break

misty current
#

but i see why its not possible

ivory sleet
#

The enchantments are stored under a different nbt key

void escarp
#

ok i'll check, thanks

misty current
#

for a private server it would be awesome to have mixins

ivory sleet
#

Indeed

quaint mantle
#

actually a custom jar is not a bad idea

misty current
ivory sleet
#

Technically you could just run fabric at that point

#

Or forge Ig

#

Or sponge maybe

quaint mantle
#

yes but isnt fabric slower?

ivory sleet
#

Havenโ€™t done any benchmarks

#

But possibly

quaint mantle
#

wait

misty current
#

actually yea, you could run a fabric server without any client side mod

quaint mantle
#

frick fabric is actually a good idea

twilit roost
#

the line it is pointing to :

quaint mantle
misty current
#

i'm pretty sure fabric has a lot of optimizations but not as many as spigot for multiplayer or public server hosting

misty current
twilit roost
quaint mantle
twilit roost
#

it just moves blocks

misty current
twilit roost
misty current
#

if you wanna workaround the issue just clone getShips and use that in the enhanced for

#

what's getShips? A list?

twilit roost
#

ArrayList

earnest forum
#

pretty weird name for a non method

misty current
#

for a field yes a very weird method

sterile token
#

Bukkit#runTask() return an int (id) right?

misty current
#

but he called a method Update with capital U so im not suprised

twilit roost
misty current
#

bro didn't understand what's a getter

twilit roost
misty current
#

ah

twilit roost
earnest forum
#

thats not what a getter is

#

please learn java

#

?learnjava

undone axleBOT
sterile token
#

C# and java are not the same

#

I dont know why people think that as they learned C# they now how java Work

earnest forum
#

might as well make ships public

misty current
#

^

#

or make a proper getter

twilit roost
#

I dont want to modify the original variable

earnest forum
#
public ArrayList<Ship> getShips(){ return ships; }
sterile token
#

I agree to the random person that said learn java

twilit roost
#

or modify only when i want to

sterile token
#

Getter are done to access a class or a field

misty current
#

anyways do something like for(Ship ship : new ArrayList<>(getShips) {

tender shard
#

public variables only make sense for static final things like Collections.EMPTY_LIST

misty current
#

not an arraylist

tender shard
misty current
sterile token
#

Ohh ok

misty current
#

i'm 99% sure he's getting it because a method changes the list inside the for loop

#

can you access a non static field without an instance of the class through reflections?

tender shard
#

instance fields are always bound to an instance

quaint mantle
#

Who knows why it writes this to me whenever I try to write the command speed? And the command is already registered

misty current
#

yea makes sense

earnest forum
#

it means theres an error

misty current
earnest forum
#

sort of what it says

quaint mantle
tender shard
#

why the heck are you checking the command's name?

misty current
#

probably 50 is an illegal amount

#

and it throws an illegalargumentexception

earnest forum
#

thats what the tutorials teach you on youtube

misty current
#

check the stacktrace in the console

earnest forum
#

but you really only need to do it if u have multiple commands handled in 1 method

tender shard
earnest forum
misty current
earnest forum
#

coded red

misty current
#

years ago

misty current
tender shard
# quaint mantle

why don't you look at the console and read the actual stacktrace?

misty current
#

i kinda have the feeling coded red just googles stuff and copy-pastes it in his tutorials

#

sometimes

misty current
misty current
earnest forum
#

When it says an internal error occured

#

Should probably look at console

tender shard
#

i wonder why they check if it's below 0 before checking if it's below -1

misty current
#

indeed, bro didn't even read the console ๐Ÿ™ƒ

echo basalt
misty current
earnest forum
#

show the actual error

misty current
#

it's not the whole stackltrace

earnest forum
#

not the stack trace

misty current
#

there's a caused by part

tender shard
#

?paste the full stack trace instead of screenshotting it

undone axleBOT
misty current
echo basalt
#
String highLow = value > 1 ? "high" : value < -1 ? "low" : "";

if(!highLow.isEmpty())
  throw new IllegalArgumentException(value + " is too " + highLow);
#

stil ugly

tender shard
quaint mantle
tender shard
#

just remove the < 0.0f check

echo basalt
#

so is checking for positive values

quaint mantle
tender shard
# quaint mantle

as we already said 3 times, 50 is too high because the max value is 1

misty current
tender shard
#

the docs also explain that it must be between -1 and 1

misty current
#

it even tells you the exception thrown

quaint mantle
#

you can give me some advice to learn spigot API ot to learn to make plugin with spigot API?

misty current
#
  1. learn java
#
  1. docs
#
  1. more advanced, read spigot's internals to understand better how does some stuff work
harsh totem
#

I just noticed that PlayerChatEvent is deprecated so how would I know if someone types in chat?

harsh totem
#

ok

misty current
#

add Async to the event name

#

and u got it

glossy venture
#

are divisions by exponents of 2 automatically optimized to bit shifts by the jvm or javac compiler? for example, instead of down a / 2 it will be a >> 1 or a / 8 = a >> 3

#

with integers

quaint mantle
#

?

misty current
#

pratice makes perfect

quaint mantle
misty current
#

back to step one

quaint mantle
#

but it not go step by step

misty current
#

step one was learning java