#help-development

1 messages · Page 929 of 1

agile anvil
#

to check

hybrid spoke
#

whats the issue

#

i dont want to scroll up

agile anvil
#

Their armor doesn't get removed

#

here is the code

hybrid spoke
#

tf is that code

umbral ridge
#

what is setLock in Chest class? What kind of lock?

hybrid spoke
umbral ridge
#

hm

hybrid spoke
# agile anvil here is the code

i mean, it looks like it should work. could also be, that something is null or whatever and he is just not looking at the console

#

he should def debug since we can only wild guess

agile anvil
#

Yeah that's definitely it

#

And the code is way to dense to understand quickly a thing

hybrid spoke
#

yep

agile anvil
#

Only solution here is some debugging

hybrid spoke
#

could also be that the code doesnt even reach the setItem statement

#

¯_(ツ)_/¯

agile anvil
#

And maybe a CTRL + Alt + L

hybrid spoke
#

what does that do

agile anvil
#

Reformat and Rearrange on IntelliJ

hybrid spoke
#

ah, i bound that to CTRL+S

#

since im an OG eclipse user, spamming save

lost matrix
#

You should really stop hopping in and out of streams like that.
It gets confusing. You could do all of hat in a single stream. But i recommend splitting this into multiple methods for readability.
Also: Very important to not use single letter variables.

hybrid spoke
#

p ftw

lost matrix
hybrid spoke
#

i remember all the old spigot tutorials using e and p as variable names

wet breach
lost matrix
#

My naming can get quite explicit at times. But it just helps me understand my code every time i read it without having to use comments

wet breach
#

I use single letters all the time but not if i have too many variables lol

#

Or if the variable comes from a parent class

agile anvil
#

Naming well your variables usually avoid the necessity of using comments

hybrid spoke
#

if i get back to a project after a year i dont wanna have to guess what q is

#

besides qs, qr, k, l and p

lost matrix
#

Especially in a 100 line method at the bottom

analog mantle
#

I find myself wasting too much time thinking of variable names

hybrid spoke
#

just name them what they are

#

Player is a player lol

lost matrix
#

You will get that back in with the time you waste thinking about what the code does

wet breach
#

Just give them names like we do people. You know have an object named bob

hybrid spoke
#

not me writing a plugin to auto complete variable names to people on here

analog mantle
hybrid spoke
#

double frostalf = Math.min(7smile7, GodCipher);

analog mantle
#

No thinking I know exactly what everything does

rough ibex
#

invalid identifier

#

but sure

analog mantle
#

I essentially have a signature on my code because of how unique it is

hybrid spoke
#

"looks like code from of0.." "how did you know?" "because its bad"

analog mantle
#

Because it intentionally goes out of it's way to use streams over regular loops

lost matrix
#

Thats fine, but then dont jump in and out of streams

#

You are hurting your performance a lot with that because the pipeline cant heat up

#

And you are creating a ton of objects that need to be collected for no reason by the GC

analog mantle
lost matrix
analog mantle
#

and how would I fix that

wet breach
#

Internally there is some over head with streams as it needs a buffer. Jumping in and out just duplicates this over head

analog mantle
#

The array stream is immutable

lost matrix
analog mantle
#

Everything?

lost matrix
#

Whole method

wet breach
analog mantle
#

!paste

#

what the thing

lost matrix
#

?paste

undone axleBOT
wet breach
#

?paste

undone axleBOT
lost matrix
#

If you have more than maybe 30 lines in a single method, then its time to split your code up

#

A lot

analog mantle
#

It was split up but the cancelled event wasn't working in adjacent methods

#

I learned at least 90% of my java by example

agile anvil
#

I did too

#

And the other 10% were from listening to the others' advices

analog mantle
#

The other 1% was from a class I took in school

agile anvil
analog mantle
#

At least

#

I said

#

I learned how to make a loop to repeat a string because the online compiler ran java 8 and there was no string.repeat(times);

lost matrix
umbral ridge
#

why isn't the inventory updating of the chest?

#

I'm using getInventory() because there isnt setInventory, there is only setBlockInventory or something like that

agile anvil
#

Remove the chest.update(true);

lost matrix
# analog mantle At least

If the average danger level of your armor pieces is too high, one random piece should be dropped, right?
Why not drop the piece with the highest danger level?

analog mantle
#

That's the way my client wanted it

#

I made this as my very first plugin because we found ourselves rewriting it in skript too often

lost matrix
#

?paste

undone axleBOT
quaint mantle
#

if i add return false; to a command it wont send usage right

hybrid spoke
#

yeah

glad prawn
#

yeah

buoyant viper
quaint mantle
#

how do i broadcast a message to players in specific world

#

since Bukkit.broadcastMessage is deprecated

#

what?

wet breach
deft latch
#

Anyone know what Error code 1 for Buildtools means?

wet breach
#

It means it failed succesfully

#

Jk. Try clearing out the buildtools directory except for the jar and restart fresh.

#

If still failing may help if you use the paste site and show the build log

quaint mantle
tender shard
#

loop over the world's players

quaint mantle
#

okay cool sounds like smth im too lazy to do

wet breach
quaint mantle
#

is there suck a thing as default permission?

#

ion mind shit gettin broadcasted everywhere

agile anvil
#

The permission things is way harder to realize ahah

#

looping over players is so easy how can you even be lazy of that ?

quaint mantle
#

because ive never done that

wet breach
deft latch
#

Oh I think it just fixed itself wierd... Not complaining too much tho.

wet breach
tender shard
#
for(Player player: world.getPlayers()) {
  player.sendMessage("nyaa uwu mrrp~ :3");
}
agile anvil
wet breach
#

No

#

Broadcasts show up differently then regular messages

agile anvil
wet breach
#

What alex showed, wouldnt appear as a broadcast but as a message from server

wet breach
agile anvil
#

How do they represent that in the game ?

wet breach
#

It shows on top of the chat area as red and is prefixed automatically with the world broadcast

agile anvil
#

Finally a readable chat (for some servers)

wet breach
#

Its been there forever like almost near the beginning of mc

#

Then came the second broadcast channel

#

Which is for players joining and dying etc

#

Which is similar to server messages. Server messages are prefixed with the word server

agile anvil
#

How did I never noticed that ahah

wet breach
#

Probably because the api removed the prefix when you send players messages if i recall

#

And only notice server messages when you use say at the terminal lol

agile anvil
#

Thanks for this explaination

quaint mantle
#

if(m.containsValue(damageEvent.getDamager().getName())){
m.get(damageEvent.getDamager().getName()) += damageEvent.getDamage();
}

#

so im tryna sum doubles in map M

#

Map<String, Double> m = new HashMap<String, Double>();

#

but im not doing smt right

#

