#help-development

1 messages · Page 1735 of 1

slim kernel
#

if I do:

arrayList.get(arrayList.size)

Is this how I get the latest added one in the arrayList?

paper viper
#

No

#

You need to do -1

#

Everything starts with index 0 in Java

slim kernel
#

so the size start at 1 and the arrayList starts at 0?

ivory sleet
#

you use the wrong data structure if getting the last added element is important

slim kernel
ivory sleet
#

well, probably with a Dequeue

slim kernel
#

Okay I will try that thx

ivory sleet
#

common implementation is either ArrayDequeue or LinkedList

#

read about the different time and space complexities they have before deciding

fierce jolt
#

Would anyone know why this won't work? Casting it results in just using texture item/fishing_rod/bamboo_rod

#

Doesn't change texture at all. Texture file it self is fine

mortal hare
#

this..

#

deserves an award

quaint mantle
#

?

fierce jolt
pearl turtle
#

How can I set a projectile to follow a entity?

shadow tide
#

hey is there any reason this wouldn't work for a crafting recipe? https://paste.md-5.net/ovatowokon.java
and of course I am registering it with java Bukkit.addRecipe(new SharpRecipe().getRecipe());

sullen marlin
#

Seems ok

jovial nymph
#

does the function getHostName returns the ip?

shadow tide
sullen marlin
#

Feel like you want getHostAddress or someone

jovial nymph
#

found it ty gonna try it out

shadow tide
#

I have an item and this isn't working for me for some reason. meta.addEnchant(Enchantment.DAMAGE_ALL, 7, false);

tender shard
#

does anyone know how I can send a world border color change to players?

#

I'm currently just sending a packet to players every second for the world border

#

but when I change the color, players don't see the new color

#

I can change the border size without problems but player's don't see the new color

#

I'm currently using this to change the border every second:

    public void sendWorldBorder(Player player, Color color, double size, Location centerLocation) {
        WorldBorder worldBorder = new WorldBorder();
        worldBorder.world = ((CraftWorld) centerLocation.getWorld()).getHandle();
        worldBorder.setCenter(centerLocation.getBlockX() + 0.5, centerLocation.getBlockZ() + 0.5);
        
        worldBorder.setSize(size);

        worldBorder.setWarningDistance(0);
        worldBorder.setWarningTime(0);

        ((CraftPlayer) player).getHandle().b.sendPacket(new ClientboundInitializeBorderPacket(worldBorder));
    }
shadow tide
jovial nymph
#

does bukkit.getPlayer also returns offline player?

#

@tender shard

tender shard
#

?jd

jovial nymph
#

ok but why is offline player by name depricated?

tender shard
tender shard
#

because players can change their name so you should use UUIDs instead

jovial nymph
#

but how do i get a uuid from a name?

tender shard
#

by using the deprecated method 😄

jovial nymph
#

xd

tender shard
#

just because it's deprecrated doesnt mean that it will be removed

#

it just means you think twice about it when using it

#

like

jovial nymph
#

ok

tender shard
#

you CAN use it when you only have the player's name

#

but

#

you should instead think about why you don't have their UUID

jovial nymph
#

because banning ofline players you know?

tender shard
#

sometimes it's legitimate to use player names for offline players, e.g. when you have some kind of message plugin etc

tender shard
#

you can get the UUID of an offlineplayer

#

OfflinePlayer#getUniqueId

jovial nymph
tender shard
#

yeah sometimes you have to use it, don't worry about it

#

it will not get removed

jovial nymph
#

still i am only using uuid just for complete functionality i add name

young knoll
#

Do it async

#

It uses a blocking web call

echo basalt
#

To change color, seems like the following:

Expanding: green
Contracting: red
still: blue

#

I believe you should use this packet

jovial nymph
#

how do i cancel a join event? or do i just kick the player again

#

@tender shard

young knoll
#

Or one of the other various LoginEvents, they run before join

echo basalt
#

just use reflections

#

or do an nms hack

opal sluice
#

Hi, does anyone know how to block the player from moving his head while riding an entity ?

echo basalt
opal sluice
#

Not exactly what I mean ^^'

echo basalt
#

A weird complex hack is:

  • Spawn a fake player npc, riding the entity
  • Set the player to spectator mode
  • Force it to spectate the fake npc
opal sluice
#

You can't ride while being in spec mode ?

#

Do you ?

echo basalt
#

That's why there's a fake player npc

opal sluice
#

How would you send the input if you're on spec mode ?

#

Spec mode shouldn't send move packets

echo basalt
#

Try it

opal sluice
#

Ok I'll try it x)

echo basalt
#

you're asking to lock up game mechanics, you gotta face limitations yourself

opal sluice
#

Tbh, I was thinking about sending a entity_head_rotation packet with the corrected yaw/pitch to the player

echo basalt
#

that looks stuttery

opal sluice
#

Yeah I guess so

jovial nymph
#

how do i get plugin directory?

young knoll
#

I imagine you can do plugin.getDataFolder.getParent

#

Not sure why you need it though

earnest geyser
#

Hey! Is there a way to make a client not calculate lighting updates?

opal sluice
#

Do I really have to loop through the living entities and get it by comparing ?

jovial nymph
#

does someone know why ```public class JoinListener implements Listener {

@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerPreLoginMonitor(AsyncPlayerPreLoginEvent e) {
    if(BanList.getBanList().isPlayerBanned(e.getUniqueId()))
    {
        Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Banned player " + Bukkit.getPlayer(e.getUniqueId()).getName() + " tried to join");
        e.disallow(e.getLoginResult(), BanList.getBanList().getBanMessage(e.getUniqueId()));
    }else
        Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "Player " + Bukkit.getPlayer(e.getUniqueId()).getName() + " joining");
}

}``` doesnt get fired?

echo basalt
#

Yeah just loop

opal sluice
#

Oh ok

jovial nymph
echo basalt
earnest geyser
echo basalt
#

Client-side blocks are fun

earnest geyser
#

I'm sending the client a large amount of block changes, and it works flawlessly except for the fact that the client tries to calculate all the lighting then just dies on me

echo basalt
#

I believe the client will just use the Sky light if the block light doesn't exist (or is set to 0)

obtuse crane
#

hi, does anyone know the variable to create a top?

quaint mantle
#

?

echo basalt
earnest geyser
opal sluice
# echo basalt Yeah just loop

Well, if the entity is only client side, the server will not have it registered :/ So, can't find the actual entity
I've forgot to mention that the npc is spawned through packets also ^^'

jovial nymph
#

and can someone tell me why this e.disallow(e.getLoginResult(), BanList.getBanList().getBanMessage(e.getUniqueId())); still lets me join

#

pls?

tender shard
jovial nymph
tender shard
#

is it AsyncPlayerPreLoginEvent?

jovial nymph
#

yes

#

my code is the above

tender shard
#

okay first, you shouldnt use disallow on MONITOR prio

jovial nymph
#

ok

#

so remove it

tender shard
#

does the disallow() part actually get called?

#

use HIGHEST priority

#

but that shouldnt be the problem

jovial nymph
tender shard
#

hm that's strange, sorry I have no idea too then

#

