#help-development

1 messages · Page 2200 of 1

tardy delta
#

idk

eternal oxide
#

was your inventory empty when you jumped in?

glass mauve
#

how can I make an item not stackable?

tardy delta
#

set the max stacksize to 1 first guess

tall dragon
#

you can apply some unique nbt

eternal oxide
#

StackSizes are fixed in teh client add PDC/NBT tag

eternal oxide
iron glade
#

I'm going crazy, I hope someone can help me with this one

#

coming in a sec

hybrid spoke
#

1

#

2

#

3

#

already 3 secs passed

eternal oxide
#

^ can't count any higher without taking shoes off. Mutant.

hybrid spoke
#

had to google what comes next

#

5

#

6

tender shard
tardy delta
#

noob

eternal oxide
tender shard
eternal oxide
#

ah ok

quaint mantle
#

for view distance, which one is the tick distance?

#

for player.getViewDistance(), getClientViewDistance()

tender shard
#

view-distance = how far you can see
simulation-distance = distance where physics work etc

quaint mantle
#

oh so i can get that from the server instead of the player?

hybrid spoke
#

we live in a simulation

quaint mantle
#

and its the same for every player?

tardy delta
tender shard
#

you can get both from Bukkit

#

Bukkit.getViewDistance() and Bukkit.getSimulationDistance()

quaint mantle
#

gotcha

tardy delta
#

ahh

tender shard
#

you can also get the player's view distance, which could be lower than the server's view distnce, but never higher

quaint mantle
#

ah i see, the int is in blocks right

tender shard
#

I think that it is in chunks

#

same like when you go to Settings in the escape menu

quaint mantle
#

alright

tender shard
#

yeah it would be weird if it'd be blocks since the default is only like 8 or so lol

tender shard
tender shard
iron glade
#

wait I'll record it

tender shard
#

to set max stack sizes per material:

  1. change the value on the Material class' "maxStack" field (https://github.com/JEFF-Media-GbR/JeffLib/blob/dc71756f3b0371480d4895a9c1ec7834e8aca9c9/core/src/main/java/de/jeff_media/jefflib/MaterialUtils.java#L78)
  2. change the value on the NMS Item's class "maxStackSize" field (or however it's called in mojang mappings) (https://github.com/JEFF-Media-GbR/JeffLib/blob/dc71756f3b0371480d4895a9c1ec7834e8aca9c9/core/src/main/java/de/jeff_media/jefflib/MaterialUtils.java#L78)
#
  1. add a shit ton of listeners to prevent weird bugs happening, for example duplication of the bowl when eating a sus stew, or stuff like disappearing buckets when you stacked them and then empty only one of those
quaint mantle
#

hello my friends

tender shard
#

i'm not your friend, pal

#

i'm not your pal, buddy

#

etc

#

i'm not your buddy, mah friend

#

and now it repeats forever

quaint mantle
#

so why are you answering me?

tender shard
#

seems like you didnt get the joke

#

anyway, what's your question?

quaint mantle
#

I guess, no

#

english is not my language

#

lol

tender shard
#

it's from a south park episode or sth like that lol

#

sorry didnt want to confuse you lol

quaint mantle
hybrid spoke
tender shard
quaint mantle
#

how can I get an offline player by the name?

#

once the method is deprecated

tender shard
#

yes but you can still use it. it will not be removed

#

the other way would be to loop over Bukkit.getOfflinePlayers()

quaint mantle
#

should I iterate the array?

#

Bukkit.getOfflinePlayers

tender shard
#

I would simply use the deprecated function. it's only deprecated because players can change their name and then the server wouldnt know about it

hybrid spoke
#

mojang api call: am i a joke to you?

tender shard
#

it won't be removed anytime soon I guess

quaint mantle
hybrid spoke
#

the getOfflinePlayer method will make an api request to mojang if it couldnt find a player with that name in the offlineplayers list

quaint mantle
tender shard
#

to the person who claimed you can now get rid of NMS for totem animations: you liar!

#

playEffect(EntityEffect) will be visible to ALL players, not just the player one is calling this is on

hybrid spoke
#

i mean, you can play the effect to all players but cancel for the ones that shouldnt get it via NMS/packets

tender shard
#

lol that idea is so stupid, I love it

iron glade
#

basically that's the problem

#

it only works the first time, the 2nd time I don't appear in the set

tall dragon
iron glade
#

Those are preadded, I don't play on any of those servers xd

hybrid spoke
#

and what exactly is the problem? that the second player doesnt disappear?

desert tinsel
#

yep

iron glade
#

yeah the gui is not updated

tardy delta
#

Player#updateInventory i guess

hybrid spoke
#

its probably within the gui class

tender shard
#

I don't really get what the problem is at all lmao. Two players online, it shows both, one leaves, it only shows one again. am I stupid or sth?

iron glade
hybrid spoke
desert tinsel
#

you can add System.out.println("Something"); to check if event is called for second player quit event

iron glade
hybrid spoke
#

i wonder what happens if someone gets kicked who has the inventory opened youknow

tardy delta
#

the server crashes

tender shard
#

oh

tender shard
iron glade
#

Wait I'll send the full code

hybrid spoke
tender shard
#

oh I thought your question was about in general whether an InventoryCloseEvent is called for players who get kicked

#

lol

#

my english is cursed today

hybrid spoke
tender shard
#

maybe I shud just start tahkun lik dis

hybrid spoke
#

wasnt there once a guy who talked exactly like this

tender shard
#

oh yeah and he also always send one or two words per message so

desert tinsel
#

sure?

tender shard
#

his messages

#

always

#

looked

#

like dis

tardy delta
#

then i feel like i should use the kickhammer

iron glade
#

Here it is

tender shard
#
                            if (plugin.trollManager.getTrollableOnlinePlayers() - 1 > 0) {

#

are you sure that that doesnt also contain the player who opened the inv?

iron glade
#
    public int getTrollableOnlinePlayers() {

        int[] trollable = new int[1];

        Bukkit.getOnlinePlayers().forEach(all -> {

            if(!all.isOp() && isTrollable(all) || all.isOp() && plugin.trollOperators) {

                trollable[0]++;

            }

        });

        return trollable[0];

    }```
#

Should return everyone who is able to be trolled (also the one opening the inv) and that's why I do -1

tardy delta
hybrid spoke
tardy delta
#

wtf lol

#

most easy way is using a stream with a filter and counting the outcome

tender shard
#

wow yeah that is one weird way of counting

iron glade
#

yeah true was kinda a work around for now I guess

tender shard
#

using a 1 length int array in a forEach lambda to count the members? lol

#

that is creative at least

iron glade
#

xd

tardy delta
#

becuase hes using a consumer

hybrid spoke
#

final context

tardy delta
#

use a normal for loop or a stream

vocal pine
#
32                    ServerLevel wrld = ((CraftWorld) player.getWorld()).getHandle();
33                    wrld.tryAddFreshEntityWithPassengers(cart);```

--->

```Caused by: java.lang.AssertionError: Unknown entity class games.tress.railpack.Railcart
        --cut for message length--
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at net.minecraft.world.level.WorldAccess.addFreshEntityWithPassengers(WorldAccess.java:16) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at net.minecraft.server.level.WorldServer.tryAddFreshEntityWithPassengers(WorldServer.java:1023) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at net.minecraft.server.level.WorldServer.e(WorldServer.java:1011) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at games.tress.railpack.Railpack.onCommand(Railpack.java:33) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        ... 21 more```
tender shard
#

I know but why not just a normal for loop or a stream

tender shard
iron glade
#

What's the stream thingy? Never used it I guess

hybrid spoke
#

java 8 streaming api

vocal pine
#

added line numbers to codeblock

hybrid spoke
#

?bing

undone axleBOT
vocal pine
#

making a test command so i can test without needing to make the item to spawn it, etc yet (cus it cant be summoned)

tender shard
hybrid spoke
tardy delta
#

should i apply Stream#filter on prev filter or apply all filters in the same method?

#

just wondering

tender shard
tender shard
vocal pine
#

👍 couldnt fit it in msg ill split

#
        at org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity.getEntity(CraftEntity.java:409) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at net.minecraft.world.entity.Entity.getBukkitEntity(Entity.java:165) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at org.bukkit.craftbukkit.v1_18_R2.event.CraftEventFactory.doEntityAddEventCalling(CraftEventFactory.java:608) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at net.minecraft.server.level.WorldServer.addEntity(WorldServer.java:1000) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at net.minecraft.server.level.WorldServer.addFreshEntity(WorldServer.java:937) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at net.minecraft.world.level.WorldAccess.lambda$0(WorldAccess.java:16) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411) ~[?:?]
        at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734) ~[?:?]
        at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) ~[?:?]
        at net.minecraft.world.level.WorldAccess.addFreshEntityWithPassengers(WorldAccess.java:16) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at net.minecraft.server.level.WorldServer.tryAddFreshEntityWithPassengers(WorldServer.java:1023) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at net.minecraft.server.level.WorldServer.e(WorldServer.java:1011) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3497-Spigot-b081915-b02801a]
        at games.tress.railpack.Railpack.onCommand(Railpack.java:33) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        ... 21 more```
tender shard
vocal pine
#

yeah i realised that right after

#

im gonna do that

#

lol

#

whoops

tardy delta
#

"filter(Predicate.not(Player::isOp)).filter(Predicate.not(this::isTrollable)) lol

#

Predicate.and being a thing

vocal pine
iron glade
#

It's returning me a long somehow lol

tardy delta
#

just cast it

#

assuming you dont have millions of players on your server

tender shard
#

wrong quote

#

rip

tender shard
#

you are extending AbstractMinecart which is in none of those if blocks

iron glade
tender shard
#

you have to extend an actually spawnable entity

vocal pine
#

ahh

tender shard
#

like for example RidableMinecart

iron glade
#

the main problem tho is still there, the gui is not updated the 2nd time :(

vocal pine
#

i thought it made more sense to do the Abstract bcus i was replacing so much

#

didnt realise i was being stupid

tender shard
#

well actually the NMS code to spawn entities is stupid lol

#

I mean just look at what I sent

#

that's so weird

#

anyway it should work fine if you just extend any of those actual "concrete" minecart variants

vocal pine
#

heyy it actually works

#

didnt expect to get this far lmao thanks for feeding me the answers

tender shard
#

RIP why did spiget stop working for paid plugins

iron glade
#

wdym?

#
PaginatedGui gui = Gui.paginated().title(Component.text(StringManager.INVENTORY_TITLE_PLAYER_SELECT)).rows(6).pageSize(45).create();

            for(Player all : Bukkit.getOnlinePlayers()) {

                if(all.getOpenInventory().title().equals(Component.text(StringManager.INVENTORY_TITLE_PLAYER_SELECT))) {

                    //do stuff

                }

            }``` any idea why this is not working? Shouldn't I be able to compare the inventory title like this?