:(

agile anvil
#

First: use UUIDs instead of player names
Second: You should make some check to be sure the damager is not null, that it's a player.
Third: Map#get returns a value and not a reference, you need to use the method Map#set to change the value of the map

quaint mantle
#

i just wanna print top damagers

#

i wont be doing much with the names

quaint mantle
#

where i put current value and add onto the new value

#

and put it back in?

#

that wasnt a question im sorry ugh my english lacking

#
            if(m.containsKey(damageEvent.getDamager().getName())){
                Double sum = m.get(damageEvent.getDamager().getName()) + damageEvent.getDamage();
                m.put(damageEvent.getDamager().getName(), sum);
            }
#

like this?

#

or no thats gonna create a new entry

#

or will it

#

ig ill do the try it and see method

glad prawn
upper hazel
#

question of dilemma. Should exceptions be created when there is no harm to the logic? But the user will not know the result

agile anvil
#

Exceptions could be used to jump in the code. It's also meant for that so ofc !

upper hazel
#

i no need to jump in code

agile anvil
#

Stopping the code earlier is a kind of jump

upper hazel
#

that's not the problem

hushed spindle
#

exception stuff should typically not be used to handle actual logic but usually just when something goes- or is done wrong

#

is that what you're asking

upper hazel
#

For example, deleting data, if the data is present, then delete it or? Ignoring it will not result in an error. This is the crux of the matter

tall dragon
#

Exceptions are a wonderful thing. They can let your code recover from unexpected situations in a nice and clean way, if you use them properly. That does not mean that you should always rely on them though. For example, imagine this: Most highways have guardrails in the middle to avoid cars going into oncoming traffic....

#

@upper hazel

upper hazel
#

hm good

#

this applies to database queries
😀 ?

#

like delete, update, add etc

tall dragon
#

for example if data doesnt exist i woulnt throw an exception

#

if a query cannot be completed for some reason on the other hand i would

agile anvil
#

There are many kind of uses of Exceptions. And sometimes it could be useful to use exceptions especially for efficiency (for instance to stop an algorithm before it does it all).
But those case should be handled carefully (basically if you are the own creating and using the exceptions, it's totally fine)

wet breach
# upper hazel question of dilemma. Should exceptions be created when there is no harm to the l...

exceptions should only ever be thrown if your programming logic can't decide in what to do about some other input you don't have much control over. For example, take the relationship of spigot server and plugins. There are some things the server could do but then the server is invoking control over the plugins or making decisions that otherwise the developer may not want to have happened. So instead you throw exceptions to let it be known that something did or did not happen but the parent application doesn't know how it should be handled and thus you are allowing the next thing in line to handle it instead if it can. Throwing exceptions is only beneficial for other things or other applications and debugging, but not necessarily to your application itself because exceptions should always be handled where ever possible and following that logic it makes no sense to throw exceptions just so you can handle it yourself.

rough drift
#

exit(0xAAAAA)

quaint mantle
#

How can I customize the hover player name? I mean on top of the player

inner mulch
#

it takes more effort tho

#

i can tell you if you want

young knoll
#

Well, with modern spigot display entities work well for that

inner mulch
#

yes, thats what i was going for, it isnt possible by just player.setname or something

#

thats what i meant by not "possible"

smoky anchor
quaint mantle
rough drift
quaint mantle
#

Are there any good FoxSpigot developers?
If so DM me

fallen lily
#

Me when <name>Spigot doesn’t use the normal Spigot API and requires special knowledge

chrome beacon
undone axleBOT
clever lantern
#

what is the best solution to block player from entering certain area

chrome beacon
#

There are two ways:

  1. Listen to the PlayerMoveEvent
  2. Use a scheduler to run and check position every tick
clever lantern
#

which is better

eternal oxide
#

depends how much "checking" you have to do

fallen lily
#

additionally you can check using code in a repeating loop

clever lantern
#

yeah maybe you can check if player is near area every idk x sec and if its true start task every tick

vestal mountain
#

someone can help me? error: 'x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type ```java
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.animal.EntityBee;
import net.minecraft.world.level.World;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld;
import org.bukkit.entity.Bee;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;

public class BeePet extends EntityBee {

    public BeePet(EntityTypes<? extends EntityBee> entitytypes, World world) {
            super(entitytypes, world);
    }

    private void spawnBee(Location location, Player owner) {
    Bee bee = (Bee) location.getWorld().spawnEntity(location, EntityType.BEE);

    String customName = "§6Méhecske §8(§7" + owner.getName() + "§8)";
    bee.setCustomName(customName);
    bee.setCustomNameVisible(true);

    bee.setAI(true);
    bee.setSilent(true);
    bee.setCanPickupItems(false);
    bee.setInvulnerable(true);

    bee.setMetadata("owner", new FixedMetadataValue(this, owner.getUniqueId().toString()));


}

}

chrome beacon
#

Like we told you to yesterday

vestal mountain
#

but i dont know

chrome beacon
#

If you're going to ask for help don't ignore what we say

empty temple
#

I need a help.
I purchased a 24 GB RAM paid hosing though.
I will send my requirements here for plugins.
If u guys help me to find bestest plugins for server. It may Premium or Free. I prefer free more . But if u think premium one is better than free then plz plz plzz suggest.
I will appreciate.

lilac dagger
#

or use the remapped spigot

shadow night
#

Try it and see

#

But I think it also depends on the characters

#

What about W or M

#

Yep

#

Yep

#

It should specify "up to 798, depending on the characters" ig

smoky anchor
#

Docs are incorrect ye, it was recently fixed so the limit uses vanilla limits.

shadow night
#

Do we have the Font class on the server side? Or whatever tf it was called

sterile flicker
#
@EventHandler
    public void trySword(PlayerInteractEvent event) {
        if (event.getAction().equals(Action.RIGHT_CLICK_AIR)) {
            if (event.getItem() != null && event.getItem().getType().equals(Material.WOOD_HOE)) {
                if (event.getItem().getDurability() == 16) {
                    Snowball snowball = event.getPlayer().launchProjectile(Snowball.class);//org.bukkit.event.EventException: null
                    snowball.setMetadata("ballType", new FixedMetadataValue(SumeruRpg.plugin, "custom"));
                }
            }
        }
    }
    @EventHandler
    public void catchSword(ProjectileLaunchEvent e) {
        Player p = (Player) e.getEntity().getShooter();
        if (e.getEntity().getType().equals(EntityType.SNOWBALL) && e.getEntity().getMetadata("ballType").get(0).asString().equals("custom")) {// java.lang.IndexOutOfBoundsException: Index: 0
        }
    }
    
```why?
dawn flower
#

when i try to compile, it says "newPosition < 0: (-1 < 0)"

it's very weird, it only happens if "config.yml" in resources is named "config.yml" and if it has any text

here's config.yml

  randomX: 0.1
  randomY: 0.05
  randomZ: 0.1
text:
  basetext: "&c{damage}"
  crittext: "&c✧{damage}"```
#

i tried restarting my ide

quaint mantle
#

how to make it so that it code executes a method every 15mis?

dawn flower
#

for async timer just do runTaskTimerAsynchronously

#

alr

quaint mantle
#

what does async timer do

dawn flower
#

it's like a clock, runs the code every ? ticks

#

if it's async it runs it outside of the main thread, it's helpful to make it lag less but sometimes it's not recommended

vestal mountain
#

someone can help me whats next to a PathFinderGoal? ``` private void spawnBee(Location location, Player owner) {
Bee bee = (Bee) location.getWorld().spawnEntity(location, EntityType.BEE);

                    String customName = "§6Méhecske §8(§7" + owner.getName() + "§8)";
                    bee.setCustomName(customName);
                    bee.setCustomNameVisible(true);

                    bee.setAI(true);
                    bee.setSilent(true);
                    bee.setCanPickupItems(false);
                    bee.setInvulnerable(true);

                    bee.setMetadata("owner", new FixedMetadataValue(this, owner.getUniqueId().toString()));

                    CraftEntity craftEntity = (CraftEntity) bee;
                    net.minecraft.world.entity.Entity nmsEntity = craftEntity.getHandle();
                    EntityCreature creature = (EntityCreature) nmsEntity;


            }
    }

}

jagged obsidian
#

hey do you guys know a lot about plugins and stuff?

dawn flower
jagged obsidian
#

🫡

agile hollow
#

for implement a librarie i have to implement the jar file of the plugin right?

dawn flower
#

i updated maven plugins and still 'newPosition < 0: (-1 < 0)'

agile hollow
umbral ridge
#

can you show a custom toast notification?

eternal oxide
#

add a custom achievement and complete it

umbral ridge
#

Found a plugin that does this

umbral ridge
empty temple
#

how u guys can send photo and not me

dawn flower
#

should i use the new text display or the og armor stand method?

empty temple
#

A. Best Anti-Cheat plugin to block Meteor and also to block
other hacks.
B. Best Anti-Redstone plugin to prevent crash.
C. Best Anti-Dupe plugin
D. Best Anti-Exploit plugin
E. Best Plugins for: -

  1. Custom Enchantments
  2. Shop
    
  3. Auction
    
  4. Job
    
  5. NPC
    
  6. Money note
    
  7. Cosmetics
    
  8. Mobs
    
  9. Kits
    
  10. In-Chat Reaction, Puzzles
    
  11. Chat
  12. Prevent Curse words
  13. Custom tools
  14. Crates
  15. Vouchers
  16. Manage timed Ranks
  17. Manage limited time any commands (ex.= /fly)
  18. For Gui of Multiverse.
  19. Level up, Playtime Gui and reward system.
  20. Lobby, Hub, Jumping Pads

These are my Plugins requirements.
If all of u guys help me to suggest me the best plugins .
I will very very appriciate you .
@chrome beacon And specially you broo plz

empty temple
#

yaaaa i put .... thmmm .... I buy spartan and put .....
I need other plugins also ... SO , i just send

#

TNT dupe ... and carpet dupee and what about others

#

1.20.1

dawn flower
inner mulch
#

this is some cool stuff

empty temple
#

why the bot showing .... Command not found when i try to verify

eternal oxide
#

are you typing !verify name

empty temple
#

but i need to remove my these id

eternal oxide
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

sterile flicker
#

how do I set the metadata for this which I will handle in projectilelaunchevent and projectilehitevent player.launchProjectile(Snowball.class);

#

setmetadata does not work after launchprojectile

dawn flower
#

scoreboard tag or persistent data container for quick data?

dawn flower
eternal night
#

PDC

half bluff
#

For the PlayerEvent, I see two constructors, one requires the player, the other wants the player and true or false for being async.
So my question is if the PlayerEvent is default Asynchronous or Synchronous, or do you have to use the boolean parameter to make it Async?

Hopefully I asked that clearly.

For context, I am extending the class and making my own event and I want to make sure it's Async as it will be called multiple times at once.

inner mulch
#

you dont listen to the playervent

#

oh i didnt read everything sorry

tall dragon
#

the Event class does have a contructor taking a boolean though

#

any constructors like that without one assume your event is synchronous

inner mulch
half bluff
#

This is the constructors; That's how I came about with the question.

public abstract class PlayerEvent extends Event {
    protected Player player;

    public PlayerEvent(@NotNull final Player who) {
        player = who;
    }

    PlayerEvent(@NotNull final Player who, boolean async) {
        super(async);
        player = who;

    }
}
tall dragon
half bluff
tall dragon
#

jup

half bluff
#

Interesting. I wonder as to why they don't just have one constructor and make you just define it?

dawn flower
#

just do super(player, async)

half bluff
tall dragon
#

well make sure u take these things into account @half bluff

ivory sleet
dawn flower
#

is there a slower PlayerAttemptPickupListener? i'm cancelling the event and sending a messgae, it's sending 1 message a tick which is pretty fast and spams the player's chat

dawn flower
#

is 2 seconds a good cooldown

lost matrix
#

Btw if you only want a single player being able to pickup the item, then you give it an owner tag.
This prevents the event from being fired in the first place.

dawn flower
#

owner tag?

#

oh

lost matrix
half bluff
# tall dragon well make sure u take these things into account <@273583270002819072>

That's a good pointer actually.
My dilemma currently is if I do two different actions at once, one succeds and the other does not. It's not until I stop the succeeded action that the second action then succeeds on triggering my event.
Currently it's just using the constructor passing the player parameter, which is why I am thinking that specifying the Async to true would resolve the issues given the "Simultaneously" capability on async.

dawn flower
#

ic, but can i make it send a message when they try to pick it up

echo basalt
#

I wonder what the owner tag is used for in vanilla

lost matrix
echo basalt
#

I mean yeah but where

lost matrix
#

Probably just used as a tool for map makers

ivory sleet
#

iirc its used in the /give command when the senders inv is full

#

then it drops the stack binds owner to sender

dawn flower
#

pretty sure there's a method like getAsBukkit

#

or smth

#
public static Block getBukkitBlock(net.minecraft.server.BlockEntity nmsBlockEntity) {
        net.minecraft.server.World nmsWorld = nmsBlockEntity.getWorld();
        World bukkitWorld = Bukkit.getWorld(nmsWorld.getUID());

        int x = nmsBlockEntity.getPosition().getX();
        int y = nmsBlockEntity.getPosition().getY();
        int z = nmsBlockEntity.getPosition().getZ();

        return bukkitWorld.getBlockAt(x, y, z);
}``` u can try smth like this
lilac palm
#

Should I set my plugin price to 19.99 GBP instead of 19.99 USD to maximize profits?

fallen lily
#

Bluds are limiting the pricing of plugins 😭

worldly ingot
#

As if that hasn't been a restriction since the start of premium resources like more than a decade ago

#

This isn't a surprise lol

dawn flower
#

they prob dont want 100$ plugins or smth

acoustic pendant
#

Why is section null?

remote swallow
#

what does it look like in config

acoustic pendant
remote swallow
#

what about the one on the server

#

also you probably need to wrap the one in quotes

acoustic pendant
#

the same

shadow night
#

why do you capitalize Rewards, it's gonna kill me

acoustic pendant
#

fuck

#

i'm so dumb

remote swallow
#

if that doesnt work print out rewards.getConfig().getValues

acoustic pendant
#

nvm is solved now thanks

proud badge
#

Is it possible for a client to modify their PlayerLoginEvent.getHostname() to anything they want?

torn shuttle
#

can someone remind me how to pass from async back to sync

torn shuttle
#

would scheduling a task inside of the sync task using getScheduler#runTask() do it?

shadow night
#

If you mean inside the async task then should be a yes

torn shuttle
#

oh wait I'm dumb

#

I forgot to cover one of the if statements

#

that's why it's not working

proud badge
#

What is PrepareItemCraftEvent, doesn't have a description?

#

And what event could I use for when a player crafts an item

#

Ok what event could I use for when the item is picked up

inner mulch
#

guys how do i stop blockupdates, for example a flower getting destroyed by water, or a floating flower being destroyed cuz no block under it?

cursive loom
#

Hello how I can get in a PlayerInterractEvent if the player shift right click ?

chrome beacon
#

Check if the player is sneaking

cursive loom
#

xD thx

#

Oh and how I can know if the player ctrl click ?

chrome beacon
#

You can't

cursive loom
#

Ok thx

inner mulch
minor junco
# inner mulch guys how do i stop blockupdates, for example a flower getting destroyed by water...

There's events for this. BlockChangeEvent etc. Have a look in one of my projects, there's many block update events used you may wanna also use

https://github.com/aparx/skywarz/blob/master/src/main/java/io/github/aparx/skywarz/game/arena/reset/DefaultArenaResetListener.java

GitHub

An advanced skywars minigame plugin. Contribute to aparx/skywarz development by creating an account on GitHub.

#

(yep the map reset is not yet region based, was just a temporary thing)

inner mulch
proud badge
inner mulch
proud badge
#

BlockFromToEvent fires when a torch or something similar is destroyed by water or lava.

#

And maybe BlockPhysicsEvent does something similar with blocks changing states

#

In Bukkit, the BlockPhysicsEvent is an event that is called when Minecraft physics affect a block, such as when a block is updated due to changes in its surroundings.

haughty lion
#

Hi, i wanna make a Server with my friends with some custom Weapons which can only be crafted once. I am trying to figure out how to send a message in the chat when the custom weapon got crafted like: (username) has just crafted (weapon name). Can anyone help me?

proud badge
proud badge
#

Ok thanks

modern wedge
#

Just a quick search in the api guide i found that

proud badge
#

Ok idk how I didn't see that earlier

modern wedge
#

HI everyone! New with the spigot/bukkit api. For a high-level overview, I am working at creating an rpg system (just for fun and the experience of doing it). I want to save data to the character and I see most people doing this by storing player values etc in either a database or in a YAML file. Would a database be better for storing and dynamically updating experience / levels / stats etc? Or is this something I should be adding to a player save file (that I would create and store locally on the server). Any general recommendations on handling this task?

ivory sleet
#

well I think for starters its wise to write an abstraction over whatever storage system you're picking, since it becomes easy to change later on

if you can afford it, I think a database is of huge beneficence

modern wedge
ivory sleet
#

well there are many ways to limit resources to the database, if you're afraid of too many connections considered a connection pool such as hikaricp (a java lib), else there is other ways to limit it by using a semaphore for example.

modern wedge
ivory sleet
#

and ofc its a given that you probably aim to save the data async more or less

modern wedge
#

I was looking at more of an Async setup originally

#

So that way, the plugin has less chances of losing data.

ivory sleet
#

well async more means that u're able to do the data saving (and potentially loading) without blocking other code that needs to be executed

modern wedge
#

Yep! Running concurrently along with the process.

#

That gives me some ideas to work with, thanks!.

umbral ridge
#

Hey what is delay and period in runTaskTimer again?

#

delay is a delay between periods?

ivory sleet
#

period means interval

umbral ridge
#

period is how much time it takes?

ivory sleet
#

and delay is basically initial delay

umbral ridge
#

ohh I see thanks Conclube the Dog

ivory sleet
modern wedge
vernal basalt
#

I need to create a thirst system, how do I go about doing this?

#

create a list of every player and their thirst then every tick check if they are too low?

#

then i set the thirst level with an event that runs when food goes down

fallow gyro
#

Relating to the inventory drag event's getNewItems() method: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryDragEvent.html#getNewItems()

I'd like to ask, will all the items within this list be the same "type"? As in, will there ever be a scenario where the player drags both a stick and a piece of paper into the inventory?

I'm wondering whether I need to check each item within the method, or if I only need to check the first one.

fallow gyro
vernal basalt
#

yeah I have this

#
public class ThirstSystem {

    private final Map<UUID, Integer> playerThirsts = new HashMap<>();

    public void addPlayer(Player player) {
        playerThirsts.put(player.getUniqueId(), getPlayerThirstLevel(player));
    }

    public int getPlayerThirstLevel(Player player) {
        if (playerThirsts.containsKey(player.getUniqueId())) {
            return playerThirsts.get(player.getUniqueId());
        }
        return NBTEditor.getInt(player, "thirstLevel");
    }

    public void removePlayer(Player player, int thirstLevel) {
        NBTEditor.set(player, thirstLevel, "thirstLevel");
        playerThirsts.remove(player.getUniqueId());
    }

}```
#

but sets say i want to give nausea to players under 20% thirst

#

ig i do it on the setPlayerThirst level

empty temple
#

Anyone know a plugin for giving time limited permission of /fly or smth like this

modern wedge
vernal basalt
#

i wouldn't use a cron job, aren't those like added to the system? why not just a timer

#

depends on how long

modern wedge
#

cron is just a timer

#

thats what i meant at least lol

#

since i see them the same, sorry.

fallow gyro
vernal basalt
empty temple
# modern wedge cron is just a timer

Wooooo wooo ... yesss I just need that timer type plugin ...
Wait i will explain u ...
I will make a voucher that calls 5 mint Fly Voucher
And it gives permisssion to players to fly only for 5 mints after that they need to earn

vernal basalt
# modern wedge cron is just a timer

idk i could be wrong but i was doing something in javascript and i wanted to run a function every 10 minutes, even if i stopped the script the code would still run because at least 1 job was scheduled before i stopped the script

empty temple
umbral ridge
#

if player duplicates an item through anvil, is PDC transferred or not

eternal night
#

Item don't tend to duplicate via anvils

modern wedge
eternal night
#

Yes ™️

umbral ridge
#

How about this?

#

is PDC transferred?

eternal night
#

yes ™️

umbral ridge
#

alrightly

eternal night
#

easy test is to just throw lore at the item

#

see if lore transfers

#

and that usually means the PDC also is kept

vernal basalt
#

can I check if the foodLevel went up or down?

#

because i dont want the thirst to go up if they eat food

#

i jsut want it to go down if they are running and using energy

modern wedge
#

FoodLevelChangeEvent

vernal basalt
#

it just says what it is

#

not what it was

#

or rrrrr

#

will the player's food level be different

modern wedge
#

IF you use that as a EventHandler

#

it will run whenever it changes

#

or are you just trying to check randomly?

valid burrow
#

we have listeners for a reason

modern wedge
#

Thats my point ^

vernal basalt
#

or actually exhaustion would be better right?

modern wedge
#

If you are trying to check for the food level

#

you need to use FoodLevelChangeEvent

#

then do checks in there

#

if it goes up / down

#

If a player eats something, that will run.

#

same if it goes down.

vernal basalt
#

but the event.getFoodLevel will be different than player.getFoodLevel

#

so i can see which changed?

umbral ridge
#

?jd-s

undone axleBOT
slim gate
#

How can I send a "message" (like tell a thing needs to happen) from bungeecord plugin to spigot plugin?

umbral ridge
tall dragon
umbral ridge
#

"should be set to"

valid burrow
#

HashMap<Player,int(PreviousFoodLevel))

slim gate
valid burrow
tall dragon
valid burrow
#

so he can see if it went down or up

tall dragon
#

if u can work with that it will work fine

vernal basalt
#

actually tbh i dont even need the food level

valid burrow
#

yeah but u need to know if it went down

slim gate
valid burrow
#

the only way is to compare previous and new one

#

and to do that you need to cache the old one

#

which is fairly simple

#

1 hashmap is all it takes

vernal basalt
#

really what i need is exhaustion level but there are no events for that

#

i dont even play mc how does exhaustion work? from what i can tell when you do actions and stuff like sprint and punch it removes a small amount from it, but when it hits 0 it removes a food level but resets exhaustion?

modern wedge
#

Exhaustion is just when foodlevel == 0?

#

So you are looking to track the values of each action?

shadow night
#

Exhaustion? Is that the little gray bar appleskin adds

fallow gyro
tall dragon
umbral ridge
#

or at all

fallow gyro
umbral ridge
#

What do you mean the same type?

fallow gyro
umbral ridge
#

Yeah it will be an item that was dragged

#

presented as ItemStack so you can get the full data

fallow gyro
slim gate
# tall dragon https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/ documentat...

I realised this is probably better to do without messaging things.
I want to give a player a map in Bungeecord (I can't that's why I'm making a spigot plugin thing for that). I want to disable the "standalone plugin" if it detects that the plugin is also in Bungeecord. Then just do the map thing. And if it's not installed on Bungeecord, the plugin will do the same thing as if it would be on Bungeecord but without extra bungeecord things. Also if you know how I can give items in Bungeecord, that would be awesome.

#

Also if there's a better way to do that please let me know

shadow night
#

I'm pretty sure you can't give items on the bungeecord unless you have some communication with the backend server

umbral ridge
tall dragon
fallow gyro
slim gate
tall dragon
#

you send a message

#

and see if it responds xD

grim hound
#

how do I tell IntelliJ that I don't use gradle?

#

Like I deleted all gradle files

#

but it still indexes it at start-up

slim gate
grim hound
#

even tho I don't use it in any way

umbral ridge
fallow gyro
grim hound
#

I just once created a module with gradle and deleted it later on

#

but now it thinks that I use it

slim gate
slim gate
#

ofc there's another wiki for that

#

i tried googling

tall dragon
#

but of course 😄

inner mulch
#

any1 knows if i can create ghost items with the spigot api?

#

or does it require packets?

umbral ridge
#

ghost items?

inner mulch
#

items t hat the player can see that dont actually exist server side

tall dragon
#

yeaa you are prolly going to have to fiddle with packets for that one

slender elbow
#

OCP........

inner mulch
umbral ridge
#

OCD

#

....

inner mulch
#

my new favorite principle is actually dependency injection 🤓

slender elbow
#

my favourite DI method is putting things in a public static field and accessing it whenever I need it anywhere

umbral ridge
#

my favorite thing is to drink coffee and smoke while preparing to code

#

firing up intellij...

tall dragon
#

and then procrastinating untill its time to sleep

umbral ridge
#

telling my cat to move away from my keyboard..

tall dragon
#

😂

inner mulch
umbral ridge
#

you cant its impossible my cat is the smartest and prettiest

#

btw is this your cat in your profile pic? 😂

inner mulch
#

i'd like to have one tho

#

like yours or the one in my pfp

#

your cat is so beautiful

lilac dagger
#

@inner mulch you don't want a cat

#

run while you can

inner mulch
#

cats are cute tho

lilac dagger
#

that's how they get you at first

umbral ridge
#

yesss

#

cant live without cats

rough ibex
#

did... you not know about autoindents?

slim gate
#

what did I say

#

argh

#

can I send without a player?

slender elbow
#

given that plugin messages are primarily to communicate with the client

#

no

chrome beacon
#

A player needs to be online for plugin messages to work

charred blaze
#

can i register commands like that?

#

i want to have different classes for each command

slender elbow
#

use imgur or something

#

discord cdn is dead

charred blaze
#

does this one work? ^

#

okay this one should work

#

mhm

#

what about the question

#

i know

#

yea but i can with arguments

#

but then i need to do all my commands in one class

slender elbow
#

you need to handle the arguments in the command executor

charred blaze
#

is there some alternative

slender elbow
#

the command is just arenaprotection

charred blaze
slender elbow
#

command frameworks or have some Map<String, CommandExecutor> in the arenaprotection command and handle that there

charred blaze
#

what

#

do i really need to do that

glad prawn
#

maybe

charred blaze
#

what can i do with the map of commandexecutors?

#

why are we saving it

slender elbow
#

map the argument to the executor

charred blaze
#

and?

#

ur missing the awesome part

slender elbow
#

map reload to reloadcommand, map bypass to bypasscommand, etc

#

then just get by the argument and execute accordingly

charred blaze
#

im actually trying to "command reload" and "command bypass"

slender elbow
#

?

charred blaze
#

how do i execute commandexecutor

#

i can do that?

slender elbow
#

onCommand

charred blaze
#

how can i execute the commandexecutor

hazy parrot
#

Just run method

charred blaze
#

how

slender elbow
#

executor.onCommand(blah blah)

charred blaze
#

i dont understand

slender elbow
#

the exact same way you call any other method in abyb other class

#

it calls the method

charred blaze
#

so.

if the argument is "reload"
executor.onCommand("command reload")?

slender elbow
#

no

charred blaze
#

-_-

#

i know

slender elbow
#
class CoolCommand implements CommandExecutor {
  Map<String, CommandExecutor> subcommands = new HashMap

  public boolean onCommand(whtaever the parameters are) {
    if (args.length == 0) {
      sender.sendMessage("you stink");
      return false;
    }

    subcommands.get(args[0]).onCommand(sender, args, idk);
  }
}
charred blaze
#

....

#

in that map

#

there is some other commandExecutor class right?

#

how do you execute that class in that onCommand?

#

a

slender elbow
#

very much pseudocode, you should null check to see if it's a valid subcommand etc

#

and add the subcommands you want to handle to the map as well

#

and then in your onEnable just getCommand("cool").setExecutor(new CoolCommand())

shadow night
#

What's the point of making plugins have all commands in the plugin.yml instead of registering it directly with all the shit? Is it something left over from the ancient days or what

charred blaze
#

cant i directly access the commandexecutor without storing it

#

like this

slender elbow
charred blaze
#

oh discord cdn is back alive

slender elbow
#

if the command holds state then you'll want to reuse the same instance

#

ideally it wouldn't

shadow night
slender elbow
#

better late than never

charred blaze
#

command holds state? wdym

shadow night
#

True

slender elbow
#

by having them in a map you don't need to check the argument

#

if (arg.equals("reload")) callreload
else if arg.equals("something") callsomething

#

etc

charred blaze
#

yea but

slender elbow
#

that's ugly

charred blaze
#

if theres not the command in map

#

player will get help message

#

and help message is ugly

#

but its easier

#

hm

slender elbow
#

i mean what else are you gonna do if you don't have a command in your if-else chain?

charred blaze
#

would it cause problems if i pass current onCommand's parameters to the executor?

slender elbow
#

it's fine but you'd have to be aware of the implications of that in the subcommand, e.g. args[0] is the subcommand name and not the argument following the subcommand

#

for the rest it's fine

charred blaze
#

i can just remove the label from command?

slender elbow
#

you can get fancier and better by introducing your own command interface, something like

interface SubCommand {
  void execute(CommandSender sender, Queue<String> args);
}

less parameters that you don't need and you could pop args out of the queue before passing to the subcommand

#

but this aproach is fine

charred blaze
#

i only need to add the commandexecutors to the map in onenable right?

slender elbow
#

you can add them anytime but that's fine

charred blaze
#

so like this?

tardy delta
#

dont expose that executors shit

charred blaze
#

wdym

tardy delta
#

map

charred blaze
#

ill try some debugging

rapid ore
#

hi, how i can create a tablist?

#

there's an api or something?

charred blaze
#

ArenaProtector.commandExecutors.get(args[0])

#

doesnt work somehow

blazing ocean
# rapid ore hi, how i can create a tablist?

its changed a lot since 1.8; theres no current good way to create an actual fully custom tab list without having a billion mental breakdowns, so you're better off using Player#sendPlayerListHeaderFooter

#

with a library like packetevents, you can hide all regular players and create fake players (only in the tab list)

rough ibex
#

or you can rely on another tab library

blazing ocean
#

i have not seen proper tab libs for 1.20+

#

more specifically, none

upper hazel
#

Is it possible to somehow remove the glow of an item’s enchantment?

blazing ocean
#

resource packs

#

change the enchant glint to an empty png

upper hazel
#

not for items

blazing ocean
#

wdym

upper hazel
#

i mean for specific items

#

not for all

blazing ocean
#

i dont think thats possible

upper hazel
#

((

young knoll
#

You would have to remove all the enchantments and re-add them with lore

#

Client side only

#

Or wait for 1.20.5

blazing ocean
#

1.20.5 is gonna be really fun for resourcepack stuff

young knoll
#

Meh

#

Not much resource pack wise

blazing ocean
#

isnt that the new multi resourcepack thing

young knoll
#

That is in 1.20.4

blazing ocean
#

oh

#

i forgor

dreamy chasm
#

is there a link to see what changes come with 1.20.5?

blazing ocean
#
Minecraft Wiki

1.20.5 is an upcoming minor update with no set release date. The update plans to add armadillos, wolf armor and new wolf variants along with fixing many bugs. It also plans to update the Update 1.21 Experiment, including the addition of the vault,wind charge and bogged.

young knoll
#

No official changelog yet

#

But yeah there is the wiki

blazing ocean
#

proxies !

young knoll
#

Oh yeah transfer packets

#

Pretty cool

blazing ocean
#

also cookies

#

lets go facebook tracking inside of minecraft

young knoll
#

Cookies are meh

#

The client controls them so you can't store anything important in them

blazing ocean
#

yeah

soft hound
#

Okay so I'm working with someone on a github repository and whenever we merge the project, i get this:

#
<<<<<<< HEAD```, how do I fix the HEAD?
#

And why does it keep appearing?

blazing ocean
#

that is a merge conflict

#

you should try using e.g. the intellij conflict viewer

#

makes it a lot easire to visualise everything

soft hound
#

Oh okay, thanks, i'll try that right now and see how it works.

blazing ocean
#

can you show your code

#

i mean

#

we need your code to help you debug it

eternal oxide
#

?paste

undone axleBOT
blazing ocean
#

if you say you have a script containing something, we need to know what it contains

#

also

#

where are you registering the command

#

well

#

we need to know what the sword class has

#

no

eternal oxide
#

commands auto register to the main class, unless registered elsewhere

blazing ocean
#

you need to implement CommandExecutor and call JavaPlugin#getCommand#setExecutor

#

wait what!??

eternal oxide
#

he doe snot

blazing ocean
#

okay i didnt know that

eternal oxide
#

log errors?

blazing ocean
#

it is null then

#

send us your sword class

#

onEnable?

#

you ned to use constructors

#

onEnable and onDisable are only for plugins

dry forum
#

is BlockFormEvent the right event to be using when trying to detect copper block changing

blazing ocean
#

you need to do public sword() {

#

which is a constructor

proud badge
#

if I already have an EntityDeathEvent listener in my code, is it going to be better if I just make a new PlayerDeathEvent listener, or just add an event.getEntity instanceof Player in my EntityDeathListener?

blazing ocean
#

makes no huge difference as long as you exclude players in the entity death event

#

can you send the class

#

because then you didnt do it properly

#

^^

proud badge
#

is there any difference between ignoreCancelled = true and !event.isCancelled()?

eternal night
#

Thank you chatgpt

#

ah

blazing ocean
#

lmao

eternal night
#

ImmutableLists does not exist

rough ibex
#

idk you use chatgpt for a lot of stuff.

eternal night
#

List.of instead

#

its a guava dependency

#

why would you use it

#

or well, google commons

#

How is that type not deprecated skully List.of has existed for like

#

an eternity

#

Well, I guess java 9. My poor java 8 compatibility

rough ibex
#

oh no java 8

wise blade
#

who can help me? look, I created velocity, grief, hub, downloaded java 11 for grief and hub 8 java for minecraft, 17 for velocity, but I have a question: how to set the path to java? please help

eternal night
#

just fully define the path to the java binary

wise blade
#

windows

rough ibex
#

disgusting

vernal basalt
#

exhaustion level is what im looking for. since there is no event for when it changes what can i do? check every tick???

eternal night
#

like /usr/lib/jvm/java-17-jbr/bin/java -jar server.jar

#

instead of java -jar

#

oh

blazing ocean
#

instead of using java as command, use e.g. C:\Program Files\Java\bin\java (idk the exact path, just a guess)

eternal night
#

windows server????

blazing ocean
#

probably windows

#

but just used to host, im not gonna assume they use windows server

#

appdata?

rough ibex
#

java.exe

blazing ocean
#

im pretty sure it was program files

rough ibex
#

yeah

#

something like that

#

appdata should not hold the JDK

wise blade
#

@echo off
java -Xms512M -Xmx512M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -jar velocity.jar
pause Please respond to the text how to create the path to Java 17

rough ibex
#

most use adoptium

rough ibex
#

you will need to read and learn

#

and find your JRE

wise blade
#

I found mine JRE

blazing ocean
#

adoptium is C:\Program Files\Eclipse Adoptium\

rough ibex
#

or escape it

blazing ocean
#

?whereami

wise blade
#

@echo off
java "C:\Program Files\Java\jdk-17" -Xms512M -Xmx512M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -jar velocity.jar
pause ?

#

Do you understand that it’s difficult for me to understand you because I don’t know English and the CIS countries and I communicate through a relay?

vernal basalt
#

how can i see what spigot version something was added in?

wise blade
#

thanks guys I did it, good luck to you

vernal basalt
#

i dont see why they wouldn't have it

kind hatch
#

Unfortunately not available.

warm mica
vernal basalt
#

why wouldn't it exist in older versions

kind hatch
vernal basalt
#

no backport?

kind hatch
# vernal basalt no backport?

Spigot doesn't backport features. Never has.
The only exception to this was the security fix for the Log4J vulnerability

vernal basalt
#

just the event class?

rough ibex
#

or, upgrade

vernal basalt
#

not my server, server runs on 1.12.2

rough ibex
#

1.12.2 is old

#

you should advise the owner

#

yeah and you're wrong for that

grim ice
#

does a snake game need a Continue to continue from your last save? or is that pointless

chrome beacon
#

pointless

#

but if you want to create it as a challenge then it could be a good idea

rough drift
#

pointless? I want to continue from apple 40569675909345 ofc.

umbral ridge
#

is there a max string length in pdc?

#

or any limit of data at all?

lost matrix
umbral ridge
#

ok 1 gb of string data

#

xDD

flint coyote
#

That's not reasonable.

umbral ridge
#

XD

flint coyote
#

Especially for public plugins. That data stays even when your plugin gets deleted

umbral ridge
#

1 tb of data

flint coyote
#

Therefore it uses all the memory without being of use

umbral ridge
#

i'm joking, I guess around 120 bytes is alright?

flint coyote
#

yes

winter galleon
#

how can i check the region at player? i arleady imported world guard api, i can't find nothing on google plz help

jolly quarry
#

Hello, can I find someone who will make me a plugin using gpt chat? Please, I need it for a server for my friends and I don't know how to make them

flint coyote
winter galleon
#

yeah, the region the player is standing in

flint coyote
#
    public Set<ProtectedRegion> getRegionsAtLocation(Location loc) {
        ApplicableRegionSet regionSet = regionQuery.getApplicableRegions(BukkitAdapter.adapt(loc));
        return regionSet.getRegions();
    }
winter galleon
#

at "regionQuery.getApplicableRegions(BukkitAdapter.adapt(loc));" the "regionQuery" is red

flint coyote
#

Yup that's part of the api.

#
regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer();
regionQuery = regionContainer.createQuery();

But I can send you that piece of code, too

winter galleon
#

omg its all reed D:

flint coyote
#

Yeah you have to assign them with a data type

#

Not that hard

winter galleon
#

im new to spigot plugin development, that's why

flint coyote
#

Do you know basic java?

winter galleon
#

yup

flint coyote
#
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.protection.regions.RegionQuery;

Then here's all the imports you might need for the code above. Add them to your class and then assign the data types to regionContainer and regionQuery

winter galleon
#

okay tysm

warm mica
#

Haters would tell you to use a wildcard import instead

flint coyote
#

Personal preference

rough ibex
#

I dislike *

worldly ingot
dry forum
#

i couldnt find anything online, how would i leash 2 entities together?

modern wedge
dry forum
worldly ingot
#

+1 for using Spigot docs

#

ty Emily PeepoFlushed

#

free cookie for you

summer scroll
#

Hey, so for some reason I got Duplicate entry error while trying to replace a data in sql database, from my understanding, REPLACE INTO will delete and insert a new one if there is already a row with the same exact unique key, but it throws an error this time anyone know why?

Code and errors: https://paste.md-5.net/bosepetizo.cs

remote swallow
slender elbow
#

I have it in my bookmarks 😊

worldly ingot
#

You’re the bestest

winter cradle
#

I have you in my bookmarks

slender elbow
#

alongside all the other docs sites that show up in auto complete anyway

worldly ingot
slender elbow
young knoll
#

I prefer the Yatopia docs

umbral ridge
#

I always preferred Coll1234567 docs site

ivory sleet
#

Ah the infamous Coll1234567 spigot fork

umbral ridge
#

Whenever I am coding, I always have it open in my browser

#

It reads my mind whenever I need something browser automatically switches to it

ivory sleet
#

lol

umbral ridge
#

It finds stuff for me without having to do anything

#

It's working without internet

ivory sleet
#

Yep, just keep em running in the background

umbral ridge
#

lollll

proud badge
#

What would be the event for taking out an item from a flower pot?

#

Or putting one in

quiet ice
#

?jd-s my first guess would be interactEvent

undone axleBOT
analog mantle
#

How can I send a player a message using the selection sign for colors? I have a lengthy method that I do not plan on refactoring for a single use

#

does the & symbol work?

glad prawn
#

for wat

tall dragon
quiet ice
#

I recommend \u00A7 instead of the ampersand. But everyone has their own tastes

analog mantle
quiet ice
#

Yeah that is all good and all until some moron uses a different encoding

#

Which is the main (if not only) argument for the ampersand pretty much

#

But you can safely use § in source code for as long as you know what you are doing

shadow night
#

My strings are all usually in translation files so I'll use & please

dawn flower
#

how do i check when any item is added to a player's inventory without looping all players every second or smth (if that's possible)

agile anvil
#

Do you consider checking if item is added through another plugin or /give ? Or is it just getting drops and from inventories?

dawn flower
#

including /give

agile anvil
#

I'm scared you would have to loop among every player's inventories

dawn flower
#

dam

#

alr

blazing ocean
#

?jd-s

undone axleBOT
quiet ice
#

You'd need to intercept all inventory manipulation method which plainly speaking cannot easily be done

agile anvil
#

Or you can maybe hook to the method that is responsible for adding an item to the CraftPlayer inventory (don't do that)

valid burrow
#

you need to listen to multiple events

#

you can check out my ItemLimiter Plugin on GitHub which should have all of them

#

Its called InventoryCap

dawn flower
#

whats the best way to get plugin ideas

blazing ocean
#

come up with them

#

you could ask chatgpt

dawn flower
#

what's the best way to make a "scripting language" like skript (i dont want to make smth like skript)

blazing ocean
#

make an interpeter

#

its quite a complicated topic

dawn flower
blazing ocean
#

well what is your intention

dawn flower
#

i want to make a custom enchants plugin where you can code your own enchants or use premade enchants

inner mulch
blazing ocean
#

use a config language

dawn flower
#

yaml?

inner mulch
#

Yes

blazing ocean
#

im pretty sure yaml has support for objects

#

custom objects*

#

but idk

dawn flower
#

what if they want to for example

#

set the player's health

#

there r MANY cases of what they would want to do

inner mulch
#

You dont needs cusrom objects Take a Look at @icy beacon custom enchsnrs

dawn flower
#

i literally get tens of ideas for plugins but they all require a custom language

inner mulch
#

No

#

You can create a config and read IT to create enchants on runtime

dawn flower
#

well the thing is

#

i have to make the actions

#

from scratch ._.

#

there r like 260 methods in player class or smth

inner mulch
#

Isnt that what a plugin is about? Making Something from scratch

dawn flower
#

well yeah, but 260...

inner mulch
lost matrix
blazing ocean
#

you dont have to implement all 260 player methods

#

just create some wrapper methods for actions you think will be used

dawn flower
#

ok

native ruin
#

Is there a way to attach an event to an item stack or entity without havingto call it in one of your event class?

lost matrix
#

I wouldnt go that deep. Enchantments dont have to be stateful. You need to break them down.
An enchantment has:

  • A trigger
  • A target
  • An action

Example, an enchantment for flaming attacks:

Trigger: ATTACK_PLAYER
Target: ENEMY
Actions:
  - Damage{5.0}
  - Particle{ENEMY, Flames, 1}

Trigger can also tbe block breaks, interactions, etc.
You just need to design rules which targets are available and how to evaluate different parameters.

inner mulch
dawn flower
#

the issue is the trigger and the action

inner mulch
#

Why

dawn flower
#

there r hundreds

lost matrix
native ruin
inner mulch
#

Smile He wants the Thing you showes me before

#

One listener calling events in all the objects of an interface

lost matrix
dawn flower
#

do i just make those

lost matrix
#

I would not

#

Those triggers are mostly mob specific

#

You need to create a list of all triggers you want to have for yourself

dawn flower
#

ok, last thing

#

some triggers can have outputs

#

like player damage

#

and you can set stuff

inner mulch
#

Wdym?

dawn flower
#

like they might want to increase damage

lost matrix
# dawn flower ok, last thing

Btw creating a plugin like that is pretty much a magnum opus.
Only tackle it if you are very experienced.
I know that this would take me weeks and a bit of planing.

inner mulch
#

Action.DAMAGE

lost matrix
dawn flower
#

ok

inner mulch
#

?gui

inner mulch
#

This one here used the concept you are looking for

native ruin
#

Was already questioning if I could wrap entity/itemstack In class with a listener interface

inner mulch
#

No dont do that

#

Dont Register a listener per item

#

You want ONE listener calling all the objects that might want to have this Event rn

#

Thats Delegation

native ruin
#

Yea that's what I meant, like the gui tutorial

inner mulch
#

Yes

native ruin
#

English is hard, I'll try to be more clear next time

inner mulch
#

Okay, is english Not Ur native languafe?

native ruin
#

It isn't

inner mulch
#

Ok

wet breach
icy beacon
#

The plugin you were discussing is just like my underscoreenchants 😄

wet breach
#

or are they enchants that are underwhelming ?

echo basalt
#

custom enchants are fairly easy to impl

wet breach
#

🤔

echo basalt
#

I did it at work in like 20 min

#

all fun and games until you get to the actual logic of like

#

swords can only have XYZ

#

And anvil merging

#

rest is too simple

wet breach
icy beacon
icy beacon
wet breach
#

well answers which it is

#

the opposite of over scored

icy beacon
#

I can send you the link to my discord to see the devlog progress 😄

#

A lot going on

icy beacon
charred blaze
#

hey there

#

hey how do i do .getKeys(true) in bungee api?

cursive loom
#

Hello do you know how I can get a block behind another block ?

              if(((TextComponent) sign.line(2)).content().startsWith("§7Stock")) {
                    
                    Player seller = Bukkit.getPlayer(String.valueOf(((TextComponent) sign.line(3)).content().replace("§b","")));
                    Material material = Material.getMaterial(((TextComponent) sign.line(3)).content());
                    int price = Integer.parseInt(((TextComponent) sign.line(3)).content().replace("§7Prix: §e", ""));
                    int stock = Integer.parseInt(((TextComponent) sign.line(2)).content().replace("§7Stock: §e", ""));

                    if(event.getAction() == Action.LEFT_CLICK_BLOCK ){

                        if(stock > 1){
                            if(KingdomShop.econ.getBalance(player) >= price){

                                sign.line(2, Component.text("§7Stock: §e" + (stock - 1)));
                                sign.update();
                                player.getInventory().addItem(new ItemStack(material, 1));
                                
                                //Here I want to get the barrel behind the sign



I konw I can use blockFace but if i put a barrel on the left of the sign he can get It and I only want the block behind

eternal night
#

grab the block data of the sign

#

its either a Sign or a WallSign or a WallHangingSign

#

or Directional in general

dawn flower
lost matrix
lost matrix
eternal night
#

^ also makes parsing of those values SOOOOO much nicer

dawn flower
#

?

lost matrix
#

He was slow

eternal night
#

wow

lost matrix
#

Its for the msg above

eternal night
#

maybe you are just too fast

lost matrix
#

lynx is a slow boi

eternal night
#

good things take time

lost matrix
#

Sure

charred blaze
faint lynx
#

is it possible to make a custom damage cause? instead of the damage cause being fall for example, is it possible to make it something custom

lilac dagger
#

just store somewhere your own last damage cause

#

and then whatever after can check for it

#

or even better, make your own event

charred blaze
inner mulch
charred blaze
#

of the config

#

all keys

#

so i need deep option

inner mulch
#

okay and what doesnt work

charred blaze
#

when you switch to bungee api and use .getKeys()

#

you cant pass boolean there

inner mulch
#

r u trying to use the bungee api on spigot

charred blaze
#

no

#

im just trying to rewrite from some spigot code to use for my bungee plugin

#

so

#

how do i get deep keys of config in bungee api?

raw epoch
#

Hello i have a probleme using Protocol Lib in 1.20.4, i've this code that takes a player and show all the other players a glowing to him. But when i try i got this weird cast error :/

public static void addGlow(Player viewer) {
    ProtocolManager protocolManager = StealTheCrown.getPlugin().getProtocolManager();
    // Iterate over all online players
    for (Player target : Bukkit.getOnlinePlayers()) {
        // Ensure we do not try to make the viewer glow to themselves
        if (target.equals(viewer)) {
            continue;
        }
        PacketContainer metadataPacket = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
        // Set the packet's entity ID to the current target player
        metadataPacket.getIntegers().write(0, target.getEntityId());
        List<WrappedWatchableObject> watchableObjects = new ArrayList<>();
        WrappedDataWatcher watcher = new WrappedDataWatcher(target); // Create a data watcher for the target player
        WrappedDataWatcher.WrappedDataWatcherObject statusWatcherObject = new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class));
        // Flag 0x40 is for ENTITY_GLOWING, modify as needed
        byte originalByte = 0; // Default value if not set
        if (watcher.getByte(0) != null) {
            originalByte = watcher.getByte(0);
        }
        // Then you proceed with the bitwise OR operation to set the glowing flag
        byte modifiedByte = (byte) (originalByte | 0x40);
        watchableObjects.add(new WrappedWatchableObject(statusWatcherObject, modifiedByte));
        metadataPacket.getWatchableCollectionModifier().write(0, watchableObjects);
        try {
            protocolManager.sendServerPacket(viewer, metadataPacket);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
WastMc lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.ClassCastException: class net.minecraft.network.syncher.DataWatcher$Item cannot be cast to class net.minecraft.network.syncher.DataWatcher$b (net.minecraft.network.syncher.DataWatcher$Item and net.minecraft.network.syncher.DataWatcher$b are in unnamed module of loader java.net.URLClassLoader @4e515669)

If someone can help 🙏

echo basalt
#

.

raw epoch
#

Okay i'will try thx

lime halo
#

hello everyone, i've been having quite a lot of issues with integrating vault economy into my plugin, im very new to coding and minecraft plugin development. Is there anyone that is willing to help me out a bit?

Issue:
my plugin keeps disabling because it is not recognizing vault as a depencancy but i have added it to my plugin.yml as a dependancy, i also added it to my pom.xml.

The error

[16:15:48 INFO]: [Nexussmp] Enabling Nexussmp v1.0
[16:15:48 INFO]: [Nexussmp] NexusSMP has been enabled!
[16:15:48 ERROR]: [Nexussmp] [Nexussmp] - Disabled due to no Vault dependency found!
[16:15:48 INFO]: [Nexussmp] Disabling Nexussmp v1.0
[16:15:48 INFO]: [Nexussmp] NexusSMP has been disabled!

if any file or piece of code is needed let me know please.

icy beacon
#

In default vault code, the "no vault dependency found" means you don't have a backing economy plugin

#

You need some plugin that provides implementation for vault economy, like essentials

lime halo
#

yea im using essentialsX

icy beacon
#

Show your initialization code

#

?paste