#help-development

1 messages · Page 360 of 1

lost matrix
#

unicode has quite a few interesting characters. The minecraft font supports a few. I suspect that those
chars are simply from the unicode table. Does this server use a resource pack?

lost matrix
lost matrix
# small hawk nope

If you can join the server then you could simply take a look at the NBT data of those items btw.

small hawk
pseudo hazel
#

is anyone else having an issue where intellij takes all your RAM at random when you type something and then you need to kill it since its freezin?

#

been happening to me a lot lately

chrome beacon
#

I've heard that it can be caused by the mc dev plugin. If it happens often try disabling or removing it and see if it helps

pseudo hazel
#

hmm

#

okay

chrome beacon
#

I haven't had that happen to me in quite a while so they probably fixed the issue

remote swallow
#

my intellij dies if i ctrl+z something with Material.SOMETHING in

#

its very painful

pseudo hazel
#

oh yeah same

#

and on copy/pastes

#

not all the time though

#

but often enough to annoy me

crimson relic
#

yes same

#

mine crashes very often on copy paste

remote swallow
#

that happens sometimes

crimson relic
#

pisses me off so much

pseudo hazel
#

okay well atleast I am not alone in this then haha

tawny remnant
#

can anyone help me with my code please?

remote swallow
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

lost matrix
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

remote swallow
lost matrix
tawny remnant
#

i need to somehow delay a task in my class but i dont know how. i tried Thread.sleep() but that lagged the server or smt

crimson relic
#

yeah dont use thread.sleep

lost matrix
#

?scheduling

undone axleBOT
lost matrix
#

thread.sleep simply stops the server thread

lost matrix
tawny remnant
remote swallow
#

put it in a scheduler

lost matrix
# tawny remnant https://justpaste.it/30l54
  public void doSomething(JavaPlugin yourPlugin, Player player) {
    // Send the first message right now
    player.sendMessage("> First message.");

    // Schedule the 3rd message to be sent after 5 ticks (approx 100ms)
    Bukkit.getScheduler().runTaskLater(yourPlugin, () -> {
      player.sendMessage("> Third message.");
    }, 5);

    // Send the second message right now
    player.sendMessage("> Second message.");
  }
remote swallow
#
Bukkit.getScheduler().runTaskLater(pluinInstance, () -> {
    player.getInventory().remove(customItems.activeDecapitator());
    player.getInventory().addItem(customItems.entityDecapitator());
}, 20 * seconds);
`
tawny remnant
remote swallow
#

runTaskLater

#

it runs that code later

lost matrix
#

However you will have a lot of problems with your design.
What happens if a player drops items? Or he dies? Or he enchants the items?

tawny remnant
#

i get that

remote swallow
#

it will only ever run when you call the method its in

lost matrix
#

For now just look at the examples above 👍

tawny remnant
#

the pluginInstance is red

remote swallow
#

you need to supply a plugin instance

tawny remnant
#

oh right ** i dont understand **

remote swallow
#

?di if its in another class, use this if its in your main class

undone axleBOT
tawny remnant
#

what

crimson relic
#

...

remote swallow
#

im gonna say

#

?learnjava

undone axleBOT
tawny remnant
remote swallow
#

read the link the bot sent

mighty pier
#

best way to store large amount of data?

crimson relic
#

database

remote swallow
#

mysql probably

tawny remnant
#

hard drive

mighty pier
#

yes but which one

crimson relic
#

whichever you prefer i guess

mighty pier
#

i want offline storing

remote swallow
#

if you want to suport the db being elsewhere, mysql, if not use sqlite

mighty pier
#

what's the best way to use sqlite

remote swallow
#

imo using hikari cp but other people will say just to use base java stuff

mighty pier
#

ok im gonna try hikari cp

tawny remnant
#

bro i cant read

#

what am i supposed to do

#

how do i impliment the pluginInstance

remote swallow
#

?di

undone axleBOT
remote swallow
#

gotta read or you wont do well making plugins

smoky oak
#

Does anyone know how bukkit/spigot loads plugins? DI?

remote swallow
#

PluginClassLoader iirc

rough drift
#

1 tick = 50ms

remote swallow
#

5 ticks = 1/4 of a second

#

so yeah

rough drift
#

yes

quaint mantle
#

is there a way to send a border around a specific region like a spawn ?

rough drift
#

Spawn protection?

quaint mantle
#

Ik how to do it with blocks but I would prefer to use a actual border

rough drift
#

world border?

quaint mantle
#

yea

#

for a specific player

#

in multiple places

rough drift
#

packets

remote swallow
#

that is per world not per player iirc

lost matrix
rough drift
#

^

remote swallow
#

in base stuff

eternal oxide
#

borders are per player now as well

quaint mantle
#

How

smoky oak
#

fuck am i looking at lol

Class<?> jarClass;
try {
  jarClass = Class.forName(description.getMain(), true, this);
} 
Class<? extends JavaPlugin> pluginClass;
try {
  pluginClass = jarClass.asSubclass(JavaPlugin.class);
} 
plugin = pluginClass.newInstance();
rough drift
#

they are?

remote swallow
#

jnak probably

lost matrix
quaint mantle
smoky oak
#

does JavaPlugin have an abstract newInstance() method or am i going insane and is that part of object?

remote swallow
quaint mantle
#

ah

quaint mantle
rough drift
quaint mantle
#

mm

quaint mantle
#

can u do that in multiple places?

eternal oxide
#

no

livid dove
#

It ramps up all the way to 50-70 then drops

#

its 24gb

eternal oxide
#

world or each player

remote swallow
livid dove
mighty pier
#

37129 players online 0_0

livid dove
#

it goes back to normal and doesnt record

#

whats casing it

mighty pier
remote swallow
#

normally with hikari you create the db where you want to save it

#

so it doesnt care if its online or not

mighty pier
#

oh right

#

i rememeber

#

tgabnkjs=

remote swallow
#

not kikari, sqlite

lost matrix
mighty pier
#

ram

#

dedicated wam

lost matrix
#

deditated wham

remote swallow
#

% ram usage im guessing

lost matrix
#

Of what?

quaint mantle
#

how do I send imasges here

remote swallow
#

total ig

lost matrix
#

The system? The process? The jvm?

remote swallow
mighty pier
remote swallow
#

verify or

#

?img

undone axleBOT
lost matrix
mighty pier
#

how do i think of plugin idea

quaint mantle
#

how do these guys do it?

#

There is multiple zones

mighty pier
#

matrix

quaint mantle
#

??

smoky oak
#

so im trying to find the PluginClassLoader to check in my IDE and apparantly it doesnt exist where the stash says its located

remote swallow
smoky oak
#

whats the correct path for this one

quaint mantle
mighty pier
#

nms

remote swallow
smoky oak
#

ah that'd do it

quiet ice
#

Beware that it may be non-public

smoky oak
#

ah

#

ye class aint public

#

im trying to look at the decompiled code in my ide

#

any idea how

quiet ice
#

Use recaf

livid dove
formal vector
#

raziel :susge

livid dove
#

Oh god Crazy here to chastise 😉

formal vector
#

wtf

livid dove
formal vector
#

I have no susge

smoky oak
remote swallow
crimson relic
quiet ice
#

It should be the first search result anyways

#

Especially on bing

livid dove
# formal vector I have no susge

memes aside any ideas? Ive been wracking my brain about this all day. Playing catch up with some of the legacy descisions from old dev team lol

remote swallow
#

you ran spark or timings yet?

lost matrix
formal vector
#

sounds like multicraft wonky. but I have no idea of it

livid dove
formal vector
#

whats your jvm args

lost matrix
#

Im guessing that the gc kicks in and collects all the garbage

formal vector
#

and what are your old gen gc's looking like

smoky oak
#

@geol heres what im trying to find: the newInstance() method used in this code snippet

 Class<? extends JavaPlugin> pluginClass;
            try {
                pluginClass = jarClass.asSubclass(JavaPlugin.class);
            } catch (ClassCastException ex) {
                throw new InvalidPluginException("main class `" + description.getMain() + "' does not extend JavaPlugin", ex);
            }
            plugin = pluginClass.newInstance();