tardy delta
#

why are you calling a player variable all

iron glade
#

that's put somewhere else

tardy delta
#

and make that component a variable

iron glade
#

it was just to demonstrate

tardy delta
#

is inventory a record?

solemn olive
#

hey everyone, how can i send a colored message to console?
i tried ```java
getLogger().info(ChatColor.GOLD + "Enabled!");

but in the console output i see this:
tardy delta
#

Bukkit.getConsoleSender().sendMessage(colored stuff)

#

you really shouldnt

iron glade
tardy delta
#

cuz title() and not getTitle()

iron glade
#

it's the new thing

#

getTitle is deprecated

#

at least in paper

eternal oxide
#

Don;t compare titles, compare instances

iron glade
#

I can't

#

the for loop is in a joinlistener

#

the gui is in a method in another class

tardy delta
#

then put a listenir in that gui class

#

thats what i did

iron glade
#

I still can't compare cause the gui is not a global variable

eternal oxide
#

make the Inventory available to test against

proven ocean
#

Hey, since the new 1.19 messages of component Builders start with "<> ". Is this a bug, should I report it? Or is this a new "feature" and I have to change something in my code?

ivory sleet
#

do they?

proven ocean
#

I can't post a screen here

ivory sleet
#

verify

proven ocean
#

mom

#

Second message is send with component builder

tardy delta
#

daddy

proven ocean
#

here as well

proven ocean
tardy delta
#

no

proven ocean
#

😦

#
                ComponentBuilder builder = new ComponentBuilder();
                builder.append("\n");
                builder.append(HardCoreSMP.toBaseComponent(Constants.PREFIX + "§7Herzlich Willkommen auf dem §eHardcore SMP §7von §eXYZ!\n"));
                // More text here

                player.spigot().sendMessage(builder.create());
acoustic pendant
#

Why is this giving an error?

tardy delta
#

your prefix?

tardy delta
#

make sure they're compatible

acoustic pendant
#

oh wait

#

the server is on 1.8.8 .-.

#

mb lol

proven ocean
#

lol

tardy delta
#

smh

#

Collection.singletonList when

#

i always see people creating a list and then adding stuff manually

#

i mean whats wrong with Arrays.aslist

proven ocean
#

good question. IntelliJ tells you to use Collection.singletonList when you have an Array with only one item.

tardy delta
#

his ide doesnt seem to tell that

eternal oxide
#

Arrays.asList is an immutable list

tardy delta
#

would it matter?

eternal oxide
#

depends on teh use case

proven ocean
#

in his use case, where he has only one line of lore

eternal oxide
#

You can't add nor remove from an immutable list

tardy delta
#

ik that but i dont think the server should do that either

eternal oxide
#

it doesn't

#

his is probably cleaner, if you want more lore

tardy delta
#

mwoa ye personal thing 😆

eternal oxide
#

Its also habit forming.

lusty cipher
#

hmm I updated to spigot-api:1.19-R0.1 and now org.apache.commons.lang.StringUtils is gone :(

eternal oxide
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

lusty cipher
#

but it worked with spigot-api:1.18-R0.1

#

both are from maven

eternal oxide
#

what are you depending on?

#

api has no libs

#

even in 1.18 the api has no libs

lusty cipher
#

:thonk:

#

confused

eternal oxide
#

you sure you are not depending on spigot and not spigot-api

lusty cipher
#

im on spigot-api

eternal oxide
#

then you are getting it from some other dependency

lusty cipher
#

perhaps...

#

im gonna restrict the repositories

proven ocean
#
 player.spigot().sendMessage(ChatMessageType.ACTION_BAR, HardCoreSMP.toBaseComponent("§7Teleportation in §6" + (int) Math.ceil((20d - s) / 2) + " Sekunden"));

This will send messages in chat, not in actionbar (1.19)

eternal night
#

update spigot

proven ocean
#

already 1 version behind 😮 that was fast

eternal night
#

Chat in general is under a lot of changes in 1.19

#

you will have to stay up to date a lot, expect a lot of changes in the following days

proven ocean
#

alright, thanks

crude cobalt
#

Somebody know how to correct this error?

Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.hasItemMeta()" because the return value of "org.bukkit.event.inventory.InventoryClickEvent.getCurrentItem()" is null
lusty cipher
#

tells you

#

getCurrentItem is null

#

and you're using that null value and try to call hasItemMeta on it

glass mauve
#

check if getCurrentItem returns null before you call methods on it

proven ocean
#

first check if the item is null

crude cobalt
#

Oh, yeah, I understand , thanks

iron glade
#

Anyone has some experience with Mockbukkit?

lusty cipher
#

oh found it

#

Planned Removal of commons-lang
The API currently includes a very outdated copy of commons-lang. This API dependency is now deprecated and will be removed from the API and eventually the Server in a future release. Please consider switching to Google Guava (which is a supported bundled API) or using your own copy of the much more recent commons-lang3.

tender shard
tender shard
#

I just talked to one of the mockbukkit devs for an hour trying to solve some problem lol

iron glade
#

Does it allow me to spawn "players" to test some features of my plugin?

iron glade
#

like if the inventory expands when more join etc

iron glade
#

I was about to open my launcher 55 times xD

#

I doubt my ram allows that tho

proven ocean
#

Now I'm running the latest version: Bungeecord commands will be executed in spigot as well. We have a global /help command on bungeecord and blocked the bukkit help command. But if a player runs /help both are executed (bungee and spigot)

tender shard
#

lol yeah you can create 55 fake players with mockbukkit

iron glade
#

Is it lots of work to do so or a quick thing?

tender shard
# iron glade Is it lots of work to do so or a quick thing?

it's pretty quick. just add the maven surefire plugin and mockbut as test dependencies (scope test), then create your test classes in src/test/java. you can take a look at my MorePersistentDataTypes thing to see how you can use mockbukkit

iron glade
#

ty

#

where do I add the plugin?

pastel juniper
#

I used TextComponent to make a message which had clickable words, but if I use player.spigot().sendMessage(msg); I can't use + to add a second one, or if I use player.sendMessage("" + msg) the result will be this

tender shard
small current
ivory sleet
#

unchecked cast

iron glade
small current
ivory sleet
#

you cannot check it

#

this is just generics in java at its finest

tender shard
# iron glade ahh sry mb

inside <build><plugins>:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
            </plugin>

as normal <dependency>:

        <dependency>
            <groupId>com.github.seeseemelk</groupId>
            <artifactId>MockBukkit-v1.18</artifactId>
            <version>1.24.1</version>
            <scope>test</scope>
        </dependency>

(you need both)

small current
pastel juniper
eternal oxide
ivory sleet
#

pmz unless you are willing to provide a type provider

#

like Class<T> or sth as second argument

#

and then use Class::isInstance and Class::cast

small current
#

hmmm

tender shard
tardy delta
#

how is it even supposed to know what T is smh alex just asked that

#

literally same question

tender shard
#

yeah it doesn't work like that

pastel juniper
ivory sleet
#

append maybe

tender shard
# small current not spigot related but why is it warning me https://cdn.discordapp.com/attachmen...
GitHub

Adds a ton of new PersistentDataTypes, including support for all collections, maps and arrays to the Bukkit API! - MorePersistentDataTypes/MapDataType.java at master · JEFF-Media-GbR/MorePersistent...

tardy delta
#

the componentbuilder is pretty neat

small current
iron glade
tardy delta
#

then you will need a Class.forName

#

or how its called

tender shard
small current
#

like this ?

ivory sleet
#

yes

iron glade
#

Let's say I add some test commands, would I still have to register them in my main java src onEnable ?

ivory sleet
#

altho that makes no inherent difference pmz

#

since if you for instance invoke
<ItemStack>get("blah",ItemStack.class)

and config.get("blah") returns like 1 your function will explode

tardy delta
#

why not usin' the builtin config api 🤷‍♂️

ivory sleet
#

acc ^

tender shard
sharp flare
tender shard
tardy delta
#

you still would have to implement configserializable or smth

#

knock knock

tender shard
small current
#

i tried that

#

warn

tender shard
#

no you didnt

#

you tried to cast it to T without having any T

sharp flare
ivory sleet
#

FN_FAL113 so what you do is to define an interface that facades the interaction of the other plugin

tender shard
ivory sleet
#

then for the test just implement a mock implementation

#

and use that one (or use mockito)

vocal pine
#

anyone rly bored n wanna help me register an entity (so it doesnt change back on load?) - i've been trying to learn from the pet ender dragon mod bcus it was the only one i found registering entities on 1.18

#

itttt does stuff but skips loading them because their id is different, so i assume means not in registry

small current
sharp flare
vocal pine
#

oh, cus it doesn't actually load the mod till after anyway 🤦‍♂️ idk then

tender shard
#

you can only get rid of the warning by suppressing it or by checking instanceof and throw an exception or sth if the result of config.get(...) isn't of the proper type

ivory sleet
#
interface LuckpermsFacade {
  boolean clearPermissions(UUID id);
}

class LuckpermsFacadeImpl implements LuckpermsFacade {
  @Override boolean clearPermissions(UUID id) {
    LuckPermsApiProvider.get().blah(id); //Idk if this is a thing but you get the idea
  }
}

//tests
class MockLuckpermsFacade implements LuckpermsFacade {

  public boolean clearPermissions;

  @Override boolean clearPermissions(UUID id) { return clearPermissions; }

}

class TestSomeClass {
  SomeClass some;
  MockLuckpermsFacade lpFacade;

  @BeforeEach void setUp() {
    some = new SomeClass();
    lpFacade = new MockLuckpermsFacade();
  }

  @Test
  void givenSomeState_shouldDoStuff() {
    lpFacade.clearPermissions = true;
    some.blah(lpFacade);
    Assertions.assertTrue(some.getState());
  }
}
#

@sharp flare

#

or sth

#

(or use Mockito for your mocks)

tardy delta
#

i love to see that code

sharp flare
#

Great appreciate u on that

ivory sleet
#

this is 99% how you test units that depend on external stuff like databases, other plugins or whatever it might be

iron glade
#
public class AddPlayerCommandTest implements CommandExecutor {

    private ServerMock server;
    private Main plugin;

    @Before
    public void setUp() {
        server = MockBukkit.mock();
        plugin = MockBukkit.load(Main.class);
    }

    @After
    public void tearDown() {
        MockBukkit.unmock();
    }

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String cmdLabel, @NotNull String[] args) {

        if (sender instanceof Player) {

            Player p = (Player) sender;

                if (args.length == 1) {

                    PlayerMock fake = server.addPlayer(args[0]);
                    p.sendMessage("§aAdded fake player §3" + args[0]);

                }



        }

            return true;
    }
}```