all I can say is that it SHOULD work fine lol

jovial nymph
#

but it doesnt hm

tender shard
#

let me check too

#

it works fine for me

#
    @EventHandler
    public void disallow(AsyncPlayerPreLoginEvent event) {
        event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, "go fuck yourself");
    }

quaint mantle
#

you didnt have to kick them in such a nice way

tender shard
#

are you using a strange fork or sth @jovial nymph ?

jovial nymph
#

why disallow method

tender shard
tender shard
#

like paper, tuinity, ... ?

#

or are you using normal spigot as server software?

#

I tried it using paper #255 1.17.1

jovial nymph
#

i have spigot buildtools server

tender shard
#

but you have that in your code too so that's not the problem

jovial nymph
tender shard
#

the @EventHandler annotation tells spigot that this method should be called whenever that event is called

jovial nymph
#

i never learned annotations

tender shard
#

but you said that your disallow code definitely gets called

#

are you really sure about that?

jovial nymph
#

oh i found it i think

tender shard
#

what was it?

jovial nymph
#

that AsyncPlayerPreLoginEvent.Result.KICK_BANNED

#

i just take the result of the event

tender shard
quaint mantle
#

😂

tender shard
jovial nymph
tender shard
#

ooh

#

yeah that basically means you're setting it to allow

#

because it was ALLOW when you got the event

#

sooo

#

of course you have to set your own Result^^

#

you're just taking the allow result and use that again

jovial nymph
#

i didn't thought of this

tender shard
#

it should work fine when you explicitly use Result.KICK_BANNED

jovial nymph
#

it did ty

tender shard
#

np! Now go to paypal and send me many many $$$ for help lol

quaint mantle
#

look at mfnalex man

#

so inspirational

tender shard
#

😄

#

Im just trying to help 😦

opal sluice
#

Does someone know how to get the data serializer for the PacketPlayInSpectate with the entity id ?

shadow tide
#

is there a method to add a permission to a player?

#