Reaosn i wanted to open the decompiled bytecode was so i could hit f4 on the newInstance method but since class aint public

lost matrix
quiet ice
#

Invokes the constructor of the java plugin class.

#

Nothing too out-of-the-ordinary

smoky oak
#

ah i see kthx

tawny remnant
#

can you please help me

lost matrix
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

tawny remnant
#

i still dont know why my pluginInstance is red

lost matrix
#

?learnjaba

lost matrix
#

?learnjava

undone axleBOT
formal vector
#

learnjaba

lost matrix
#

That too. Both are relevant.

formal vector
#

:prayge

#

fuck

lost matrix
#

F

formal vector
#

does verification give external emotes

tawny remnant
#

cant you just help me

crimson relic
#

no

formal vector
#

sad

tawny remnant
#

the channel is called help

#

i need help

lost matrix
#

Nope. You need the decadence status aka server booster

remote swallow
formal vector
#

can you send a screenshot of the code

remote swallow
#

we arent just gonna give you all the code

#

you have to read as well

formal vector
#

and yes, knowing java is surprisingly helpful in plugin development

#

....unless you use kotlin

#

but yk.

formal vector
formal vector
#

pluinInstance?

crimson relic
formal vector
#

ah

crimson relic
#

without changing it or understanding it at all

formal vector
#

fair enough

lost matrix
# tawny remnant i need help

Here is the help (given you know the very basics of Java):

You need to get an instance of your JavaPlugin class to your other instances.
In Spigot you commonly refer to this instance in your onEnable method as this.
Then you either store it in a static variable which has a getter or you pass it in the
constructor of your other classes (also called dependency injection or di)

tawny remnant
#

yall didnt explain it in the first place

remote swallow
#

we did

livid dove
crimson relic
formal vector
remote swallow
livid dove
tawny remnant
remote swallow
#

if you dont understand it, you need to go learn java

formal vector
formal vector
lost matrix
formal vector
#

ok, now as for why I'm actually here

livid dove
formal vector
#

D:

tawny remnant
#

bro i started today im happy with my work

remote swallow
formal vector
#

so LivingEntity.addPotionEffect() (I always write PotationEffect jesus)
is it supposed to add the potion effect alongside existing ones or is it supposed to overwrite an existing effect of the same type

#

(in newer versions)

#

or if it is supposed to overwrite, is there any way to make it behave as potion effects do in game (assuming I'm not being bald and different levels of the same effect do coexist and replace one another once one runs out)

tawny remnant
#

ok i got it to work thanks

#

i have 1 problem tho and that i can figure out

#

when i apply ItemMeta then no enchants apply

formal vector
kind hatch
formal vector
#

alright

#

I guess I'll make a small test thing, to see how it actually behaves in a void

#

pepecringe

warm igloo
#

Adding an attribute with NMS

proven dune
#

any java dev?

crimson relic
#

no

formal vector
quiet ice
proven dune
#

ok Im in that server for like 3m and Im already tired of the people bh

#

see ya

crimson relic
#

lol

#

begs for free work, gets disappointed, leaves

quaint mantle
#

Anyone know what 1.8 packets for world border ?

#

to send per player

undone axleBOT
quaint mantle
#

stfu

fervent gate
#
public ShapedRecipe getRecipe() {
        NamespacedKey key = new NamespacedKey(this.plugin, "Refined_Dagger");
        ShapedRecipe recipe = new ShapedRecipe(key, getItem());
        recipe.shape("MMM", "MSM", "MMM");
        ItemStack metalShard = new MetalShard().getItem();
        metalShard.setAmount(16);
        recipe.setIngredient('M', new RecipeChoice.ExactChoice(metalShard));
        recipe.setIngredient('S', new RecipeChoice.ExactChoice(new SmallDagger(this.plugin).getItem()));
        return recipe;
    }

The amount isn't working. I only need 1 item to craft the item. Any ideas?

lost matrix
sick ermine
#

hi guys i am going to start a quest system project. I started making an uml diagram for this. But I couldn't decide anything about the class architecture

lost matrix
#

gotta click that mouse button real fast

quaint mantle
#

tf

crimson relic
#

just as bad

sick ermine
#

Which method do you think I should use for Action requirements? Abstract class or Interface

lost matrix
quaint mantle
#

PacketPlayOutWorldBorder?

lost matrix
lost matrix
#

It really depends on how you check for requirement fulfillment

sick ermine
#

Why do I need the Money Changed and Item Change classes?

ivory sleet
#

oh

#

wrong reply

sick ermine
#

Which

lost matrix
#

This way you can standardise the ActionRequirement and use them for both money and item triggers.
Then you would need to differentiate between state and progression.
Example:

Requirement: Own 1000 Gold
-> Trigger OnMoneyChanged - Check total money (state check)

Requirement: Earn 1000 Gold
-> Trigger OnMoneyChanged - Check gained money (progression check)

Same goes for Items.

ivory sleet
#

Scropy Id say interface

#

cause then you avoid implementation inheritance in this case

lost matrix
#

Agree. The state is pretty irrelevant as shown above.
But if you add more functionality and statefullnes to the ActionRequirement then go with the abstract class

#

Or if you are fancy:
Throw out your abstraction and go for composition

#

But the concept looks suitable for abstraction

sick ermine
#

Do you prefer to divide it into State Requirement and Action Requirement?

lost matrix
#

Well the state requirement would be pretty trivial

public interface StateRequirement extends Predicate<Player> {}

The Problem is when to trigger a check.

sick ermine
#

Yes, how can I solve this problem? I don't want to do it by clicking on the task menu

#

with the method you mentioned above?

lost matrix
#

I mean its fine to only check the state when the user looks at the task
and when the user wants to finish the task. But if task fulfilment is automatic
then you need triggers

sick ermine
#

I want the task to be fully automatic so should I still use the Action class Interface

lost matrix
#

Fk im trying to write an example but this is close to a full blown task system...

grand flint
#

Where can I store a timer to re-generate a structure loot without lagging out the server, for example if there is 200 chests with timers waiting to be re-generated

sick ermine
lost matrix
grand flint
#

But I don't want the player to just keep re-opening the chest and getting more loot

#

I want the loot to be re-filled every 2 days for example

lost matrix
#

Thats what the timestamp is for

tall dragon
#

thats why u check if X amount of time has passed

grand flint
#

Ohhh, yes I got it :)