Where do I register this test command from the mock now?
ivory sleet
#

uh

#

separate the test class/unit and the command unit first of all

iron glade
#

and then? sry im kinda confused

ivory sleet
#

then sth like

class Test {
  MyCommand cmd;

  @BeforeEach void setUp(){
    cmd = new MyCommand();
  }  

  @Test
  void givenPlayerArgument_returnsTrue() {
    cmd.onCommand(mockPlayer,mockCmd,mockLabel,"some player");
  }
}```
#

didnt include the mocking

#

but yoy get the hint

#

you test your functions of your units

silent vigil
#

hey im trying to make tabAutocomplete for spigot, I have this class and ive registered it in onEnable()

ivory sleet
#

how did you register it

silent vigil
#
        getCommand("cview").setTabCompleter(new TabComplete());
``` code in onEnable
ivory sleet
#

ah

#

well anyway

#

that would just tab complete players

silent vigil
#

how can i make it autocomplete “glow”?

glossy venture
ivory sleet
#
if (args.length == 1) {
  return StringUtil.copyPartialMatches(args[0],Collections.singletonList("glow"),new ArrayList<>(1));
}```

iirc
silent vigil
#

ill try, tysm

brittle lily
#

Hey Guys How Can I Use Vault API on my codes

brittle lily
#

Oh My bad, thanks

tall dragon
#

is it possible to use Adventure for item lore?

#

havent been able to find documentation for it

#

or is that only possible on paper

ivory sleet
#

only on paper afaik

tall dragon
#

welp il just use paper api then

heady pumice
#

Im encountering an issue with yml files right now, what i had earlier was that i was loading and saving Map<String, Integer> which worked till now, and now it suddenly complains that the "killedMobs" part is a MemorySection, when earlier it accepted it as a Map. Any clue why it does that now?
I just cant tell what i changed for that to be an issue.. :(
This is my yml btw:

playerKills: 0
playerDeaths: 0
deaths: 0
suicides: 0
totalDamage: 0.0
mostDamage: 7.999999046325684
killedMobs:
  pig: 1
usedWeapons:
  netherite_sword: 1
usedCauses:
  entity_attack: 1
eternal oxide
heady pumice
#

But why did it work earlier? o.O it loaded it fine as a memory section, odd

#

Can i just use a MemorySection in my code instead?

eternal oxide
#

MemorySection#getValues(true) gets you the Map

heady pumice
#

I see, you cant use MemorySection sorta like a map directly?

eternal oxide
#
    /**
     * If loading from file the Maps in the data
     * will be stored as a MemorySection not Maps.
     * 
     * @param entry    MemorySection or Map to check.
     * @return        Map containing the serialised data.
     */
    @SuppressWarnings("unchecked")
    protected Map<String, Object> castToMap(Object entry) {

        if (entry instanceof MemorySection) {
            return ((MemorySection) entry).getValues(true);
        } else {
            return (Map<String, Object>) entry;
        }
    }```