something like Bukkit.getPerrmissions().add(permission) (obviously that doesn't exist)

#

wut is towny?

#

this channel is for making spigot plugins

brisk rampart
#

ooh

shadow tide
#

thx

vivid lion
#

np

shadow tide
#

sorry, I'm having trouble using it. can you give me some example syntax?

vivid lion
#

basically

#

all these inherit this interface

AbstractHorse, Ageable, Ambient, Animals, AreaEffectCloud, ArmorStand, Arrow, Bat, Blaze, BlockCommandSender, Boat, CaveSpider, ChestedHorse, Chicken, CommandMinecart, CommandSender, ComplexEntityPart, ComplexLivingEntity, ConsoleCommandSender, Cow, Creature, Creeper, Damageable, Donkey, DragonFireball, Egg, ElderGuardian, EnderCrystal, EnderDragon, EnderDragonPart, Enderman, Endermite, EnderPearl, EnderSignal, Entity, Evoker, EvokerFangs, ExperienceOrb, Explosive, ExplosiveMinecart, FallingBlock, Fireball, Firework, Fish, FishHook, Flying, Ghast, Giant, Golem, Guardian, Hanging, HopperMinecart, Horse, HumanEntity, Husk, Illager, Illusioner, IronGolem, Item, ItemFrame, LargeFireball, LeashHitch, LightningStrike, LingeringPotion, LivingEntity, Llama, LlamaSpit, MagmaCube, Minecart, Monster, Mule, MushroomCow, NPC, Ocelot, Painting, Parrot, Pig, PigZombie, Player, PolarBear, PoweredMinecart, Projectile, ProxiedCommandSender, Rabbit, RemoteConsoleCommandSender, RideableMinecart, Sheep, Shulker, ShulkerBullet, Silverfish, Skeleton, SkeletonHorse, Slime, SmallFireball, Snowball, Snowman, SpawnerMinecart, SpectralArrow, Spellcaster, Spider, SplashPotion, Squid, StorageMinecart, Stray, Tameable, ThrownExpBottle, ThrownPotion, TippedArrow, TNTPrimed, Vehicle, Vex, Villager, Vindicator, WaterMob, Weather, Witch, Wither, WitherSkeleton, WitherSkull, Wolf, Zombie, ZombieHorse, ZombieVillager
#

and to use it

shadow tide
#

I understand it

vivid lion
#

player.addAttachment(bluh bluh);

shadow tide
#

ooooh

#

thanks

#

I was being stupid

vivid lion
#

algoods we have our moments of doo doo

#

XD

shadow tide
#

I thought it was its own class 🤦‍♂️

young knoll
#

You’ll have to save it and stuff

#

I would advise just using the vault API

shadow tide
#

I will

opal sluice
#

How do you put a player in spectator on an other entity ? (not a bukkit entity, an nms entity)

#

Tried with PacketPlayInSpectate

#

With no luck

#
        PacketPlayInSpectate ppis = new PacketPlayInSpectate(ridable.getUniqueID());
        ((CraftPlayer)player).getHandle().b.a(ppis);
#

tried with that, but does nothing :/ (I'm in spectator mode)

young knoll
#

Does it take a uuid?

#

Normally they take a network id

opal sluice
#

ridable is a EntityPlayer

opal sluice
vernal pier
#

Can’t you just get the Bukkit entity from it and just work with that

opal sluice
#

Since it's not an actual spawned entity not really ^^'

vernal pier
#

Oh ok

#

Just to make sure it is spawned for the player right?

opal sluice
#

Yes, with packets

dry forum
#

quick question, so if i have a plugin that doesnt have any specific minecraft version imports like import stuff.1_18_R1.stuff for example, will my plugin just automaticly support 1.17 if i have a 1.16 plugin? is there anything else id need to do? ive looked at forums but all they say it how to make a plugin support multiple versions if there are version specific imports

obtuse crane
#

does anyone know about the code to create a tops command example that lists the first 5 or 10 places

dry forum
#

would it still work on 1.17 if i set my api-version to 1.16 in my plugin.yml? or would i just need to do no api-version

young knoll
#

It will work on anything at it above the API version

#

Assuming nothing in the API has changed, which it usually doesn’t

dry forum
#

alright thanks

obtuse crane
young knoll
#

A top what

#

The spigot API lets you make commands, it doesn’t include any

#

Well the server has a few, but that’s not the point

obtuse crane
# young knoll A top what

So I tried to find a base, to guide me to make a top of the 10 people with the most kills of a server, that works with an example / bcaro top command

young knoll
#

Generally you want to save that data somewhere and then make use of that

#

But you could also use the built in stats of minecraft for tracking kills

obtuse crane
young knoll
#

Player.getStatistic

#

Works for OfflinePlayer too

obtuse crane
#

ok thanks for the information

vernal pier
#

for packet play out map if you specify a width / height smaller than 128 does it keep the previous pixels color or just reset them

edgy copper
#

A follow up on this issue - Say i have a kotlin plugin (in this case a dependecy, but it is just an example) that I upload.
Take the somewhat readable kotlin code:

    fun applyDefaultInteractionsBlocked(defaultInteractionsBlocked: Boolean) {
        val delegate = ::interactionsBlocked.apply { isAccessible = true }.getDelegate()!!
        @Suppress("UNCHECKED_CAST")
        val property = delegate::class.members.first { it.name == "value" } as KProperty1<Any, *>
        property.get(delegate) as Boolean? ?: run { interactionsBlocked = defaultInteractionsBlocked }
    }

This translates into most decompilers (i used luyten in this case, one of the very decent ones) into something along these lines:

#
    public final void applyDefaultInteractionsBlocked(final boolean defaultInteractionsBlocked) {
        final MenuItem$applyDefaultInteractionsBlocked$delegate.MenuItem$applyDefaultInteractionsBlocked$delegate$1 menuItem$applyDefaultInteractionsBlocked$delegate$1 = new MenuItem$applyDefaultInteractionsBlocked$delegate.MenuItem$applyDefaultInteractionsBlocked$delegate$1((Object)this);
        final KMutableProperty0 $this$applyDefaultInteractionsBlocked_u24lambda_u2d0 = (KMutableProperty0)menuItem$applyDefaultInteractionsBlocked$delegate$1;
        final int n = 0;
        KCallablesJvm.setAccessible($this$applyDefaultInteractionsBlocked_u24lambda_u2d0, true);
        final Object delegate2 = ((KMutableProperty0)menuItem$applyDefaultInteractionsBlocked$delegate$1).getDelegate();
        Intrinsics.checkNotNull(delegate2);
        final Object delegate = delegate2;
        final Iterable $this$first$iv = Reflection.getOrCreateKotlinClass(delegate.getClass()).getMembers();
        final int $i$f$first = 0;
        for (final Object element$iv : $this$first$iv) {
            final KCallable it = (KCallable)element$iv;
            final int n2 = 0;
            if (Intrinsics.areEqual(it.getName(), "value")) {
                final KProperty1 property = (KProperty1)element$iv;
                if (property.get(delegate) == null) {
                    final MenuItem $this$applyDefaultInteractionsBlocked_u24lambda_u2d2 = this;
                    final int n3 = 0;
                    $this$applyDefaultInteractionsBlocked_u24lambda_u2d2.setInteractionsBlocked(defaultInteractionsBlocked);
                }
                return;
            }
        }
        throw new NoSuchElementException("Collection contains no element matching the predicate.");
    }
#

This is still a simple example, with only three lines of more or less basic functions from the kotlin reflection library. In many cases it will translate to be much worse - so how readable does it have to be..?

#

In some cases, many decompilers will actually completely fail to decompile certain methods
here is an example - this method:

    fun openMenuPage(player: Player, page: Int) {
        Bukkit.broadcastMessage("start open" + with (System.currentTimeMillis().toString()) {substring(length - 5)})
        if (!isValidPage(page)) throw IllegalArgumentException("Page $page does not exist in this menu!")
        player.openInventory(getInventoryPage(page))
        viewers[player.uniqueId] = page
        Bukkit.broadcastMessage("stop open" + with (System.currentTimeMillis().toString()) {substring(length - 5)})
    }

decompiles with this huge error listing all of the byte code: https://pastebin.com/raw/VS74GtPY

lavish hemlock
#

I mean

#

This doesn't fall under obfuscation rules

#

It is not technically obfuscation

#

Even if the name-mangling makes it terribly unreadable.

carmine nacelle
#

What's the updated version of createChunkData

#

it's deprecated

young knoll
#

I think there are various separate methods now

#

Check the javadoc

carmine nacelle
#

Deprecated.
ChunkGenerator.ChunkData are now directly provided
#

wot

#

im just tryna create a void world man

azure nova
#

hello how do i check if the "WALL_SIGN" when right clicked, is attached to the chest behind?

latent dove
#

kotlin bad

steady smelt
#

So, anyone know combo duels?
Yea, they are mainly 1.8 right?
But how do you make it 1.17
Is it possible?

#

Pls @ me

latent dove
#

you mean you want 1.8 pvp in 1.17?

young knoll
latent dove
steady smelt
#

wait no

#

i want no hit delay

#

like no invincibility frames

latent dove
#

isn't that what i said :v

#

oh that

steady smelt
#

i still what the cooldown

latent dove
#

yeah thats kind ahard i think, not on my brain

azure nova
young knoll
#

get the block data of the sign

#

And cast appropriately

errant snow
#

Anyone know a way to shorten this?

if (recipeType == Recipe.RecipeType.WORKBENCH) {
  new CraftingTableRecipe(args[0], recipeType).getGui().show(player);
} else if (recipeType == Recipe.RecipeType.FURNACE) {
  new FurnaceRecipe(args[0], recipeType).getGui().show(player);
} else if (recipeType == Recipe.RecipeType.BLAST_FURNACE) {
  new BlastFurnaceRecipe(args[0], recipeType).getGui().show(player);
} else if (recipeType == Recipe.RecipeType.SMOKER) {
  new SmokerRecipe(args[0], recipeType).getGui().show(player);
} else if (recipeType == Recipe.RecipeType.CAMPFIRE) {
  new CampfireRecipe(args[0], recipeType).getGui().show(player);
} else if (recipeType == Recipe.RecipeType.SMITHING) {
  new SmithingTableRecipe(args[0], recipeType).getGui().show(player);
} else if (recipeType == Recipe.RecipeType.STONE_CUTTER) {
  new StoneCutterRecipe(args[0], recipeType).getGui().show(player);
}
young knoll
#

You should at least use a switch

errant snow
#

aren't if statements faster if you have more than like 5 checks?

#

nvm I had that reversed

#

Other than changing to switch is there anything quicker?

summer scroll
#

I'm still confused for the INT(n) for creating column in sql, can someone explain it? What does the "n" do.

quaint mantle
#

number :yes:

quaint mantle
errant snow
#

I don't see an implementation of a map in this setup

quaint mantle
#

EnumMap<RecipeType, Function<String, Recipe>

#

map.put(CAMPFIRE, CampfireRecipe::new);
map.put(SMITHING, SmithingTableRecipe::new);

#

map.get(type).apply(args[0]).getGui().show(player);

steady smelt
#

testing rn

vivid lion
#

Oki

summer scroll
#

Is there event that called everytime Player receives item? Includes Inventory#addItem, basically anything.

opal sluice
#

Hi, I have an issue with despawning a packet npc

#

Like, sometime it despawn, and sometimes it just stay there

#

Could changing skin several times make that ?

tacit drift
#

but probably the best way is having a repeating task

drowsy helm
#

dont think any functions to add items call any events

maiden mountain
#

@summer scroll well the N in int(n) is the range of the integer. For example if you have int(3) the number can not have more then 3 integers

Examples:
Correct: 555
Incorrect: 5555

compact cape
#

Is there any way to set Items lore using packets and keep items untouched?

public class PacketManager extends PacketAdapter {
    public PacketManager() {
        super(AGMEnchants.getInstance(), ListenerPriority.NORMAL, SET_SLOT, WINDOW_ITEMS);
    }

    @Override
    public void onPacketSending(final PacketEvent event) {
        final PacketContainer packet = event.getPacket();
        final PacketType type = event.getPacketType();
        final Player player = event.getPlayer();

        if (WINDOW_ITEMS.equals(type)) {
            final StructureModifier<ItemStack[]> structMod = packet.getItemArrayModifier();
            for (int index = 0; index < structMod.size(); index++) {
                final ItemStack[] itemArray = structMod.read(index);
                for (int i = 0; i < itemArray.length; i++) itemArray[i] = this.apply(itemArray[i], player);
            }
        } else if (SET_SLOT.equals(type)) {
            final StructureModifier<ItemStack> structMod = packet.getItemModifier();
            for (int index = 0; index < structMod.size(); index++)
                structMod.modify(index, input -> this.apply(input, player));
        }

        event.setPacket(packet);
    }

    @Override
    public void onPacketReceiving(PacketEvent event) {

    }

    public ItemStack apply(@Nullable final ItemStack item, final Player player) {
        if (item == null || !item.hasItemMeta()) return item;
        ItemStack result = item.clone();
        LoreManager.setFinalLore(result, player);
        return result;
    }
}

I have this but items get modified every time 😦

chrome beacon
#

Yeah you have to keep updating it

#

Listen to the server update packet and modify it

#

Oh and this will cause an issue in creative

#

I recommend hooking an existing custom enchants plugin instead of making another one

compact cape
#

It should add a new part to existing role

New Part
Old Part

But it keep duplicating it 😦 So I get sth like this after a while

New Part
New Part
New Part
Old Part
compact cape
#

I did test in creative so is it the problem?

chrome beacon
#

Yes

#

You need to strip the lore from the item

compact cape
#

So if someone wants to use it on creative it won't work 🤔

opal sluice
pastel mauve
#

Does anybody know how to make a 1.17 Tablist plugin? I can't any forum or YT Tutorial

chrome beacon
opal sluice
chrome beacon
#

TAB is my favorite

#

It's also open source

pastel mauve
#

I would like to implement it into my system

tacit drift
compact cape
tacit drift
#

on the item

opal sluice
pastel mauve
compact cape
tacit drift
#

uhh

chrome beacon
#

You can't

tacit drift
#

¯_(ツ)_/¯

#

you should scan constantly for items

#

but probably wont be the best thing to do

chrome beacon
#

Creative has full control over items

tardy delta
#

will !null throw an npr?

tacit drift
#

wdym !null

tardy delta
#

its if (!hashmap.get(value that may not exist) && false)

tacit drift
#

to check if it's not null

#

it's object != null

tardy delta
#

i know but would it throw an npr?

opal sluice
tardy delta
#

saw that

wispy plume
#

Good, I found the answer xD

wispy plume
tardy delta
#

smh

wispy plume
#

also you might want to use hashmap.getOrDefault()

tardy delta
#

i just want to know if it will throw an npr

wispy plume
#

yes

#

it will

#

if the key is null*

compact cape
tardy delta
#

aah finaly

compact cape
#

Now it doesn't

wispy plume
tardy delta
#

pff i want to make a kind of map with a string (commandname), an commandexecutor and a boolean that indicates whether or not the command supports console

#

i think it can be better than Map<String, Map.Entry<AbstractCommand, Boolean>>

#

because i also want a collection with all my command instances and i was trying to combine these two

#

but that goes brr

hardy swan
tardy delta
#

i was thinking about an command enum with the instance and the boolean

#

so i can check it with enum.isConsole()

hardy swan
#

I would have commands that should support console implement an interface so I can just instanceof

#

Personal taste i guess, havent understood enough of the context

#

Surely you have a CommandParser somewhere

marble granite
#

how long does a hurt take in minecraft?

#

like, the knowckback you get from getting hurt

tardy delta
#

hmm

hardy swan
marble granite
#

no not really, like how long you get knocked up in the sky for getting hit etc

hardy swan
#

By who, player? Golem?

summer scroll
#

I don't think there is any fixed time for that.

tardy delta
marble granite
#

oh right, so that different.

marble granite
summer scroll
#

What are you trying to do anyway?

marble granite
#

well, is there somewhere where i can see the different times for golems, players, cactusses etc

hardy swan
tardy delta
#

every of my command classes does that itself with the execute() method

marble granite
# summer scroll What are you trying to do anyway?

so, i have this fly check i made for an anticheat, but taking damage etc in the air makes you go up while in the air (which false-flags), i need to disable the check for the duration of the damage-time

#

while at the same time not making a verus 2.0

summer scroll
marble granite
summer scroll
#

you can't really get the exact amount of time, what if you got a hit in a cliff and you fell down, that's different thing too.

marble granite
#

not really, i could just reenable the check when they hit the ground again, but that is an very very easy bypass. just take dagamge and go zooming around

marble granite
mystic heart
#

there is a plugin WORLDEDIT, in which copy pasting chests is glitching where double chests gets converted into single chests, I asked their support staff and they replied saying that its a spigot glitch, is there a given time when it will be fixed?

tardy delta
#

is it possible to put null as yml value?

tardy delta
#

iirc

tardy delta
#

oh

quaint mantle
vague oracle
#

What version are you using

mystic heart
#

srry for caps

quaint mantle
#

stop the cap

mystic heart
#

yes I didn't notice srry for that

tardy delta
#

instanceof interface does mean the class is implementing that interface right?

tardy delta
#

cringe but i'm not implementing it

visual tide
#

does viaversion completely swallow plugin messages?

opal juniper
#

uh no i don’t think so

tardy delta
#

if i do this instanceof ConsoleCommand in the base command class, will that work for child classes?

bitter ridge
#

How can I add custom NBT to an item? I want to make some custom items unstackable and I was someone made it by adding uuid to the NBT

quaint mantle
#

how do I check if a player died in a specific way
do I need to check the death message everytime
or is there a method

quaint mantle
#

which one bro

latent dove
#

its like

#

event.getCause().equals(DeathCause.FALL_DAMAGE)

#

something like that

#

lemme open eclipse dw

quaint mantle
#

oo

tardy delta
#

i dunno why

tardy delta
#

i have a base class which handles the onCommand method and checks if the player is authorized (console and permission etc)

ivory sleet
#

You have both an interface and base class?

tardy delta
#

the interface is just empty and i implement it if the command has to support console

#

doesnt seem to work

ivory sleet
#

Oh okay, I thought you had something like
interface Command
abstract class AbstractCommand implements Command

#

because that’s totally unnecessary

tardy delta
#

no

#

i have something like this

ivory sleet
#

Okay that’s fine

latent dove
#

@quaint mantle

if (e.getEntity().getLastDamageCause().equals(DamageCause.FALL))
ivory sleet
#

Multiple inheritance

tardy delta
#

then i check for it and it returns false everywhere

#

i mean in the if

ivory sleet
#

Wait what

#

That’s a leaky abstraction

latent dove
#

whats an enum?

tardy delta
#

constant values

#

kinda

latent dove
#

how can I use it

ivory sleet
#

a set of static final values which are known at compile time

#

Google it

tardy delta
#

any better ways for my "leaky abstraction"?

ivory sleet
#

May I ask, why in the first place do you use the instanceof?

undone axleBOT
tardy delta
#

therefore i had a map with the command string and a boolean whether the command supported console and that worked

ivory sleet
#

We usually create molymorphistic object models to avoid this sort of coupling

tardy delta
#

and i thought by implementing consolecommand the base command class would be able to recognise it as a command which supports console 🎃

latent dove
#

get ignored

tardy delta
#

but it seems it dont

#

everything gets seen as console

ivory sleet
#

If your instance does not instanceof console and isConsole

tardy delta
#

isconsole = !sender instanceof Player

#

so if i'm executing it from the console but its not supposed to

#

you still get it?

ivory sleet
#

So if is not player and is not console command?

#

It then sends a no_console message?

tardy delta
#

yes

#

but my instanceof doesnt work for some reason

latent dove
#

GIT IGNORED BOI

ivory sleet
latent dove
#

your suspicions were in fact reality

ivory sleet
#

But your logic is weird

tardy delta
#

dont know a better way

ivory sleet
#

Just think about it,
if not player and is not consolecommand

tardy delta
#

= is console and is not supposed to be executed by console

#

smh

ivory sleet
#

So if the command does not implements ConsoleCommand and the sender is a console sender then it should run that in principle

tardy delta
#

yes

#

sometimes my logic is a bit weird ☠️

alpine urchin
#

lol

ivory sleet
#

can you refactor the name of the variable to something like isConsoleSender, a bit more readable

alpine urchin
#

wtf

latent dove
ivory sleet
#

Also you probably want to check for sender instanceof ConsoleSender

#

Or smtng

alpine urchin
#

public enum Name {
VALUE_A,
VALUE_B,
VALUE_C;
}

#

you can imagine the values inside the enum to be integers

tardy delta
#

for some reason got problems with enums rn

ivory sleet
#

Brush what command did you try this for?

alpine urchin
#

Name value = Name.VALUE_A;

tardy delta
#

i think i got it working

alpine urchin
#

if (value == Name.VALUE_A) {

}

ivory sleet
#

Alright

alpine urchin
#

In C/C++ the compiler replaces enum values with their index integer

#

so its an integer behind the scenes

#

not sure how java treats it

latent dove
#

i can just use switch()

alpine urchin
#

if you have a handfull of values to compare

#

yes

ivory sleet
#

class Boi {
public static final Boi A = new Boi();
public static final Boi B = new Boi();
}

enum Girl {
A,
B;
}

Almost equivalent

tardy delta
#

heh

#

if i log an enum constructor parameter

#

liek

#
enum lang {
  NO_CONSOLE("messages.noconsole", "console cant execute this");

Lang (String path, String defaulT) {
  log(path)  
}
}

does that logs all the enum paths?

ivory sleet
#

Precisely

tardy delta
#

lol

#

enum constructor is called as class load right?

ivory sleet
#

wym what

latent dove
#

i lvoe how

latent dove
#

in the example

#

u create an instance of the same class the enum is made

ivory sleet
#

they’re initialized before anything else in the Enum

latent dove
#

leading to inf lag

ivory sleet
#

lag?

latent dove
#

uh yes

#

thats how i see it

#

cpu usage

ivory sleet
#

They don’t cause any lag

tardy delta
#

well if i get the value for some reason the constructor is called

ivory sleet
#

Yes but everything causes cpu usage more or less

alpine urchin
#

right

#

or application

#

Cause enum values themselves seem to be sort of "static".

ivory sleet
#

I think it loads the Enum constants lazily

#

so when the class loads

alpine urchin
#

So am I correct?

ivory sleet
#

Assume you do reference an Enum constant of the Enum during onEnable then yeah

#

When it starts

tardy delta
alpine urchin
#

I'm trying to say it won't log when you do
Girl girl = Girl.GIRL_A;

#

lol

#

ofc not

ivory sleet
#

If it’s the first time the jvm gets to know that Enum exists then it would log

alpine urchin
#

Yes

#

ok

tardy delta
#

?paste

undone axleBOT
tardy delta
#

look this is my class
every time i use the .get() it log that there is missing data, which is not true
it should normally only log at class load and not when i use the method
https://paste.md-5.net/nokiwoweyu.cs

shadow tide
#

I just found out that Bukkit.getPlayer() is depricated. What can I use instead?

alpine urchin
#

what input

#

are you passing

shadow tide
#

string

ivory sleet
#

What

#

No

#

getOfflinePlayer(name) is deprecated

#

Not the normal getPlayer ones?

alpine urchin
#

^

shadow tide
#

The method getPlayer(String) from the type Bukkit is deprecated

alpine urchin
#

On Spigot 1.17.1 its not

#

deprecated

shadow tide
#

let me check my pom.xml

ivory sleet
#

If you use paper then it might be the case, they do all sort of changes

shadow tide
#

<version>1.17.1-R0.1-SNAPSHOT</version>

#

This is my entire dependency html <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.17.1-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>

ivory sleet
#

Lazily tho

alpine urchin
#

Basically the first time you use your enum

#

right?

tardy delta
#

this advanced this

alpine urchin
#

Just do this

shadow tide
#

can I just ignore the deprecation and move on?

alpine urchin
#

for (EnumName name : EnumName.values()) {
log(name.path);
}

alpine urchin
#

oops

#

pinged wrongperson

#

nvm it is tthe right person

ivory sleet
alpine urchin
#

idk who asked fo rit

#

but if u need it

#

there

shadow tide
ivory sleet
#

Lmao

shadow tide
#

wut

ivory sleet
#

What if you try Bukkit.getServer().getPlayer(...)

shadow tide
#

k

#

still depricated

ivory sleet
#

Uh that’s weird

shadow tide
#

@SuppressWarnings("deprecation")

#

ez as pi

#

3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679

minor garnet
#

?

shadow tide
#

those are the first 100 digits of pi

#

ok

abstract surge
#

Hey is it posslible to reload a plugin external like pluginmanager i tried something yesterday bug it did not work

shadow tide
#

the reason its depricated is bc

#

the version is incorrect

#

even though it is 1.17.1

#

idk

minor garnet
#

NO

shadow tide
#

it seems to be below 1.16

chrome beacon
#

^

minor garnet
shadow tide
#

bc Material.NETHERITE_BLOCK doesn't exist

abstract surge
chrome beacon
#

Why

minor garnet
abstract surge
#

i hat some plugin issues (not my plugin) when the world is not loaded

chrome beacon
#

Then contact the author or make plugin load post world

shadow tide
#

it is proof that the version is below 1.16

abstract surge
chrome beacon
#

Then support it yourself

#

Or find an alternative

abstract surge
chrome beacon
#

I can recommend Recaf

abstract surge
#

ok thx i will test it

shadow tide
#

how do I add spigot 1.17.1 to maven

alpine urchin
shadow tide
#

because I tried it and it seems to be an earlier version

alpine urchin
#

reload a pluginmanager with a plugin manager

#

kek

tardy delta
#

wut i was logging all the values of the enum and first it says it cant find it and after that it logs it correctly
for (Lang l : Lang.values()) {
Utils.logDebug(l.get());
}

latent dove
#

spigot <- pog

shadow tide
#

is seems to be an earlier version

chrome beacon
#

You edit the POM

shadow tide
#

Material.NETHERITE_BLOCK doesn't exist

shadow tide
latent dove
#
<dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
chrome beacon
#

^

eternal oxide
#

run buildtools

latent dove
shadow tide
latent dove
#

do u have

chrome beacon
latent dove
#

oops

shadow tide
#

but is seems to be an earlier version seeing as Material.NETHERITE_BLOCK doesn't exist

chrome beacon
chrome beacon
#

It's under the file tab

shadow tide
#

k

eternal oxide
#

You are missing the api version from your plugin.yml

bright jolt
#

Can anyone help me with the WorldGuard API and making custom flags?

chrome beacon
eternal oxide
#

no api version in plugin.yml and it reverts to legacy

latent dove
#

api-version: 1.13

shadow tide
eternal oxide
#

yes

shadow tide
#
version: 1.0
author: CJendantix
main: com.CJendantix.CustomRecipes.CustomRecipes
api-version: 1.17```
eternal oxide
#

looks ok

latent dove
#

i suggest u use api-version of 1.13

#

idk why

#

but yes

shadow tide
#

I'm developing for 1.17

eternal oxide
#

if you use methods only in 1.17 you must use 1.17 api

bright jolt
shadow tide
#

methods like Material.NETHERITE_BLOCK

latent dove
#

so 1.12 = 1.12.x and above can run the plugin?

chrome beacon
bright jolt
eternal oxide
undone axleBOT
shadow tide
shadow tide
tardy delta
#

it seems i have to call all the values from my enum before i can use them

quaint mantle
ivory sleet
#

Because Enums load lazily

tardy delta
#

strange

eternal oxide
#

pom is fine

quaint mantle
#

Try to exclude spigot from vault?

ivory sleet
#

It’s not strange

#

It’s called not doing premature optimizations

tardy delta
#

still..

ivory sleet
#

It’s not strange

#

It’s essentially a lazy singleton

shadow tide
tardy delta
#

can i just put a for loop over the values in a static block in the enum?

ivory sleet
#

No

#

Or well you could

tardy delta
#

is that a yes or a no?

ivory sleet
#

It would still require you to call it somewhere else

shadow tide
#

removing the vault API didn't do anything

tardy delta
#

if i just do that and after that i use them for real, would it work?

eternal oxide
ivory sleet
#

Anyways why don’t you just create a static function which logs all the Enum constants and then call that function in onEnable?

tardy delta
#

i do now

#

its not static but anyway

shadow tide
#

tell me

eternal oxide
#

file menu

shadow tide
#

yes

#

then wut

eternal oxide
#

find it

shadow tide
#

there is no "invalidate cache" button

eternal oxide
#

I don;t use InteliJ but I know its there

shadow tide
#

I'm using eclipse 🤦‍♂️

ivory sleet
#

Hehe

eternal oxide
#

much easier then, just update project in the maven menu

shadow tide
#

ok

#

fixed it

#

yay

#

thanks every1

#

why does the vault API break everything?

#

hellooooooo

tardy delta
#

🎃

young knoll
#

Never had an issue personally

tardy delta
#

same with me

young knoll
#

“It works on my machine”

shadow tide
#

when its just the spigot api everything is fine, when I add the Vault API it breaks everything

#

what is the latest version of the vault API?

quaint mantle
#

what does "break everything" mean

quaint mantle
#

vault prob hasn't been updated in years

shadow tide
#

nvm

tardy delta
#

this doesnt makes sense, first it says the path is valid but after that it cant find it :/

quaint mantle
#

Using enums for configs is a bad idea smh

ivory sleet
#

< Object mapping

tardy delta
#

if my file is valid it doesnt makes sense that it is null

quaint mantle
#

Enums shouldnt have mutable state, like at all

tardy delta
#

lemme try to log the result from the file

#

it shouldnt be null

shadow tide
#

I don't care about vault as long as this would add the permission CJendantix.test to PintSizeJedi java Player PintSizeJedi = Bukkit.getPlayer("PintSizeJedi"); PintSizeJedi.addAttachment(this, "CJendantix.test", true);

young knoll
#

It should, but it won’t be saved

shadow tide
#

how do I save it?

quaint mantle
#

Vault i guess

shadow tide
#

I can't use vault

#

its either outdated or just won't work for me

shadow tide
dull sparrow
#

Hi, I need to access a constructor using Reflection but I have no idea how to when there's an arbitrary number of arguments

      // code
    }

Could someone help me out please? 🙂

lost matrix
lost matrix
quaint mantle
tardy delta
#

cringe

quaint mantle
#

excluding spigot didnt help?

tardy delta
quaint mantle
#

how to make chat color red or green

#

or any color

tardy delta
#

for some reason getting a value from my config returns null

lost matrix
quaint mantle
#

can u write a sample code and show me how

#

please

tardy delta
#

ChatColor.RED + "no"

quaint mantle
#

okay tysm

tardy delta
#

🎃

lost matrix
# quaint mantle can u write a sample code and show me how

Example one:

    String coloredMessage = ChatColor.RED + "Im gonna be red";

Example two:

    String coloredMessage = "§cIm gonna be red";

Example three:

    String coloredMessage = ChatColor.translateAlternateColorCodes('&', "&cIm gonna be red");
quaint mantle
#

stop abusing enums and consider some configuration library

tardy delta
#

i think i found a little mistake that broke whole my config smh

#

wdym by abusing?

dull sparrow
tardy delta
#

isnt example two causing problems?

lost matrix
dull sparrow
#

Ugh

#

yeah, cheers

#

I did not know you could do Location[].class 😛 tyvm

lost matrix
tardy delta
#

the §

#

they told me to use & but yea

lost matrix
#

Example three literally just replaces all & with §
Its the same String at the end

quaint mantle
tardy delta
#

what would i use instead?

#

so just an enum with some methods is abusing?

shadow tide
#

is there a special way to export a Maven project

#

?

quaint mantle
#

mvn clean install

shadow tide
quaint mantle
lost matrix
ivory sleet
#

I mean using an enum for config keys is probably fine but for storing values which may change thus mutable, meh

quaint mantle
eternal oxide
#

you add one for a maven build

tardy delta
#

the values are defaults but yea..

lost matrix
ivory sleet
#

Yeah

shadow tide
quaint mantle
#

I mean, the biggest problem is that you have to somehow access configs in a static context

ivory sleet
#

Or create a pseudo Enum with maybe the use of sealed to make it better supported at compile time

eternal oxide
#

Goals would be clean package

lost matrix
shadow tide
#

I found this

#

do I just click run?

eternal oxide
#

add your goals, then apply

shadow tide
#

what goals

eternal oxide
#

then run

#

clean package

shadow tide
#

huh

eternal oxide
#

type in the goals box clean package

shadow tide
#

k

lost matrix
#

Or you just throw away all the fiddling and let Jackson do the work

shadow tide
#

like I said, I know absolutely nothing about maven

opal juniper
#

lol

#

look handy tho

eternal oxide
#

once you apply and run, it will now be available under teh Run button of the task bar

quaint mantle
shadow tide
#
[ERROR] Source option 5 is no longer supported. Use 7 or later.
[ERROR] Target option 5 is no longer supported. Use 7 or later.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
eternal oxide
#

your pom needs a source level

shadow tide
#

wuts that

eternal oxide
#

in my pom I have xml <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>

#

yours would be 16

shadow tide
lost matrix
#

:cat-gun:

tardy delta
#

hehe

lost matrix
#

I miss my emojis : /

shadow tide
eternal oxide
#

replace the 1.8 with 16

shadow tide
#

k

#

yay

#

works

#

ok, is there a way to do something that runs every tick? like a tick.mcfunction in a datapack

young knoll
#

Use a runnable

shadow tide
#

wut

#

is

#

dat

young knoll
#

?scheduling

undone axleBOT
eternal oxide
#

no idea in a datapack

ancient whale
#

Hey, I would like to know how could I basically know if a block should be affected from an explosion (especially the "native liquid protection" thing) but I can't think of a way of doing it 😒
(One easy way of doing it would be to be able to make obi appears in the inital blocklist from the ExplodeEvent, but I couldn't find anything that would allow it in spigot config)

opal juniper
young knoll
#

Not boosting this server

opal juniper
#

that shouldn’t matter… meh idk

#

@ivory sleet you aren’t boosting this server

#

can you use custom emojis

ivory sleet
opal juniper
young knoll
#

Conclure is staff

#

You need to be boosting to use external emojis

opal juniper
#

oh ok

#

stupid but whatevs

tulip holly
#

Hey, does anyone know a plugin that will let players know when they enter/leave spawn/safe area?

young knoll
#

Worldguard has options for that

shadow tide
#

what can I use instead of addAttachment java public void runnable() { new BukkitRunnable() { @Override public void run() { Player CJendantix = Bukkit.getPlayer("CJendantix"); Player CatLordBlob = Bukkit.getPlayer("CatLordBlob"); Player PintSizeJedi = Bukkit.getPlayer("PintSizeJedi"); CJendantix.addAttachment(this, "CJendantix.test", true); CatLordBlob.addAttachment(this, "CJendantix.test", true); PintSizeJedi.addAttachment(this, "CJendantix.test", true); } }.runTaskTimerAsynchronously(CustomRecipes.getPlugin(), 0, 10); }

#

The method addAttachment(Plugin, String, boolean) in the type Permissible is not applicable for the arguments (new BukkitRunnable(){}, String, boolean)

eternal oxide
#

this is inside the BukkitRunnable so is referencing teh runnable and not yoru plugin instance

shadow tide
#

it is temporarily in the main class

eternal oxide
#

makes no difference

shadow tide
#

k

eternal oxide
#

this is inside the runnable. It needs a plugin reference

shadow tide
#

can you answer my main question now?

eternal oxide
#

why are you trying to add a permission every 10 ticks?

latent dove
#

How to run a function every x minute, second or hour

shadow tide
eternal oxide
#

eww don;t do that

shadow tide
#

what do I do then?

eternal oxide
#

just add it in the PlayerJoinEvent

shadow tide
#

I am so fricking dumb

#

I completely forgot about events I haven't used them in so long

latent dove
#

guys join my thread

eternal oxide
#

why?

#

if you want things run at specific times use a ScheduledExecutorService

slim kernel
#

Can I somehow get if a player is constantly rightclicking or can I only get if he right clicks once?

quaint mantle
#

how to hide a player in the tab list of players

final monolith
summer scroll
slim kernel
mystic tartan
#

is there an event called when a spectator stops spectating someone? (presses shift)

slim kernel
chrome beacon
mystic tartan
#

ah, do you know what the paper event is called?

chrome beacon
#

PlayerStopSpectatingEntityEvent

keen obsidian
#

HOw can i send an action_bar message in 1.17.1? I have this but I get an error in my coding probram: all.sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.GOLD + (speed*20*3.6 + " KM/U")));

eternal oxide
#

ChatColor.GOLD.toString()

keen obsidian
#

I have a red line under sendMessage

eternal oxide
#

what is all?

keen obsidian
#

all are the online players

summer scroll
keen obsidian
#

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

eternal oxide
#

sendmessage is a method under spigot() you can;ty just use all (a collection) to send a message to all

#

ok

#

then as agler said

keen obsidian
#

import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; this are my imports

summer scroll
#

yea thats correct

quaint mantle
#

Try this, it isn’t deprecated

keen obsidian
#

It wont work with the chatmessagee type

quaint mantle
#

player.sendActionBar(Component.Text())

#

Wait

#

Isn’t that is for Paper?

#

Oh sorry

summer scroll
keen obsidian
#

No

slim kernel
#

how do I loop through an 2d array?

chrome beacon
#

Just like you loop array but you have two loops

summer scroll
slim kernel
keen obsidian
#

It give no errors but my program says it is incorrect

#

SO i cant export the plugin

quaint mantle
slim kernel
summer scroll
keen obsidian
#

Yes under the word sendMessage

summer scroll
keen obsidian
#

for (Player all : Bukkit.getOnlinePlayers()) { if (all.isOp()) { all.sendMessage(ChatMessageType.ACTION_BAR, (ChatColor.GOLD + speed*20*3.6 + " KM/U")); } }

summer scroll
#

all.spigot().sendMessage(), I've said it above.

stone sinew
#

Can't you just use Bukkit.broadcast(String, String)?

keen obsidian
#

all.sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.GOLD.toString() + speed*20*3.6 + " KM/U"));1 This also wont work

summer scroll
#

omg

#

all.spigot().sendMessage()

#

bro, you need to use the sendMessage method from Player.Spigot class to send the action bar message

quaint mantle
#

Aglerr is raging

keen obsidian
stone sinew
chrome beacon
summer scroll
#

@keen obsidian you need to see my chat bro

keen obsidian
#

spigot cannot be resolved or is not a field

chrome beacon
keen obsidian
#

1.17.1

stone sinew
chrome beacon
keen obsidian
#

The method spigot() is undefined for the type Player

#

Yes

chrome beacon
#

Hm

keen obsidian
#

Maybe am I to dumb

summer scroll
#
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Message here"));
keen obsidian
#

The method spigot() is undefined for the type Player

vale ember
#

what ide do u using?

summer scroll
#

It's weird then, the method spigot() should be there.

vale ember
#

one i had problem when ide didn't recognise some methods

ivory sleet
#

Lars send the code you got rn

vale ember
#

if ur using intellij idea try invalidating cache

keen obsidian
#

I think Eclipse wont like the Actionbar because in Intellij idea it isnt an error

slim kernel
vale ember
#

?help

vale ember
vale ember
#

np

true perch
#

I made 3 classes called "Deck", "ExtraDeck", and "SideDeck" which all extend the "DeckSet" class which extends the "DeckManager" class.

These classes are erroring: "Deck", "ExtraDeck", and "SideDeck"
Error: There is no default constructor available in DeckSet (recommends I create a super() and I don't know how to use that keyword)

I just don't understand why it needs a default constructor when the one I have already does what I need it to. Could anyone attempt to help explain?

maiden mountain
#

How do i add more then one compatible api-versions to my plugin.yml?

stone sinew
opal sluice
#

Hi, does someone had a similar issue where if you spawn/despawn an npc fast there is a dupe of the npc stay there ?

acoustic pendant
#

Hey! i have a problem with a file code

#
public class UUIDStore implements Listener {

    private static FileConfiguration UUIDconfig;
    private static File UUID;

    @EventHandler
    public void playerUUID(PlayerJoinEvent e){
        Player player = e.getPlayer();
        UUID = new File(Bukkit.getServer().getPluginManager().getPlugin("MineSpaceSkills").getDataFolder() + File.separator + "Data", player.getUniqueId() + ".yml");

        UUIDconfig = YamlConfiguration.loadConfiguration(UUID);
    }
}```
#

why this doesn't create a folder?

#

the file niether

peak depot
#

try printing the .getDataFolder() path and check if its a null pointer

acoustic pendant
#
        System.out.println("a");
        UUID = new File(Bukkit.getServer().getPluginManager().getPlugin("MineSpaceSkills").getDataFolder() + File.separator + "Data", player.getUniqueId() + ".yml");
        System.out.println("A");
#

this you mean?

peak depot
#

no check if System.out.println(Bukkit.getServer().getPluginManager().getPlugin("MineSpaceSkills").getDataFolder().toString()); works

tardy delta
#

can a commansSender have a permission? i dont mean player

acoustic pendant
tardy delta
#

check if it is something else than null

acoustic pendant
#

plugins/MineSpaceSkills

tardy delta
#

than its notnull

acoustic pendant
#

yes

#

but it doesn't create the file

peak depot
#

does the folder gets created?

acoustic pendant
#

nope

peak depot
#

well then I think it could be because you try to create a file without creating a folder first

acoustic pendant
#

so, first i create the folder

tardy delta
#

i always do it like this

File file = new File(plugin.getDataFolder(), name);
        if (!file.exists()) plugin.saveResource(name, false);
        return YamlConfiguration.loadConfiguration(file);
acoustic pendant
#

let me try

tardy delta
#

and at th top

if (!plugin.getDataFolder().exists() && !plugin.getDataFolder().mkdirs()) {
            Utils.logError("Could not create files");
            return;
        }
twin venture
#

whi i have a problem with my plugin , i tried spigot 1.13.2 api , 1.8.8 api , 1.12.2 api , and even 1.16.5 api

#

mysql is not connecting ..

lost matrix
#

define "not working"

tardy delta
#

isnt this better instead of making a player variable?

if (sender instanceof Player) {
  player = (Player) sender;
}```
twin venture
#

can i msg you privitaly?

tardy delta
#

instanceof Player player smh

twin venture
#

i can't really explain it here

tardy delta
#

thats just a problem with mysql

#

🎃

lost matrix
twin venture
#

but luckperms is working ..

#

first i thought that oky bcz iam using old ver [spigot 1.8.8]

#

but i tried all version

tardy delta
#

i guess you are stting up your own mysql connection?

twin venture
#

1.13.2 , 1.16.5

tardy delta
#

that doesnt care about the spigot or api version

twin venture
#

bcz from what i read , that spigot 1.8.8 [dont support mysql 8]

#

i know its old ver , i tried 1.13.2 and same error ..

tardy delta
#

uhh probably

#

seems old

twin venture
#

this is the sql builder

#

i use hikari ..

lost matrix
#

Spigot has the mysql jdbc driver provided

twin venture
#

YES

#

iam trying to realocate it to mysql 8

#

i tried to edit it in pom.xml but nothing changed..

lost matrix
#

Use the maven shade plugin and relocate it

#

But you should not need it as spigot has a working driver

#

Show your pom pls

twin venture
#

iam not the best with editing the pom so pls don't judge xd

lost matrix
#

shadedPattern has to be a path which derives from your applications path. So
com.me.money.skypvp.mysql for example

twin venture
#

what is the patern then?

lost matrix
#

Next: You are using the <scope>provided</scope> for your mysql driver but you also relocate it. This makes no sense.
Remove the scope then relocation works.

#

You cant relocate what you dont have. If you relocate a dependency you need to provide it yourself.

twin venture
#

oh

lost matrix
#

pattern is mysql
shadedpattern is your.path.mysql

#

Wait. Mysql might have a weird packet structure... so pattern could be something else.

#

Anyways you are using an ancient Spigot version so ill just recommend you to not use such an old piece of (unsupported) Software and move on. 👍

ancient plank
#

tru

twin venture
#

thank you , i tried 1.13.2

#

same thing not working

#

tried 1.12.2 same error .. <
tried 1.16.5 mysql not working ..

lost matrix
#

Remove mysql from your pom

#

Completely. Spigot has it already as transitive dependency.

twin venture
#

i will try that thank you

naive drift
#

Hello there, I have a trouble with Hikari Database Pool

Why I get this after 1000000ms Connection is not available, request timed out after 1000000ms. I tried every time close pool and connection but nothings go on.

@Override
    public PlayerOptions select(@NotNull Player player) {
        UserData userData = App.getService(PlayerService.class).getUser(player);
        try {
            Connection connection = Westcore.getDataSource().getConnection();
            PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM wl_player_options WHERE player_id = ? LIMIT 1");
            preparedStatement.setLong(1, userData.getPlayerID());
            ResultSet resultSet = preparedStatement.executeQuery();

            if(!resultSet.isBeforeFirst()){
                return null;
            }

            PlayerOptions playerOptions = new PlayerOptions(userData.getPlayerID());
            while(resultSet.next()) {
                playerOptions.setId(resultSet.getLong("id"));       playerOptions.setShowDeathMessage(resultSet.getBoolean("show_death_message"));            playerOptions.setShowJoinMessage(resultSet.getBoolean("show_join_message"));         ...
            }
            connection.close();
            preparedStatement.close();
            resultSet.close();
            return playerOptions;
        } catch (SQLException e) {e.printStackTrace();}
        return null;
    }
#

And my configuration is:

public void configureDatabase() {
        HikariConfig config = new HikariConfig();
        config.setJdbcUrl("jdbc:mysql://xxx
:3306/xx");
        config.setUsername("xx");
        config.setPassword("xx
");
        config.setMaximumPoolSize(5);
        config.setPoolName("WCDataPool");


        config.setConnectionTimeout(1000000);
        config.setMinimumIdle(0);
        config.setIdleTimeout(35*1000);
        config.setMaxLifetime(45*1000);
        config.setConnectionTestQuery("SELECT 1");

        dataSource = new HikariDataSource(config);
    }```
ancient plank
#

leaked your database info for like 20 seconds eyesblur

acoustic pendant
naive drift
#

Just changed, my wrong 🥲

vivid temple
#

so i cant drop items, crops that get dropped when breaking them dont get dropped and entities dont spawn

#

anyone an idea what could be causing that?

vague oracle
#

We aren't gods 🙂 without a plugin list we cant help

lucid wind
#

is there a 1.17 plugin where you can spawn in player entities to keep mobs spawning in a grinder

quaint mantle
#

doesnt seem like a good idea

lucid wind
#

its for a personal server so it doesnt really matter just dont wanna have my computer on to afk