#

What even can I check the chest opening with?

lost matrix
sick ermine
#

Is it ok to create Earn Money Requirement class and implement it in Action interface?

lost matrix
#

fk it im starting a new project. This whole task thing brought me a new idea XDD

sick ermine
#

what is the idea in your mind 😁

grand flint
#

One more question, how can I protect randomly generated structures from being broken by players?

#

I was planning on using worldguard and creating a region for each structure, is this bad?

lost matrix
#

This one is a bit tricky. In 1.13 i did something like that and finding the constraints of the structures was one hustle through nms...
Maybe spigot has an api for that now but if not you need a bit of work for that

grand flint
#

Like the first time I create the world, as the structures spawn, it will create a region for each

lost matrix
#

But finding the border for the structures might be a problem

grand flint
#

But they are like the minecraft structures, so don't they automatically have one

#

Using the structure block

#

Ah one more thing, how do I check if a chest is a structure chest and not just a normal chest?

lost matrix
#

They have custom nbt data iirc

grand flint
#

Won't it lag, to check too many chests opening

lost matrix
#

Very probably not

grand flint
#

Let's say estimated 500-700 players in the server, would it lag to check everytime a chest opens

lost matrix
grand flint
#

Okay thank you

lost matrix
grand flint
#

I'm just tryign to make it as optimised as possible

#

I have a huge server budget as well

sick ermine
#

@lost matrix In a moment, can you wrap up everything we talked about? I'm really confused

grand flint
#

I don't want a big server to go to waste because of unoptimized plugins and datapacks

#

Yes?

#

Is there a problem??

lost matrix
grand flint
#

Why?

lost matrix
#

Depending on that i can give a summary

sick ermine
grand flint
#

But why would I do that when datapacks does it easier?

lost matrix
grand flint
#

My datapacks are very optimised

#

So you rather a server with over 100 players was unoptimised?

#

Why do you think datapacks are unoptimised 🤔

#

It's just generating dimensions, biomes, structures

pseudo hazel
#

I want to add a dependency to my plugin but it just gives me a classdefnotfound exception anytime I wanna use something from it

grand flint
#

It's a one time thing

pseudo hazel
#

I think I missed a step but idk what

grand flint
#

It does manage some custom achivements, items and other stuff

pseudo hazel
#

yes

#

im using maven btw

#

you mean intellij?

#

sure I can try

#

didnt work

lost matrix
# sick ermine Always just one

Ok so lets start with the simple stuff.

public record Task<E extends Event>(TaskRequirement<E> requirement, TaskReward reward) {}

Task always have two components:

  • A requirement
  • A reward

Tasks also only correspond to one type of event.

#

The reward can be very abstract: Its just an action applied to a Player. So we can define it as

public interface TaskReward extends Consumer<Player> {}
#

A concrete implementation could look like this:

  @AllArgsConstructor
  public class MoneyReward implements TaskReward {

    private final double amount;
    
    @Override
    public void accept(Player player) {
      MoneyManager.giveMoney(player, amount);
    }
  }
#

@sick ermine Makes sense so far? Or do you need clarification?

remote swallow
#

wooooo, lombok user

#

i think

#

is all args lombok or is it just requiredArgs

lost matrix
#

has both

#

I wrote the stuff so im just gonna keep rumbling... maybe he reads it later

remote swallow
#

lul

sick ermine
#

Is there a possibility that there is a task with a State requirement?

lost matrix
#

I will get to requirements if you understood the TaskReward. Its quite crucial that you
understand what interface TaskReward extends Consumer<Player> means.

#

TaskRequirements are checked every time their typed event is fired. Doesnt matter if it checks
the state or the progression of a requirement

public interface TaskRequirement<E extends Event> extends Predicate<Player>, Consumer<E> {

  Class<E> getTriggerClass();

}
#

We store the task in a central manager called TaskManager

public class TaskManager {

  private final Map<UUID, TaskContainer> playerTaskMap = new HashMap<>();

  public <E extends Event> void addTask(UUID playerID, Task<E> task) {
    playerTaskMap.computeIfAbsent(playerID, (key) -> new TaskContainer()).addTask(task);
  }

  public <E extends Event> void triggerEventFor(Player player, E event) {
    playerTaskMap.computeIfAbsent(player.getUniqueId(), (key) -> new TaskContainer()).applyToTasks(player, event);
  }

  public <E extends PlayerEvent> void triggerEvent(E event) {
    triggerEventFor(event.getPlayer(), event);
  }

}

Here we can add a TaskContainer for each Player.
computeIfAbsent simply gets something from a map if it exists in there or creates a new object with the passed lambda.

#

Our Listener is therefor very simple. We just need to add all events we want to expose for triggering progression and propagate them
to the manager

@AllArgsConstructor
public class TaskListener implements Listener {

  private final TaskManager taskManager;

  @EventHandler
  public void onBreak(BlockBreakEvent event) {
    taskManager.triggerEventFor(event.getPlayer(), event);
  }
  
  // Add as many as you want for triggering
}

If you wanted to check the state of something every second then you simply create a SecondTickEvent and schedule it every 20 ticks.

#

Now to the complicated stuff. How do we achieve good performance with many tasks? We should not iterate through
all tasks a player has and check for their trigger class. We simply use a Map<Class, List<Task>> where each Task with
a trigger class is grouped inside a List

public class TaskContainer {

  private final Map<Class<?>, List<Task<?>>> taskMap = new HashMap<>();

  public <E extends Event> void addTask(Task<E> task) {
    List<Task<?>> taskList = taskMap.computeIfAbsent(task.requirement().getTriggerClass(), (k) -> new ArrayList<>());
    taskList.add(task);
  }

  public <E extends Event> void removeTask(Task<E> task) {
    List<Task<?>> taskList = taskMap.computeIfAbsent(task.requirement().getTriggerClass(), (k) -> new ArrayList<>());
    taskList.remove(task);
  }

  @SuppressWarnings("unchecked")
  public <E extends Event> void applyToTasks(Player owner, E event) {
    List<Task<?>> taskList = taskMap.computeIfAbsent(event.getClass(), (k) -> new ArrayList<>());
    List<Task<?>> copyList = List.copyOf(taskList);
    for(Task<?> task : copyList) {
      TaskRequirement<E> requirement =  ((Task<E>) task).requirement();
      requirement.accept(event);
      if(requirement.test(owner)) {
        task.reward().accept(owner);
        removeTask(task);
      }
    }
  }

}
trail lintel
#