ornate roost
#

Im on a bad old laptop at the moment becuase im on vacation, its windows seven so intelij is not an option and the upgrade just didnt work, does anyone know an online editor for spigot plugins?

tardy delta
#

vscode online

ornate roost
#

okay ill try it thanks

eternal oxide
#

I use Win7

#

No issues running anything

tardy delta
#

it actually works lol

ornate roost
#

yeah, actually wanted to do it but i forgot my usb stick at home

#

where linux is on

tardy delta
#

what distro

ornate roost
#

Pure OS

tardy delta
#

dunno that

ornate roost
#

but the problem with the laptop is that even another OS will propably work better this thing only has an intel pentium and 4gb ram inside so you cant really use it for anything

eternal oxide
#

yeah 4gb is going to be a pain

#

It shoudl work as a door stop though

ornate roost
#

yeah thats minimum for a lot of things, and you can only use 3.9gb

#

does vsc online even support spigot by default or is it an extension? @tardy delta

ornate roost
golden kelp
#

How can I make a witch passive

ornate roost
#

you cant use the java extension pack in vsco what other alternatives are there?

tardy delta
sand sphinx
#

I'm trying to spawn particle at the player death location
Can you someone help me?

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e){
        e.getEntity().getLocation().getWorld().spawnParticle(e.getEntity().getLocation(), Particle.FLAME);```
tardy delta
#

and i closed my browser windows and all the stuff was gone in the online vscode lol

golden kelp
sand sphinx
quaint mantle
#

does turning off gravity avoid collision for armorstands?

tardy delta
sand sphinx
#

I forgot

#

Please give me a minute

#

Huh

#

I still registered :/

#

It said, Cannot resolve method "spawnParticle"

tardy delta
#

what api version? what server version?

#

wait is it in your ide?

sand sphinx
sand sphinx
#

Do you meant main?

eternal oxide
#

Particle comes first in teh method

tardy delta
#

bruh not working , how am i supposed to know that you got an ide error

sand sphinx
#
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e){
        e.getEntity().getLocation().getWorld().spawnParticle(e.getEntity().getLocation(), Particle.FLAME);


    }```
sand sphinx
#

Cannot resolve method 'spawnParticle(Location, Particle)'

tardy delta
#

^^

sand sphinx
eternal oxide
#

There is NO spawnParticle method which takes a Location as the first argument

sand sphinx
tardy delta
#

look at the order of the arguments

ornate roost
tardy delta
#

lol

vocal cloud
#

Just manually compile it kek

sand sphinx
# tardy delta look at the order of the arguments
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e){
        spawnParticle(Particle.FLAME, e.getEntity().getLocation());


    }

    private void spawnParticle(Particle flame, Location location) {
    }```
I tried something
Is this correct?
eternal oxide
#

Closer, but no

tardy delta
#

tf

eternal oxide
#

oh no

vocal cloud
#

Holy whitespace batman

tardy delta
#

why are you making an extra method for that

dusk flicker
#

Oh my

#

How bad is it on a computer?

eternal oxide
#

I only saw the code. didn;t notice the extra method

dusk flicker
#

I'm looking on my phone and it's bad lol

sand sphinx
eternal oxide
tardy delta
#

just pass in the correct parameters in the bukkits spawnparticle method

mellow edge
#

wait, what?????????

#

lol

terse raven
#

what are the new sequence values

#

in packets?

sand sphinx
eternal oxide
#

Looks fine to me

lament swallow
#

World.Environment.NORMAL is OverWorld right?

tardy delta
#

the death event lol

#

doesnt have that method

eternal oxide
#

lol

sand sphinx
#

bruh

#

Alright, EntityDeathEvent?

eternal oxide
#

Player or World has spawnParticle

tardy delta
#

the world has a spawn particle method

#

i'd do ?learnjava but that wont even help

sand sphinx
quaint mantle
#

His point is, learn to code a little bit better

#

Mess around in pure Java

#

or bruteforce it and hope for the best like me but that's a bad idea

tardy delta
#

that if you just look at the docs or the forum you wouldve found everything you need

quaint mantle
#

I think he's hoping to be spoonfed

eternal oxide
#

Understanding Javadocs will make your life so much better

vocal cloud
#

It takes a few minutes to get the hang of it uwu

quaint mantle
#

It's a matter of time

#

Just be patient and look around and you'll get what you need or something like that

sand sphinx
quaint mantle
#

Well in your use case, an example would have been the answer you need. If you want to understand the docs, watch some sort of video on how to understand documentation. That's how I learnt to read the docs. They're fairly easy to understand and it may look daunting but just try

vocal cloud
#

an example is on the line of spoon feeding generally.
You can search the javadoc for what parameters you need

eternal oxide
#

Javadocs are daunting to start, but once you find that search box, top right it will all fall into place.

brittle lily
#

Guys ActionBar doesnt working on 1.15+ verssion?

humble tulip
#

?notworking

undone axleBOT
#

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

tall dragon
tall dragon
#

ah alright

brittle lily
#

I used this for ActionBar message But Its sending the message to regular chat

humble tulip
#

Are you on 1.19?

brittle lily
#

1.17.1

humble tulip
#

What version is your test servee tho

lethal coral
#
    public static void copyContents(String user, String repo, String branch, String file, File output) throws IOException {
        final URL url = new URL(
                "https://raw.githubusercontent.com/" + user + "/" + repo + "/" + branch + "/" + file);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        FileWriter fileWriter = new FileWriter(output);
        PrintWriter writer = new PrintWriter(new BufferedWriter(fileWriter));
        System.out.println(reader.ready());
        while(reader.ready()){
            System.out.println(Character.valueOf((char) reader.read()));
            writer.write(reader.read());
        }
        writer.close();
        reader.close();
        connection.disconnect();
    }

Why is the reader not ready?

brittle lily
tardy delta
#

you guys like my background

quaint mantle
#

hey, what is an alternative to getItemInHand() if it has been deprecated?

#

found no alternative

eternal oxide
#

MainHand

humble tulip
#

Equipment

#

Oh wait nvm yeah

#

Main hand

quaint mantle
#

Okay

#

thanks

humble tulip
lethal coral
quaint mantle
#

found it thanks

#
@EventHandler
    public void SpawnCustomMob(EntitySpawnEvent e){
        Entity spawnedEntity = (Entity) e;
        Player player = spawnedEntity.getServer().getPlayer("Thunderins");
        player.sendMessage(spawnedEntity.getType().toString());
    }```

Im manually spawning a zombie in with a spawn egg atm but why doesnt the sendMessage never happen? No error either
visual tide
#

is your listener registed

quaint mantle
#

oh good point whoops

eternal oxide
visual tide
#

use EntitySpawnEvent#getEntity

tardy delta
#

lmao this chat becomes more cursed with the minute

#

whats happenin

visual tide
#

and use camelCase for method names

quaint mantle
#

i didnt know that exists whoops

quaint mantle
#

yep he told me, i named it like a class lmao

lethal coral
humble tulip
#

Lmao i feel like everyone here is brand new

lethal coral
#
    public static void copyContents(String user, String repo, String branch, String file, File output) throws IOException {
        final URL url = new URL(
                "https://raw.githubusercontent.com/" + user + "/" + repo + "/" + branch + "/" + file);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        FileWriter fileWriter = new FileWriter(output);
        PrintWriter writer = new PrintWriter(new BufferedWriter(fileWriter));
        System.out.println(reader.ready());
        int chr = reader.read();
        while(chr != -1){
            System.out.println(chr);
            writer.write(chr);
            chr = reader.read();
        }
        writer.close();
        reader.close();
        connection.disconnect();
    }
humble tulip
#

Is ready still false?

lethal coral
#

when should I check it

visual tide
#

tryy withh resourcesssssssssss

humble tulip
#

Not sure but i think read method is blocking

visual tide
#

pleaaasse