Guys, how long does the update url take to... update lol. It's been nearly an hour since I uploaded a new jar but the update string hasn't been updated =[

lost matrix
#

Yeah and thats basically a decent Task system which supports pretty much everything you could think of.

sick ermine
#

Isn't the code really complicated

#

🙂

lost matrix
#

Well... Yes this code is not beginner friendly at all. But it is very modular 😄

trail lintel
#

OH SHIT you know what, I think I forgot to update the version string in the plugin yaml haha

#

I updated the string on the spigot website

trail lintel
#

but not in the yaml

lost matrix
echo basalt
#

that's what I've been doing for the past like 6 years and it has been working

sick ermine
lost matrix
remote swallow
echo basalt
#

or just be like me and keep it at 1.0 forever

trail lintel
#

Oh snap, could you elaborate on that a bit? I would love to have a single place to update version number

remote swallow
#

maven or gradle

trail lintel
#

I do have maven and am using a variable for version numbers there, but it doesn't apply to the plugin.yml

remote swallow
#

in pom you got something that has src/main/resources?

trail lintel
#

I do indeed =]

remote swallow
#

make sure thats enabled, then in plugin.yml change the version to '${project.version}' then it should inherit whatever version you set the version to

#

should be the version tag in pom

trail lintel
#

woah no kidding, it automatically does that? I had no idea 😮

remote swallow
#

resource filtering does it

#

no idea how it works

trail lintel
#

I'm down with a little black magic =]

remote swallow
trail lintel
#