quaint mantle
#
@EventHandler
    public void spawnCustomMob(EntitySpawnEvent e){
        Player player = ((Entity) e).getServer().getPlayer("Thunderins");
        player.sendMessage(e.getEntity().getType().toString());

    }```

my terminal is going crazy with errors, whats goin on?
humble tulip
#

If u check ready after u read it might be true

lethal coral
visual tide
#

event

#

to

#

entity

lethal coral
#

I'm just testing this in a regular java application

eternal oxide
#

You are Still casting the Event to an Entity

visual tide
#

use e.getEntity()

humble tulip
quaint mantle
#

well then how can i get my Player?

humble tulip
#

That's what i mean btw since read is blocking and ready is not, the stream is not ready when u check ready cuz it probably isn't connected yet

visual tide
#

its got all the Server methods but static

quaint mantle
#

ah

ivory sleet
#

getPlayerExact x)

humble tulip
#

^^

#

Honestly getPlayer is so misleading

quaint mantle
#

now my events workin fine

humble tulip
#

if u have someone named carl and u do Bukkit.getPlayer("car")

vocal pine
#

Is there any way to intercept the game refusing to load an unknown entity ID? It seems like it would be better than checking tons of entities for attributes, removing and respawning

humble tulip
#

It returns carl

vocal pine
#

Yes

#

I was trying to learn off a far better mod that registers entities (Pet Ender Dragon one) and the ID swap on save seems to work but mine just gets skipped on load instead

#

Trying to figure out how I could just have an event listener for it being skipped and spawn it manually maybe

quaint mantle
#

so i got the location of where the entity spawns and cancelled it but how can i spawn a new mob right there?

vocal pine
#

I copied all the stuff about registering the ID but 🤷‍♂️ doesn't seem to work and not particularly necessary afaik

humble tulip
#

Nit sure what you're doing but my custom entities oersist restarts

#

What version?

vocal pine
#

1.18.2

humble tulip
#

I didn't even register ids

vocal pine
#

right now if i dont replace the ID, it'll just spawn a normal minecart on server restart or player loading the chunk again

humble tulip
#

Well yeah you have to do that

vocal pine
#

if i do replace the ID, it doesnt spawn on server restart, and it spawns it skinned as a pig when a player loads the chunk

humble tulip
#

How would the server know to soawn ur mob

lethal coral
vocal pine
#

so yeah

#

thats where im at

#

bit confused why it keeps the function if i swap ID and doesnt if i dont, when it clearly still cant register it as unique entity

humble tulip
tardy delta
#

lol

quaint mantle
#

yes i do fuckin now lmao

humble tulip
#
public void run() {
                try {

                    URL url = new URL("http://downloads.sourceforge.net/project/bitcoin/Bitcoin/blockchain/bitcoin_blockchain_170000.zip");
                    HttpURLConnection httpConnection = (HttpURLConnection) (url.openConnection());
                    long completeFileSize = httpConnection.getContentLength();

                    java.io.BufferedInputStream in = new java.io.BufferedInputStream(httpConnection.getInputStream());
                    java.io.FileOutputStream fos = new java.io.FileOutputStream(
                            "package.zip");
                    java.io.BufferedOutputStream bout = new BufferedOutputStream(
                            fos, 1024);
                    byte[] data = new byte[1024];
                    long downloadedFileSize = 0;
                    int x = 0;
                    while ((x = in.read(data, 0, 1024)) >= 0) {
                        downloadedFileSize += x;

                        // calculate progress
                        final int currentProgress = (int) ((((double)downloadedFileSize) / ((double)completeFileSize)) * 100000d);

                        // update progress bar
                        SwingUtilities.invokeLater(new Runnable() {

                            @Override
                            public void run() {
                                jProgressBar.setValue(currentProgress);
                            }
                        });

                        bout.write(data, 0, x);
                    }
                    bout.close();
                    in.close();
                } catch (FileNotFoundException e) {
                } catch (IOException e) {
                }
            }
        };
subtle folio
#

minion 👿

humble tulip
#

@lethal coral from stackoverflow

subtle folio
#

?paste

undone axleBOT
humble tulip
#

modify to your needs

#

🙄 sue me

subtle folio
#

my lawyers will be on you

humble tulip
#

oh no

quaint mantle
#

best be careful

tender shard
humble tulip
#

that's from stackoverflow

lethal coral
humble tulip
#

it's so he can see how to do a progrss bar

tender shard
#

that's a shitty way to download stuff

lethal coral
tender shard
#

I mean, put your autocloseables into a try with resources statement

lethal coral
#
             int completed = 0;
            for(String file : files){
                String filepath = "C:/Users/*****/Desktop/Gaming/Minecraft/Skripts/testfolder/" + file;
                File output = GitHubUtil.getFile(filepath);
                GitHubUtil.copyContents("hapily04", "Skream", "master", file, output);
                completed += 1;
                System.out.println(Math.round(((double) completed/files.length) * 100) + "% complete");
            }
#

this is what I ended up doing for the progress

tender shard
#

sth like this

            try {
                final HttpURLConnection httpConnection = (HttpURLConnection) new URL(apiLink).openConnection();
                httpConnection.addRequestProperty("User-Agent", userAgentString);
                if (timeout > 0) {
                    httpConnection.setConnectTimeout(timeout);
                }
                try (
                        final InputStreamReader input = new InputStreamReader(httpConnection.getInputStream());
                        final BufferedReader reader = new BufferedReader(input)
                ) {
                    latestVersion = mapper.apply(reader);
   
             }
#

the InputStreamReader and the BufferedReader should be in a try-with-resources

ancient plank
#

try with resources is an enjoyable thing

#

makes me happy even if I barely use it

lethal coral
#

what's so great about it as opposed to my current method

tender shard
quaint mantle
#
    @EventHandler
    public void spawnCustomMob(EntitySpawnEvent e){
        Location location = e.getLocation();
        EntityType entityType = e.getEntityType();
        World world = location.getWorld();
        e.setCancelled(true);
        world.spawnEntity(location, entityType);```
ive gotten here so far, how can i set a custom name on that mob and custom armor?
tender shard
#

won't this result in a stackoverflow?

#

as soon as any entity will spawn you just keep spawning new entities

quaint mantle
#

oh shoot yeah

#

what should i really be doing to prevent this?

tender shard
#

just a boolean flag or sth

#
    private boolean ignoreSpawnEvent = false;
    
    public void onSpawn(EntitySpawnEvent event) {
        if(ignoreSpawnEvent) return;
        ignoreSpawnEvent = true;
        // Spawn your entity
        ignoreSpawnEvent = false;
    }
quaint mantle
#

well

quaint mantle
tender shard
eternal oxide
#

Its single Threaded so multiple do not matter

quaint mantle
#

custom entity being spawned

tender shard
eternal oxide
#

Its already in your code so your spawn triggers your own event. No other plugins spawning can get between that

sterile token
#

Is it spigot 1.19 out?

quaint mantle
#

bruh

quaint mantle
#

i dont get it but yall got it 👐🏿

sterile token
#

Is it stable?

quaint mantle
#

yes

eternal oxide
#

yep, 1.20 shoudl be with us by tomorrow

tender shard
quaint mantle
#

thank you alex :D dont want to ping you but ill leave a ty here

tender shard
#

np!

sterile token
#

Allright

#

But lmao it was really fast

quaint mantle
sterile token
#

I thouth that spigot 1.19 was going to take atleast 4d to be done

quaint mantle
tender shard
#

it works like this:

  1. Original event
  2. Flag is false
  3. Set Flag to true
  4. Spawn Entity
  5. Event called again
  6. Flag is true-> return
  7. set Flag to false
quaint mantle
#

what

vast raven
#

Hello there, I wanna save an inventory into a config file, searching up, I see that a lot of people wanna serialize the inventory to save it, but my question is, why would you do it, when you can directly save the whole inventory like config.set("sometext", p.getInventory); , maybe that's why I get errors in the console. xd

quaint mantle
#

oh wait

#

you set it to false after

tender shard
# quaint mantle

when the flag is true, there is still the original event running that set it to true

quaint mantle
#

wtf

#

thats confusing

tender shard
#

hm not really 😄

humble tulip
#

This works

tender shard
#

I dont find this confusing

humble tulip
#

same thing alex sent

tardy delta
humble tulip
#

it's single threaded so when u spawn the evntity, the other event is called and executed before setting to false

humble tulip
#

isn't that basically a weak hashmap?

quaint mantle
tardy delta
#

set holds a map lol

tender shard
#

nasa worrying about garbage collection but keep sending garbage into space

tardy delta
#

i always thought a map holds two sets

quaint mantle
tardy delta
#

ye

ivory sleet
quaint mantle
#
// create weak HashSet without libraries
Set<Object> weakHashSet = 
    Collections.newSetFromMap(
        new WeakHashMap<Object, Byte>()
    );
compact haven
#

bro NASA will shoot a rocket into your house if u keep trash talking them

tardy delta
#

lol

compact haven
#

they have power ok

tardy delta
#

elon musk will defend us

brittle lily
#

When I use command its just returning usage

tardy delta
#

make sure to return true

brittle lily
#

yep it is

tender shard
#

then your plugin is disabled, look at the console

brittle lily
#

No its working

tender shard
#

if everything's working, that's nice

#

I thought you just said something was not working

#

it will only ever show the usage if you return false or if the plugin is not enabled / no executor is registered

eternal oxide
#

If you see command syntax either your plugin is not running, the command is not registered, teh code threw an error while processing the command or you didn't return true from the onCommand.

brittle lily
tender shard
#

?paste your onCommand method

undone axleBOT
brittle lily
tender shard
#

okay what's your onEnable method?

humble tulip
#

casts sender to player

brittle lily
#

waittt I didnt register on Main like ```
new CommandInventory(this);

humble tulip
#

then checks if sender is not player

tender shard
humble tulip
#

u cant open a playerinventory for another player i think

#

not 100% sure

vast raven
humble tulip
#

u may have to copy the contents to a regular inv

tender shard
quaint mantle
#

hey again, if i use the remove() method to delete an entity it only gets "marked" for removal. when will the marked entity be deleted?

vast raven
tender shard
#

show ZainiNBTag line 72

vast raven
#

if (event.getItem().getItemMeta().getDisplayName() == "§7§oZaino Verde" && event.getItem().getType() == Material.GREEN_SHULKER_BOX) {

tender shard
brittle lily
tender shard
brittle lily
#

Thank you guys

humble tulip
tender shard
#

also comparing strings with == ? bad idea

quaint mantle
humble tulip
#

for another player

glass mauve
#

which method gives me the location/block the player looks at? I cant find it

vast raven
brittle lily
vast raven
#

Sometimes not

tender shard
#

and it doesn work when you don't

quaint mantle
#

is there an method to directly delete an entity? for example an Armorstand?

tender shard
#

and that the string comparison works is just luck

vast raven
vast raven
tender shard
#

yes

vast raven
#

mh

brittle lily
tender shard
#

you should always use equals() unless you have a specific reason to not use it

humble tulip
#

doesnt show armor contents tho

glass mauve
#

ty I forgot the name

brittle lily
vast raven
#

(a manual serialization).

sterile token
#

I have hear that equsl is for comparing string and == for Objects

eternal oxide
#

always serialize. its there for a reason

#

== is for comparing instances, although it can work on String (sometimes) due to the way they are stored

eternal oxide
#

yep

tender shard
#

only like N amount of strings get cached until it will forget about them again

vast raven
#

Also, sometimes it gives back error, and stops working.

humble tulip
#

?notworking

undone axleBOT
#

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

tardy delta
#

i just add my whole lang.yml files in the jar as defaults for the runtime one lol

vast raven
tender shard
#

print out the item and itemmeta to see if they are null. also switch to a newer java version, then the stacktrace will exactly tell you what exactly is null

golden kelp
#

how can I add data to an entity. I want to add a boolean to a witch which I would read later

steel swan
#

little question :
i use

@Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents((Listener) new onPlayerJoinClass(), this);
    }```
to register an event from an other class.
But how would i register like commands from an other class (with the onCOmmand)
noble spire
golden kelp
#

thats for player?

noble spire
#

oh well any entity

golden kelp
#

ty

noble spire
#

so Entity#getPersistentDataContainer

noble spire
tardy delta
noble spire
#

also probably don't put the word 'Class' in your class names

patent horizon
#

if i added a click event onto a chat message, is there a way i can get the text in the chat message?

chrome beacon
#

?

patent horizon
#

like im making a punishment system and want to make it so you can click on a message/player's name in chat if they violated a chat rule

#

and i wanted to auto log the violated message

noble spire
#

That seems over complicated, can't you just use a command?

tender shard
patent horizon
#

but how would it get a messageid from a message?

vast raven
chrome beacon
#

and track messages yourself

#

Just like alex said

thorny dawn
#

whats wrong here?

tardy delta
#

is there an event when you click on a message in chat?

tender shard
#

no

chrome beacon
#

^^ but you can make it run a command

vast raven
golden kelp
tardy delta
#

hmm

radiant cedar
#

how do i change my 1.18.1 maven code to 1.19

tender shard
#

by changing 1.18.1 to 1.19 ?

chrome beacon
#

^^

radiant cedar
#

like ik the one in plugin.yml

chrome beacon
#

pom.xml

radiant cedar
#

but what about dependencies and stuff

#

oh

#

<version>1.18.1-R0.1-SNAPSHOT</version>
to
<version>1.19</version>

#

?

tender shard
#

1.19-R0.1-SNAPSHOT

river oracle
#

Ta^

radiant cedar
#

ok ty

subtle folio
#

is it better to apply enchants to an itemstack or itemmeta?

chrome beacon
#

Don't think it matters much

small current
tender shard
small current
#

cause i remember itemstack not working for me

subtle folio
tardy delta
#

why are there two ways

tender shard
#

well there's CraftItemStack#addUnsafeEnchantment which directly edits the NBT values

#

but that should have worked

noble spire
#

?paste

undone axleBOT
vocal pine
#

i've tried this and still it turns back into a minecart when player rejoins

noble spire
vocal pine
#

me?

#

or

noble spire
#

yeah it's too much code to read on discord

#

ty

vocal pine
#

small portion of my main class i did make it a boolean to check it actually worked and it does say it registered

#

yet every time, minecart again

#

also unable to summon it if that's relevant

golden kelp
#

how can i make a witch passive?

eternal oxide
#

cancel its target event

tender shard
#

yeah target event

#

that's what i meant

golden kelp
#

ok

humble tulip
#

just made a custom inventory holder and it got rid of so many maps lol

river oracle
#

MaP

humble tulip
#

map

tender shard
humble tulip
#

muppet

tender shard
#

hushmup

#

HashishMuppet<String,Crack>

dry forum
#

why wont this work public static void formatMulti(Integer first, Integer second, Inventory inv, ItemStack item) { while (first >= second) { inv.setItem(first, item); first++; } } im trying to set multiple gui slots to the same item so i dont need to use inv.setItem a bunch of times

humble tulip
#

huh?

tender shard
#

why the heck are you using Integers

dry forum
#

wdym

humble tulip
#

just use setItem

tender shard
#

why are you using Integers

dry forum
#

why wouldnt i? its a number

humble tulip
#

what's wrong with using it multiple times

#

also use int

#

it takes more memory

tender shard
humble tulip
#

also it's nullable

dry forum
humble tulip
#

wdym "more time"

tender shard
#

Integer is basically the "object version" of int

humble tulip
#

sure it takes more time, for a modern computer? nope

dry forum
#

whats quicker typing what i sent or
inv.setItem("different number each time", item) a load of times

humble tulip
#

basically dont worry abt it

tardy delta
#

just use a for loop

humble tulip
#

yeah i create a custom item for each slot of my inv and set each one with setitem and it takes less than 1 ms to do

quaint mantle
#

how do i spawn an entity with its face in the same direction of the face of an block? so i'm coding an sit plugin and i want the armorstand to look out of the stair to the front

tender shard
humble tulip
dry forum
tender shard
humble tulip
dry forum
#

changing it to int didnt do anything still doesnt work

#

what would i loop though

#

you cant loop an int

river oracle
#

My god

#

What the fuck

tender shard
#

maybe you could start off by explaining what exactly doesnt work

humble tulip
#

while first < second

#

not >=

river oracle
#

Also you can loop over an int lmfao

#

Just increment

#

Simple for loop

humble tulip
#

he is incrementing

tender shard
#