Hmm I must be losing my mind though, the update url is still not showing the correct version =[

remote swallow
#

drop the link

remote swallow
#

returns 1.3.1 for me

trail lintel
#

it does??! What in the world haha

remote swallow
#

spigot says 1.3.1 too

trail lintel
#

maybe im cached

#

lemme try in incognito

remote swallow
#

clear cookies

trail lintel
#

still showing 1.2.0 for me haha, what in the world

#

lemme try in another browser

remote swallow
#

jank

trail lintel
#

firefox also shows 1.2.0 and I have never once booted this guy up haha

#

What in the world is going on

remote swallow
#

might be ip results caching

trail lintel
#

ohh like on the router level?

remote swallow
#

no idea how that would work

trail lintel
#

well, as long as it works for other people haha

grand flint
#

How could I make this?

grand flint
#

Nevermind did it 😂

remote swallow
#

that might help

grand flint
#

Thank you though, I just needed a regional_compliancies.json file

remote swallow
#

ah

grand flint
#

It's easier with a resource pack, you can just add a language text, and add another file to pop it up

trail lintel
#

Bro you have to have been trolling me lolol, even on my mobile connection so no caching its still returning 1.2.0

#

I see 1.3.1 on the actual spigot site, but the update url just returns 1.2.0

buoyant viper
#

try adding a ? to the end of the url idk

trail lintel
#

like at the end? I shall try it

#

yo

#

nani the actual fuck

#

that fixed it

buoyant viper
#

we hope

trail lintel
#

well, I guess I gotta do ANOTHER version bump now with the proper URL hahaha

#

thanks winn 😉 not sure why that ? actually fixes it but it does

buoyant viper
#

adding a query to the url typically causes the cache to be invalidated pretty sure

#

its a not-so-hacky-but-kinda-hacky workaround i do in some projects

smoky herald
#

Hey, i was wondering if it is also allowed to ask a mysql / pool size related question here 😛 can't seem to find any discord that is focused on this part

trail lintel
#

this must be some php stuff I am too dumb to know about haha

#

php is one area I have never messed with in the slightest

buoyant viper
#

dont even need php to use url queries :p

#

can do it clientside (in browser) with like document.location.query or document.location.search , one of the two exist iirc

trail lintel
#

oh yeah I am aware of url queries, I just figured this particular case had to be related to php

#

but I am talkin nonsense of course haha

trail lintel
#

finally got resource filtering working lol, I was just missing a stupid tag >< my brain is fried from hours of doing backwards compatibility stuff lol I'm making stupid mistakes

twilit wharf
#

I am tracking when a player equips armor, and if I pick up and place the item slowly, it registers as an event and I can track it, but if I do it as quick as I can it doesnt register and it doesnt trigger the event, yet the player is wearing the armor. Is there something I can do to fix this?

eternal oxide
#

listen to the drag event too

hazy warren
#

why does block setType with applyPhysics set to false still cause block updates 💀

eternal oxide
#

it doesn't

hazy warren
#

it's making concrete powder fall

eternal oxide
#

show your code as no physics = no neighboring block changes

#

?paste

undone axleBOT
hazy warren
#

You right you right the plugin jar just wasn't updating properly i guess

wheat flint
#

can someone help me figure out what im doing wrong?
im trying to register event but this happens to me

'PlayerFirstJoin(org.bukkit.event.player.PlayerJoinEvent)' in 'bettermobs.iawelcomemenuaddon.Events.OnPlayerJoinServer' cannot be applied to '()'
getServer().getPluginManager().registerEvent(new OnPlayerJoinServer(this).PlayerFirstJoin(),this);
public class OnPlayerJoinServer implements Listener {
    Plugin plugin;
    public OnPlayerJoinServer(Plugin plugin){
        this.plugin = plugin;
    }
    @EventHandler
    public boolean PlayerFirstJoin(PlayerJoinEvent event){
        if (new GetPluginInfo(plugin).isPluginEnabled()){
            return false;
        }
        if (!new IfFirstPlayed(event.getPlayer(), plugin).Check()){
            return false;
        }
        event.getPlayer().openInventory(new WelcomeInventory(plugin).getInventory());

        return true;
    }
}
vague oracle
#

Should probably learn java first

#

to fix the issue you need an instance of the class not a boolean

getServer().getPluginManager().registerEvent(new OnPlayerJoinServer(this) ,this);
sturdy heron
#

how would you find the milliseconds since the last tick within the main thread?

wheat flint
#
getServer().getPluginManager().registerEvents(new MenuClick(this), this);
#

notice s in events

vague oracle
#

You literally just showed me completely different code

wheat flint
#

it doesnt matter

#

this is just function name

vague oracle
#

ok lol

lost matrix
bold vessel
#

Nvm i just find the error

#
[02:46:58] [Server thread/WARN]: [PlaceholderAPI] factions_member_1 is attempting to register placeholders via deprecated PlaceholderHook class. This class is no longer supported and will be removed in v2.13.0!
[02:46:58] [Server thread/WARN]: [PlaceholderAPI] factions_member_2 is attempting to register placeholders via deprecated PlaceholderHook class. This class is no longer supported and will be removed in v2.13.0!
[02:46:58] [Server thread/WARN]: [PlaceholderAPI] factions_member_3 is attempting to register placeholders via deprecated PlaceholderHook class. This class is no longer supported and will be removed in v2.13.0!
[02:46:58] [Server thread/WARN]: [PlaceholderAPI] factions_member_4 is attempting to register placeholders via deprecated PlaceholderHook class. This class is no longer supported and will be removed in v2.13.0!
[02:46:58] [Server thread/WARN]: [PlaceholderAPI] factions_member_5 is attempting to register placeholders via deprecated PlaceholderHook class. This class is no longer supported and will be removed in v2.13.0!```
#

som1 know how i can fix this ?

lost matrix
#

Dont use the outdated PlaceholderHook?

bold vessel
#

What is the new one ?

lost matrix
bold vessel
#

okk

#

thx

#

Not working, its detected but the placeholder doesnt work notlikethis

#

Som1 know how i can made it work ?

#

I want to display 5 member of the player faction (in different placeholder)

livid dove
#

Erm can anyone think of any settings that could stop a plugin's titles ? All our plugin's titles are no longer working

river oracle
#

maybe another plugin 🤷🏽‍♂️

#

binary search (remove half the plugins if the issue persists remove half of the plugins left and so on until you find the problem plugin) to find the issue! WOOO!

#

have fun

livid dove
#

nope

livid dove
#

all the same configs

#

and plugins

#

no issue

river oracle
#

clearly not or the issue would have persisted

#

something changed between your test world and production

#

if you zipped the productino server up and copied it to a test server and had no issues that'd just be wack asf

#

but if you just copied plugins and configs etc there still could be differences

river oracle
bold vessel
#

already post ahah

livid dove
#

And the problem persists across all worlds in the main server

river oracle
livid dove
#

But thats my point

#

I dont think honestly its the plugins

river oracle
#

could be 🤷🏽‍♂️ no point in ruling it out before you test it

livid dove
#

true ture

river oracle
#

some weird shit can happen man

round finch
regal scaffold
#

If I have a command that's
/command <add> <message>

How can I make message ( Which is args[1] ) be a group of everything that goes after. Like what if message is This is a message

#

Is array methods good enough?

#
        for (int i = 1; i < args.length; i++) {
            message += args[i] + " ";
        }
#

Technically, right?

quaint mantle
#

hi

#

i have a sql database where i wanna store an item, but how should i store the item?

#

should i like serialize the name of the item and store that?

#

or is there like a unique int value or index or something like that i can store and use to retrieve the item whenever i want?

#

by item, i mean just the Material class for the item.

regal scaffold
#

Best thing is to store the string for the materla name and then make the material back using Material#getMaterial(String) @quaint mantle

quaint mantle
regal scaffold
quaint mantle
#

or maybe there could be a way to get the raw message somehow not sure.

regal scaffold
#

Nah dw about it

quaint mantle
#

ok

regal scaffold
#

Did you see my message to you?

quaint mantle
#

could listen for just raw messages from players.

#

yeah, i saw it.

regal scaffold
#

You could also convert the item into a json string. serialize it. store that string and then deserialize

#

But you can't store any datatype you want in a sql database.

quaint mantle
#

yeah but i am also querying the material pretty often

#

seems kind of a waste of space to store all those names like that.

#

hm.

#

maybe i could compute a hash or something to make it an int and be more space efficient as well.

regal scaffold
#

I mean could just store the stuff in a list and then update that every so often

regal scaffold
quaint mantle
#

also, is there a way to get all the material constants in an array list or something?

regal scaffold
#

Yes

#

There's an enum

quaint mantle
regal scaffold
#

Material#values()

quaint mantle
#

ah okay. Appreciate the help!

regal scaffold
#

Consider using PDC if you're doing a lot of stuff tho

quaint mantle
#

PDC?

regal scaffold
#

PersistentDataContainer

#

?pdc

quaint mantle
#

the spigot persistant api?

#

doesn't it store data in region files or something?

regal scaffold
#

Depends

#

There's chunk pdc, item pdc, player pdc, chest pdc

#

But it's really good

#

And you can store entire objects if you want

quaint mantle
#

i kind of wanna have it in a separate file of sorts that could be more convinient to work with.

regal scaffold
#

If you need them editable then yes

quaint mantle
#

makes it easier to move data across different servers and world folders even i guess.

#

plus, i am using sqlite, switching to a mysql database should probably not be too difficult.

#

plus i should be able to use the data over multiple servers, accessing it from one database server.

#

not sure if spigot persistent api can do that.

#

efficiently at least.

hybrid spoke
#

sounds like you want to use a database

quaint mantle
#

also, i am also storing chunks in my database for something, how would i go about storing the dimension the chunk is in?

#

like the nether or the end?

hybrid spoke
#

make a new column

quaint mantle
#

i know

#

how do i go about serializing the world the chunk is in to some kind of unique value of sorts?

#

is there a unique int value or index for the dimension the chunk is in?

#

to store the chunk's dimension in the database?

quaint mantle
#

is it unique for each dimension in each world folder?

hybrid spoke
#

otherwise store it yourself like that

#

or just store NETHER, END, OVERWORLD

quaint mantle
#

hm.

hybrid spoke
#

you are thinking way too far. just store it as it is

timid jetty
#

Does anyone have a good resource for setting up storing player data in a yml. I understand how to create the file and everything but I'm having trouble figuring out how to set up configurations, saving and reading information to pass to a class

chrome beacon
#

?configs

undone axleBOT
frank kettle
#

Oh wow, I do it in a different way

#

That's good to know

errant spade
#

👋

#

I'm currently making a tool as part of my Gradle plugin suite to automatically set up a test server. Right now I have it run BuildTools as normal (java -jar C:\path\to\BuildTools.jar --rev 1.xx.x) and it seems to work fine until it reaches this stage Applying patches to Spigot-Server...

It seems to freeze up/hang on ```
[BuildTools] Falling back to patching base and 3-way merge...
[BuildTools] Something did not apply cleanly to Spigot-Server.
[BuildTools] Please review above details and finish the apply then
[BuildTools] save the changes with rebuildPatches.sh

#

I can't tell if it's just taking a while or if it's actually stuck. It's been going for 28 minutes now...

late palm
#

i need help i am trying to make a plugin minecraft server using the server file

#

and i cant get it to work

round finch
#

Count from 1 instead of 0

#

@regal scaffold

regal scaffold
#

Fair, works the same tho

pseudo hazel
#

that code already counts from 1 no?

#

anyways is it still broken?

#

looks like it should work

round finch
#

Arg0 would be message

pseudo hazel
#

no

#

add would be arg 0

regal scaffold
#

yes

#

Steaf is right

pseudo hazel
#

and whatevers after needs to all be message

#

so thats from 1 to args.length

round finch
#

Wait lemme scroll

#

That is add

#

Array index 0 is the first

pseudo hazel
#

yes

#

which is why the loop starts i at 1 not 0

round finch
#

Yeah exactly

#

👍

pseudo hazel
#

you are more likely to get help when you are in the right chat

loud grove
#

Hi guys, I need some help with a plugin, I am making a plugin to ban players if they die 10 times, would I do this with event listeners or in a different way.

round finch
#

Save the amount of deaths into a config

glossy venture
#

listen to death event, increment the death count of the player and then add them to the ban list if needed

round finch
#

Listener for deaths

glossy venture
#

and yeah persistently store them in a yml file or something should be sufficient

loud grove
#

ok thanks soo much

round finch
#

There is setBan

#

Or something like that

glossy venture
#

you can get the ban list

#

like Bukkit.getBanList() or smth

round finch
#

I have been thinking about how i could optimize my cube block filler plugin
It sets 1 block every 10s

#

Maybe more tasks?

glossy venture
#

wtf

#

one block per 10 seconds?

west bone
#

do anyone know how can i spawn falling block with nms on 1.19.3

#
  public class PacketFallingBlock {

    private FallingBlockEntity fallingBlock;
    @Getter private Location loc;
    @Getter private Material material;

    public PacketFallingBlock(Location loc, Material material){
        Level world = ((CraftWorld) loc.getWorld()).getHandle();
        this.loc = loc;
        this.material = material;

        fallingBlock = FallingBlockEntity.fall(world, new BlockPos(loc.getX(), loc.getY(), loc.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState());
    }

    public void setVelocity(Vector velocity, Player player){
        fallingBlock.setDeltaMovement(velocity.getX(), velocity.getY(), velocity.getZ());
        ClientboundSetEntityMotionPacket packet = new ClientboundSetEntityMotionPacket(fallingBlock.getId(), fallingBlock.getDeltaMovement());
        PacketUtils.sendPacket(player, packet);
    }

    public void show(Player p) {
        Bukkit.broadcastMessage("asdawdaw");
        ClientboundAddEntityPacket addPacket = new ClientboundAddEntityPacket(fallingBlock);
        ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(fallingBlock.getId(), fallingBlock.getEntityData().getNonDefaultValues());
        PacketUtils.sendPacket(p, addPacket);
        PacketUtils.sendPacket(p, dataPacket);
    }
    

    public void hide(Player p){
        ClientboundRemoveEntitiesPacket packet = new ClientboundRemoveEntitiesPacket(fallingBlock.getId());
        PacketUtils.sendPacket(p, packet);
    }

}
#

this doesnt work

rotund ravine
#

Why do you need nms

#

Spigot can do all this

west bone
#

i just want to make it packet based

wet breach
#

I mean the api is packet based too

#

but what exactly about it doesn't work?

west bone
#

it doesnt spawn

#

i think something is wrong with blockstate idk

west bone
wet breach
#

do falling blocks have a state? Thought they were treated more like entities 🤔

glossy venture
#

falling blocks are entities

west bone
#

no idea but it requires blockstate

glossy venture
#

but display a block state

west bone
#

ye

wet breach
#

it doesn't need to contain any metadata but try sending it anyways, generally works for spawning entities

fair breach
#

Hey, I just want to add upgrades to my minigame.
I'm currently storing the upgrades as a string list in my team class with a getUpgrades() and addUpgrades() method and so on.

But I think there is something that works better than using strings e.g. with enums so I can use Upgrade.NAME . And then I would use a list of these enums.
Would this be the right way to do it or does anyone have a better idea to implement this?

west bone
wet breach
#

why does your upgrades have to have names?

wet breach
west bone
#

ye

wet breach
#

problem might exist there as I don't really see anything wrong with what you posted

west bone
#

but that works for my nms armorstand

#
  public class PacketUtils {

    public static void sendPacket(Player p, Packet packet){
        new BukkitRunnable(){
            @Override
            public void run() {
                ((CraftPlayer) p).getHandle().connection.send(packet);
            }
        }.runTask(CustomEnchants.getInstance());
    }
}```
fair breach
wet breach
wet breach
west bone
#

its just a function, thats not the reason i believe

wet breach
#

never know at this point

west bone
#

uhm something weird happened

hybrid spoke
#

shouldnt be

#

just debug into your code

west bone
#

rn it just spawned falling item but it was nms

#

how did that spawn an item for fallingblocks

wet breach
#

so there is a caveat with static

#

that you probably are not aware about

west bone
#

but still i cant see the falling block

wet breach
#

if the value of the static changes, it changes the value for all objects of that static

west bone
#

it just spawned dropped item

#

is there a different packet for falling blocks?

wet breach
#

in your case that caveat is kind of bad since you have multiple packets and don't really want all your static objects to just magically change to the same thing 😛

fair breach
hybrid spoke
hybrid spoke
west bone
#

is there a wiki for nms 🤔

wet breach
#

not really

#

which contains pretty much all the packets that exist

hybrid spoke
#

yep

#

otherwise look up how bukkit impls the spawnFallingBlock method

quaint mantle
#

hi

#

i accidentally messed up some stuff and ended up deleting all the files in trying to get back to a previous git commit.

#

how do i go back to a git commit i previously made and have it replace everything i currently have?

#

without dealing with merging and conflicts or whatever.

#

i have not really used git a whole lot to know what to do.

pseudo hazel
#

are you saving every file to git? like you dont ignore any?

#

in that case you can just remove it from your local pc and re clone it

#

or you can stash your changes, and switch to the right commit

quaint mantle
#

lol i am just cloning the repository at this point.

wet breach
#

contains 3 different scenarios of reverting

#

last one I think is what you are wanting

quaint mantle
#

yep, it was the last one, got it.

#

i was just undoing and redoing stuff in the IDE and it just deleted stuff to the point where i was too lazy to write all that code again.

#

i was literally just holding down ctrl + y or ctrl + z and it just deleted lines of code.

#

weird.

#

anyway, i am going back to working on my project right now.

wet breach
#

have fun 🙂

quaint mantle
#

i made some junk commits while i was trying to revert changes.

#

and now github is ahead of my current local commits.

#

lol this is a pain.

#

how do i delete github commits?

#

i wonder how they do it in real jobs where they do CI/CD or devOps or whatever it is called.

#

actually

#

on the topic of that though

#

does anyone know any good resources to learn CI/CD?

#

it looks kind of complicated.

#

at least right now, to me though.

wet breach
#

you might have to revert to using console

#

to push your changes

#

you have to use the --force

#

flag

#

basically that says, push my changes I don't care what you have

quaint mantle
#

that worked!

#

thanks!

#

i am gonna take a break i guess

#

been working on this for too long.

wet breach
#

the most common is setting it to build based on commit changes

#

Jenkins is a really easy CI server to setup

#

and does this if you want it to, or you can configure however you like it

quaint mantle
#

i see

#

is jenkins just java only or works for any language?

wet breach
#

Jenkins is built using Java but it doesn't have to be used for Java only projects

quaint mantle
#

oh ok

wet breach
#

As long as you configure all the appropriate tools for jenkins to access it can build other languages

quaint mantle
#

i will probably try to learn that sometime soon.

#

appreciate the knowledge! This server teaches me so much.

wet breach
#

I do what I can

#

lol

summer agate
#

CI/CD and devops are indeed workflows that are meant to ensure quick releases and stable builds. It very much relies on writing lots of unit tests which would be used during the build of a commit

#

Jenkins is one such tool, but github actions can do most of it too (and is completely free for open source projects. Otherwise you have 2000 build minutes per month)

quaint mantle
#

how would you test a minecraft plugin though?

wet breach
#

Well, unit testing isn't inherent to the concept, but it does help especially in places where you wouldn't want a build to continue or just early notification of potential problems

quaint mantle
#

i have seen libraries like cypress for testing stuff for web stuff.

summer agate
quaint mantle
#

but never done any testing myself with those libraries.

wet breach
#

unit testing plugins are easy as long as what you are testing doesn't require the plugin to be running, otherwise you have to create mock stuff for objects like player for example

#

but like you can test logic of stuff

#

maybe you are manipulating an array to sort it

#

you could have a test to ensure the final sorting is what you are wanting

#

that doesn't require the server or plugin to be running because that doesn't make use of server specific objects

summer agate
#

I'm still kind of disappointed that there isn't an e2e testing library for bukkit. Not that I am smart enough to make one

quaint mantle
#

how do you test a testing library?

wet breach
#

same way but a bit more complex lmao

quaint mantle
#

there had to have been testing library that wasn't tested.

summer agate
quaint mantle
#

that was used to test other testing libraries perhaps?

summer agate
#

You look for tests that the testing library has I guess. They will have a workflow to test the test in order to test

wet breach
summer agate
#

what are you talking about

quaint mantle
wet breach
#

Then how do you ensure the lib itself doesn't contain a bug, or actually does what you expect it to

#

all methods are testable given you know how to construct the test for it

#

doesn't matter if the method or logic comes from your application or a library

quaint mantle
#

testing all edge cases and identifying them is probably not very easy.

wet breach
#

not always, but you just add to your testing as you go along

quaint mantle
#

a billion dollar game like minecraft has so many bugs more often than not in their major releases.

wet breach
#

so, like not everything needs to be tested for example

quaint mantle
#

or maybe mojang developers are bad.

summer agate
#

This might be interesting. It's the tests I have in my plugin This might be interesting,

quaint mantle
#

probably the latter.

summer agate
#

Nah, there is a point when even though tests catch 90% of errors the 10% is still a lot

echo basalt
#

they have the resources to fix the bugs

#

but grouping it all into releases and all takes time

summer agate
#

A popular development method is TDD (Test driven development). Write tests, then write code

quaint mantle
#

hm

summer agate
#

Requires you to think things through before writing code

quaint mantle
#

that sounds difficult.

#

and would probably take so much time.

#

does anyone have real world jobs and do this stuff irl?

#

i did not understand half of it.

#

or more than half of it.

summer agate
#

For a spigot plugin it's probably not worth doing, but in important applications...

#

My company doesn't do automated tests 😢

quaint mantle
#

i wonder what mojang does to test their stuff.

summer agate
#

probably a metric ton of unit tests

#

maybe some integration tests. Unlikely they have end to end tests

quaint mantle
#

hm.

#

making software sounds more difficult than i initially knew.

summer agate
#

Making software that can be used by millions and is accessible and does not crash and does not have bugs and is fun to play is very hard indeed

wet breach
#

I never do any unit testing in regards to java

#

mainly because it is faster to test yourself then it is to come up with the tests to begin with lol

#

the tests don't write themselves you know, so not only do you have to come up with the test but you have to implement it properly

quaint mantle
#

then there are the modders

wet breach
quaint mantle
#

yeah, i dont think i am doing all of that myself anytime soon probably.

vocal cloud
#

Unit tests are for when you can easily have expected input -> expected output

wet breach
#

given that you are making plugins which is like mini-applications for a larger application

#

but bukkit has tests though when you compile it that are ran unless you disable the testing stuff

#

doesn't test a whole lot but it tests a few things lol

quaint mantle
#

hm

summer agate
#

For plugin test flows at least

wet breach
#

probably, but at that point might as well have someone do it lol. But spigot/bukkit is the modification of another application as well so I mean probably would be really hard to setup some kind of test that isn't overly complex to do such things lol

#

I know it isn't worth my effort and probably the reason no one has bothered to come up with such things

summer agate
#

but yeah

wet breach
#

well that is the part that is hard though

#

when you have an implementation the underlying system always changing

#

and its not even in your control for those changes either

summer agate
#

you'd have to freeze versions, but with the sheer amount of versions currently around that would be difficult

river oracle
#

I use mock bukkit it is pretty nice to test open ans close quick errors with tbh wouldn't use it for.

wheat flint
#

is there anyway i can fix the auto closing menu when resoucepack is loading on join?

public class PlayerResourcepackLoad implements Listener {
    Plugin plugin;
    public PlayerResourcepackLoad(Plugin plugin){
        this.plugin = plugin;
    }

    @EventHandler
    public void onPlayerResourcepackLoadEvent(PlayerResourcePackStatusEvent event) {
        if (new GetPluginInfo(plugin).isPluginEnabled() && new IfFirstPlayed(event.getPlayer(), plugin).Check() && event.getStatus().equals(PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED)) {
            Inventory inventory = new WelcomeInventory(plugin).getInventory();

            event.getPlayer().openInventory(inventory);
            event.getPlayer().sendMessage("Opening Welcome Menu...");
        }

    }
}

remote swallow
#

you shouldnt be making a new instance of your plugin , and you can use player.hasPlayedBefore() and == for enums

cobalt thorn
#

Hi, i made the plugin add an effect but the effects don't combine, there's a way? this is the code i used

p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20 * Config.XANAX_COOLDOWN.getInt(), Config.XANAX_AMPLIFIER.getInt()));
wheat flint
remote swallow
#

whats GetPluginInfo then

icy beacon
#

one more thing though

#

what are these naming conventions

remote swallow
#

if those classes are just 1 method put them in a utils class

icy beacon
#

i mean why is there a class called "IfFirstPlayed"

remote swallow
#

and make it static

icy beacon
#

it should be a method

#

and also why is "Check()" in UpperCaseCamel

rough drift
#

I want to apply V velocity to an entity whilst keeping it's movement (such as players), however I don't really want it to stack again, I am doing something like

// In a scheduler
Entity entity = ...;
Vector toAdd = ...;

entity.setVelocity(entity.getVelocity().add(toAdd));

I know this accumulates, don't know how to not make it accumulate

wheat flint
#

fixed that but still i have an issue when resourcepack is loaded it still closes inventory even if i open inventory when resourcepack is loaded

icy beacon
#

does anybody know if MongoDatabase#getCollection is nullable? there are no annotations on the method and the docs don't help

#

found the solution at https://www.mongodb.com/docs/manual/reference/method/db.getCollection/

Behavior
The db.getCollection() object can access any collection methods.
The collection specified may or may not exist on the server. If the collection does not exist, MongoDB creates it implicitly as part of write operations like db.collection.insertOne().
echo basalt
#

apply the biggest velocity between playerVel and toAdd?

wheat flint
#

Inventory closing when it opens on resourcepack succesfull_loading

glossy atlas
#

I want to play a sound when player join
I tried to do it but it did not work

#

I registered Events

icy beacon
#

try to delay it by 1-2 ticks

#

also a good rule of thumb is to ged rid of 1-letter variables as much as possible

#

at least do ev, pl

glossy atlas
hazy parrot
#

ev is even more vague then e imo

undone axleBOT
icy beacon
#

and player if you are afraid of confusing it with plugin

#

one-letter variables are super ambigious

#

the only potentially appropriate use of them i can think of is for-loops

#

and maybe exceptions

ivory sleet
#

One letter variables can be fine

#

The name of a variable should be proportional to the scope its contained within

#

That means, the smaller the scope, the shorter the name has to be, the bigger the scope, the longer the name has to be. At least this is the convention.

#

And then for functions, the same rule applies but inversely

wet breach
#

so make a really long name to show that it has the largest scope 😄

ivory sleet
#

Usually public static variables

#

Yea you have a lot of exceptions (System.out being the first one coming to my mind)

#

But its a convention, and a good one

wet breach
#

?convention

#

?conventions

ivory sleet
#

Java does not go over it because its not official, but it has been adapted in the industry

wet breach
#

yes it does

#
Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.
ivory sleet
#

That’s not the same

wet breach
#

it still mentions single character variables lol

ivory sleet
#

The proportionality rule adds more restrictions

ivory sleet
sick ermine
#

@lost matrix Should I create the Updater class and its subclasses to increase the correct value when the event trigger is fired?

timid jetty
#

So for an entityDamageByEntityEvent I'm trying to get the entity's current location using the following line of code
Vector v = event.getEntity().getLocation().toVector();
however for soem reason when testing this it always outputs 0,0,0 irrespective of where the entity is

#

anybody know what might be wrong there?

ivory sleet
#

That’s not supposed to be the intended behavior

#

Do you have more code to display for us?

timid jetty
#
        Vector v1 = p.getLocation().toVector();
        Vector v2 = e.getEntity().getLocation().toVector();
        Vector destination = v2.subtract(v2.subtract(v1).normalize());

i mean i dont know how much this helps with it but yeah

#

the player location works fine just the event entity doesnt

past vapor
#

Is there a way I can stop the primary world from saving chunks/entities, I know you can unload a world at onDisable, but that doesn't seem to work for the primary world.

ivory sleet
#

vectors are mutable

#

So you might want to clone before invoking any operations on them

timid jetty
#

got it ty

#

lets see if that works :)

ivory sleet
#

Ye

primal goblet
#

whats the best plugin to make nick name and tablist changes too with it?

timid jetty
#

nah still doesnt work

#

:(

primal goblet
remote swallow
#

how?

#

if you dont want to use essentials make ur own and register papi placeholders and add that to tab

rough drift
primal goblet
remote swallow
#

you can register a placeholder with it in your pluign

#

then use it anywhere

#

you just have to respond to the call and ur done

primal goblet
#

ima give it a try

remote swallow
#

that explains how to make one

echo basalt
#

That way it's small enough to fall off before re-adding it

rough drift
#

Alright

primal goblet
#

@remote swallow ig protocol lib is better or am i wrong?

remote swallow
#

for what

#

protocol lib and placeholder api are very different

echo basalt
#

ProtocolLib is just a packet interception library

#

It lets you listen and send packets

primal goblet
#

and i need to send packets to change the player head and tablist name

echo basalt
#

PlaceholderAPI is a text parser that links a %placeholder% to a Supplier<String> that routes through the expansions

primal goblet
#

like a nickname system

echo basalt
#

or a function or something

echo basalt
primal goblet
echo basalt
#

well

#

Make a placeholder with PAPI and use a plugin that hooks into it

primal goblet
remote swallow
#

and gives you customizable tab

primal goblet
#

i tried to make scoreboard packets to change the prefix, suffix for players

#

but i cannot change player's names

remote swallow
#

the plugin

primal goblet
#

ohhh

#

lemme see it

remote swallow
#

just use that and you get scoreboard, tab, customizable above head

#

etc

echo basalt
#

rare moment but I wrote documentation

remote swallow
#

its going on github?!?!?!

echo basalt
#

private repo for my org

#

:)

remote swallow
#

fuck yo u

#

lemme in

echo basalt
#

no

#

you don't work for me

remote swallow
#

i can

echo basalt
#

nah

#

I hired a new dev last friday

#

team's full for now

smoky oak
#

illusion do u by chance have xp with geometry in graphics?

remote swallow
echo basalt
remote swallow
#

im taking over

smoky oak
#

goddammit

#

i have a very specific issue atm

echo basalt
#

I can do basic particle effects and all

#

but that's about it

#

bezier curves confuse the fuck out of me

smoky oak
#

ye thing is im not that good either

echo basalt
#

ask chatgpt lol

#

I can render a star and all

#

that's about it

#

guy I hired probably knows, he does vfx for marvel

remote swallow
#

where are you getting the money for thiw

#

and how many of them are under nda

smoky oak
#

okay so its taking like 3 second per work

#

i think i broke it

#

*word

pine forge
#
@EventHandler
public void onClick(PlayerInteractEvent event) {
    System.out.println(event.getAction());
}``` 

Why is this code not receiving the RIGHT_CLICK_AIR event?
Also note, that RIGHT_CLICK_BLOCK is always logged twice for some reason
smoky oak
#

in order:

  1. Client doesnt send empty hand air clicks
  2. It is once per hand: left and right
pine forge
#

it sends the left click air though

#

with an empty hand

smoky oak
#

cuz thats a punch

#

so it gets send

pine forge
#

ah i see

#

what can i do to work around that?

smoky oak
#

which part

#

the double click?

pine forge
#

no the right click air part

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
pine forge
remote swallow
#

it runs once for each hand

smoky oak
#

ye

#

offhand

echo basalt
pine forge
#

ah

smoky oak
#

if(event.getHand()== EquipmentSlot.OFF_HAND) return;

echo basalt
pine forge
#

okay so what about the first part

echo basalt
pine forge
#

how can i register right click air

smoky oak
#

cant

#

like i said

#

client doesnt send it

pine forge
#

no workaround_

#

?

smoky oak
#

well

#

theres only one i can think of

#

and its really stupid

pine forge
#

You could give people invis items

smoky oak
#

ye that

remote swallow
#

whats a dna

echo basalt
#

nda

remote swallow
#

do you mean nda

echo basalt
#

fuck

pine forge
#

alright thanks

pliant flame
echo basalt
#

mans literally DMd every single developer I've remotely worked with

remote swallow
#

oh is the the guy that has conclure on his staff

#

or is that someone else

echo basalt
#

nah it's him

#

conclure and frostalf

#

and buoo

#

I took netious for myself >:)

smoky oak
#

i feel way out of my league here

remote swallow
#

illusion has 100% hired me at some point

#

(very true)

echo basalt
#

no

remote swallow
#

yes