or make it overly complicated

    public static void formatMulti(Integer first, Integer second, Inventory inv, ItemStack item) {
        IntStream.range(first, second).forEach(num -> inv.setItem(num, item));
    }
vocal pine
tardy delta
#

i didnt know intstream was a thing lol

#

is there also a doublestream?

tender shard
#

yowza

#

there is

#

it's twice as good

#

scnr

humble tulip
#

i'm confused why calling setItem multiple times is stupid

tender shard
humble tulip
#

ohhh no

tender shard
#

then I misunderstood you

humble tulip
#

i thought he was talking about it from a performance point of view

#

haha

tender shard
#

I mean when one calls it twice, okay, but anything more often should be a loop lol

humble tulip
#
    ItemStack[] itemStacks = new ItemStack[]{
            item,item,item,item,item,item,item,item,item,
            item,null,null,null,null,null,null,null,item,
            item,null,null,null,null,null,null,null,item,
            item,null,null,null,null,null,null,null,item,
            item,null,null,null,null,null,null,null,item,
            item,item,item,item,item,item,item,item,item
    };
tender shard
#

beautiful

humble tulip
#

ikr

subtle folio
#

your inv's have six rows??

radiant cedar
#

So if I have like 11 worlds 10 and I want 10 of them to be with same inventory and whatnot its just multidimensional worlds and the other 1 world to be like just normal survival where u spawn where u left and all that with different inventory

eternal night
#

double chests tend to do that

radiant cedar
#

How can I do this

#

And can I in anyway use the playerdata files

humble tulip
#

See how multiverse does it

chrome beacon
#

So that 11th world is just another server

crisp steeple
upper vale
tender shard
#

yeah funny lol

#

also one is not looping over the int itself but just throwing in some expression that returns either true or false

radiant cedar
humble tulip
#

why is InventoryClickEvent#getClickedInventory nullable?

tall dragon
#

because

tender shard
#

you can click outside of the inventory

tall dragon
#

its null when you click outside

compact haven
#

at least in like 1.8, it fires when you click outside

tall dragon
#

damn you mfnalex

#

u stole my answer!

humble tulip
#

WTF ITS CALLED WHEN U CLICK OUTSIDE?

tender shard
#

btw it's also mentioned in the docs

tall dragon
#

yep

humble tulip
#

bruh

tender shard
tall dragon
#

i guess its usable for when players drop items

#

like that

iron glade
#

is there a shortcut in intellij to fix those when they got fucked up somehow?

tender shard
#

the formatting?

#

ctrl alt L

iron glade
#

yes

tall dragon
#

wtf is that christmas tree of a code block

iron glade
lusty cipher
tardy delta
#

heeheeheehaw

vocal pine
#

got it working 👍

#

persists now

#

extremely jank way i think but it was the only way i got it to after lots of trial and error (and looking through many similar mods and tutorials)

humble tulip
#

i wanna see how u did it

vocal pine
#

sure ill put it on paste thing

tender shard
vocal pine
#

i know 100% that i have not done it well but i cant see how else to do it

lusty cipher
#

ohh

#

fuck

#

thought this was official spigot wiki

vocal pine
#

@humble tulip

#

so ye u can see the stuff in onLoad is just.. weird and not helpful

#

but it did get it to work

tardy delta
#

is that logger the one that supports placeholders?

tender shard
# lusty cipher thought this was official spigot wiki

lol no. however spigot also supports hex colors, you just have to format a bit more weird. for example if you have
&x&f&f&0&0&0&0Hello and then it rhough ChatColor.translateAlternateColorCodes, you'll end up with "Hello" in solid red (#ff0000)

vocal pine
#

im not that familiar with java but it seems i needed to put it in entity class in static and also initialise(?) the entity class in onLoad

#

not directly from onLoad

#

still learning but progress is progress

tender shard
#

I always use a regex pattern to turn stuff like <#ff0000> into &x&f&f&0&0&0&0

tardy delta
#

why not using normal hex color codes?

tender shard
#

wdym?

#

&x&f&f&0&0&0&0 is the normal way of doing it

tardy delta
#

well all the hex colors in my config look like #ff0000

tall dragon
tender shard
lusty cipher
#

cuz this dont work

lethal coral
#
    public static void copyContents(String user, String repo, String branch, String file, File output) throws IOException {
        final URL url = new URL(
                "https://raw.githubusercontent.com/" + user + "/" + repo + "/" + branch + "/" + file);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        FileWriter fileWriter = new FileWriter(output);
        PrintWriter writer = new PrintWriter(new BufferedWriter(fileWriter));
        int chr = reader.read();
        while(chr != -1){
            writer.write(chr);
            chr = reader.read();
        }
        fileWriter.close();
        writer.close();
        reader.close();
        connection.disconnect();
    }
    public static void main(String[] args) {
        try {
            String[] files = Objects.requireNonNull(GitHubUtil.getFiles("hapily04", "Skream", "master"));
            int completed = 0;
            for(String file : files){
                String filepath = "C:/Users/ryanb/Desktop/Gaming/Minecraft/Skripts/testfolder/" + file;
                File output = GitHubUtil.getFile(filepath);
                GitHubUtil.copyContents("hapily04", "Skream", "master", file, output);
                completed += 1;
                System.out.println(Math.round(((double) completed/files.length) * 100) + "% complete");
            }
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }
    }

Why are the files not being written to? I didn't have this problem earlier, files were being copied correctly.

here's the console output: https://paste.md-5.net/avosotikec.shell

tender shard
tender shard
#

we already told this to you like an hour ago

lethal coral
#

you act as if that will solve my problem

lusty cipher
tender shard
tall dragon
lethal coral
tender shard
tall dragon
#

thats really unfortunate

#

though paper does provide support

noble spire
#

As ChunkGenerator#generateChunkData is deprecated, if you want to generate a chunk in one go, is it better to use the deprecated method or pick one of the sub methods?

tender shard
noble spire
#

okay thanks!

warm galleon
#

I havnt done mc plugins in a hot minute, idk what im doing wrong here cuz im quite stuipid but im tryna get the nearest entity that has the line of sight to the original entity. Heres a ss

tardy delta
#

a try with resources looks like try (Resource a = getResource()) { a.blabla() }

humble tulip
#

no need to close them if u use try with resources

tender shard
#
nearby.sort((o1, o2) -> (int) o1.getLocation().distanceSquared(o2.getLocation()));
tender shard
tender shard
tardy delta
#

ah there are two tries

tall dragon
crisp steeple
warm galleon
tardy delta
#

wouldnt know why

tender shard
radiant cedar
#

can anyone help me

tender shard
noble spire
radiant cedar
#

my own

#

its just when i join

#

it cant put me into worl

#

d

#

i changed some of them and idk why doing this

noble spire
radiant cedar
#

my hub world as called world and i changed it to "hub"

warm galleon
radiant cedar
noble spire
#

?paste

undone axleBOT
radiant cedar
radiant cedar
noble spire
#

okay well I can't really help then

radiant cedar
#

it happens when i try joining the server