#help-development

1 messages · Page 202 of 1

mighty pier
#

what is shadowing

remote swallow
#

might also be called shading sometimes

vocal cloud
#

Mavens method of compiling dependencies into your project

mighty pier
#

u mean putting it in pom.xml

#

o r no

#

extra file necxt to that?

vocal cloud
#

Uh no

remote swallow
mighty pier
#

ok

#

i think i know what it is

#

i dont know how to make this a shade

remote swallow
#
<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>
mighty pier
#

is that the jdbc

eternal oxide
#

Pretty sure Spigot already has an SQLite driver

mighty pier
#

when i try to do the connection

remote swallow
mighty pier
#

it returns null

#

yes but how do i put the jdbc information in there

eternal oxide
#

did you call Class.forName("")?

mighty pier
#

uh oh

#

no

#

wait

#

idk im gonna check

#

i did not in fact

#

do that

#

it worked

mighty pier
terse ore
#

is there a method for detecting if some coords are instide 2 points?

eternal oxide
#

BoundingBox

terse ore
#

thx

#

Can I cast a list to a location?

eternal oxide
#

no

#

You can stream it and cast

mighty pier
#

can i use abstraction for a commandexecutor like this? ```public class MuteChatCommand implements CommandExecutor {
private final Utils plugin;

public MuteChatCommand(Utils plugin) {
    this.plugin = plugin;
}``````        getCommand("mod").setExecutor(new ModCommand());
    getCommand("mutechat").setExecutor(new MuteChatCommand(this));```
eternal oxide
#

I see no abstraction there

mighty pier
#

uh

#

so it wouldnt work

#

how do i do abstarction tehn

eternal oxide
#

I see two commands, mod and mutechat

mighty pier
#

yes

#

i need the plugin instance in mutechatcommand

#

is that how i do it

eternal oxide
#

Yes, dependency injection

mighty pier
#

oh

#

yes

#

that

#

ty

terse ore
#
public class OnPlace implements Listener {
    @EventHandler
    public static void onPlace(BlockPlaceEvent event) {
        System.out.println("A");
        Player player = event.getPlayer();
        Block block = event.getBlock();
        Location location = block.getLocation();

        if (Config.isInside(location)) {
            if (player.getGameMode() != GameMode.CREATIVE) {
                player.sendMessage(Color.translate("&cNo puedes poner bloques en el spawn"));
                event.setCancelled(true);
            }
        }
    }
}```
#

I have been trying to get this event being called but it isn't

noble forge
#

have you registered your event listener?

terse ore
#

I am registering it onEnable but it is not calling when placing a block

eternal oxide
#

remove static

terse ore
#

same

eternal oxide
#

there is nothing wrong with the event you posted other than the static. Well it is obviously not all teh code as you have variables used which don;t exist like config

terse ore
#

Still if that was the issue it should print "A"?

remote swallow
#

remove the static and check it

mighty pier
#

wtf is an anchor

#

how remove

#

help

eternal oxide
#

you have to parse &

mighty pier
#

what that mean

#

how

mighty pier
#

i did that

eternal oxide
#

if you did you would not have &c displayed

mighty pier
remote swallow
#

?paste the code

undone axleBOT
mighty pier
#

oh i did forget to translate all color codes on some code

remote swallow
#

thats a config file not code

eternal oxide
#

wrap in `

#

`

remote swallow
#

arent they meant to be wrapped in ""

echo basalt
#

both work

#

also it's ' not `

remote swallow
#

thats true

eternal oxide
#

yep

echo basalt
#

` is used for single line code blocks like this

#

and accents in some languages like portuguese with their á à

tall dragon
#

does any1 know a good way to find a safe location within a radius?

sacred mountain
#

is there an efficient way to check if a player touches a man made guardian beam

#

as in not a natural thing

fierce whale
#

Is there anyway to get other plugins metadata?

tender shard
fierce whale
#

umm

#

yes i know that

vocal cloud
#

The question is why do you want to do this?

fierce whale
#

So we can use metadata cross other plugins

vocal cloud
#

Make an API

fierce whale
#

But

tender shard
#

I'd rather use the Entity's PDC instead of using metadata

fierce whale
#

It doesn't work 😦

#

I've not heard that

#

entity PDC data..?

fierce whale
#

Okay I'll read that

#

thx! 🙂

tender shard
#

np

#

it's 1.14+ though

fierce whale
#

okay

#

but

#

can we use PDC cross other plugins?

tender shard
#

sure

fierce whale
#

ahha I got it!

tender shard
#

you can also loop over all existing data so you don't really need the other plugin's instance

echo basalt
sacred mountain
#

mfnalex wit hyour superior knoweldeg plaase help me

tender shard
#

e.g.

for(NamespacedKey key : myEntity.getPersistentDataContainer().getKeys()) {
  print("Data found from plugin " + key.getKey());
}
sacred mountain
#

good idea

#

and ho

#

w

echo basalt
#

Depends on the server version

#

of you can just check the angle between start and finish

#

make a cuboid

sacred mountain
#

1.19.2

echo basalt
#

and match both within the cuboid and within the angle

echo basalt
sacred mountain
#

ill see

echo basalt
#

Start with the start location and end-start as a vector

#

the double will be distance(start, end)

#

FluidCollisionMode doesn't matter

tender shard
echo basalt
#

the raysize should be the radius of the guardian beam

#

it's save to set it as something like 0.8 or 1

#

I'm just concerned about blocks between the beam

sacred mountain
tender shard
#

i have no clue how "big" (in width) a guardian thing is. probably like 0.5 blocks or so? if you set it to 0, it would only detect entities that are directly touched by the center of the beam

sacred mountain
echo basalt
#

that's for blocks

#

you could just use rayTraceEntities instead

tender shard
#

^ yeah rayTrace is for both blocks and entities, if you do not care about blocks inbetween just do rayTraceEntities

sacred mountain
tender shard
#

if you want to look "through" blocks, use rayTraceEntities

sacred mountain
#

nah it's for some minigame where they have to stand behind blocks to not get hit

#

so i'll keep the blocks there

#

would this work

echo basalt
#

try it and see

tender shard
tardy delta
#

no need to cast

sacred mountain
sacred mountain
#

necessarily

tardy delta
#

ah that livingentity concept is stupid

sacred mountain
#

yea

#

so the raycast doesnt seem to work

#

i've used the start location and the start direction with a length of 50 raycast

#

and wherever i stand i don't get damaged

echo basalt
#

print the raycast result

#

also how often are you running it?

sacred mountain
#

yeah null

#

constantly

sacred mountain
#

just to check

#

nothing

#

bruh the direction is backwards

#

_>

quaint mantle
#

hello

urban kernel
#

can someone help me? i've built a plugin that when an entity dies if the name is "techno" or "technoblade".toLowerCase() it cancels the event

#

however it didnt work

tender shard
#

show your code

urban kernel
#

by didnt work i mean this

#

[11:44:56 INFO]: Named entity EntityCow['techno'/239, uuid='0c1539fd-53a9-4b4f-bccf-3706319062f0', l='ServerLevel[world]', x=511.51, y=63.00, z=386.17, cpos=[31, 24], tl=13230, v=true, rR=null] died: techno was slain by Deveroonie using [techno]

#
package xyz.deveroonie.technoneverdies;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;

public class DeathEvent implements Listener {
    @EventHandler
    public void onEvent(EntityDeathEvent e) {
        if(e.getEntity().getCustomName() != null) {
            if(e.getEntity().getCustomName().toLowerCase() == "techno" || e.getEntity().getCustomName().toLowerCase() == "technoblade") {
                e.getEntity().setLastDamage(0);
            }
        }
    }
}
quaint mantle
#

hi, I encountered this error when starting my plugin and I don't understand what it means, it has been doing it since I added this piece of code that I now send

#

?paste

undone axleBOT
quaint mantle
urban kernel
#

shit

#

ok

tender shard
icy beacon
#

check if the damage is fatal and set it to 0

tender shard
#

oh btw do not name the class "DeathEvent" but rather "DeathListener"

quaint mantle
#

shit

#

and how to call a function to an external class?

quaint mantle
#

is an external class

undone axleBOT
tender shard
#

Static on the other hand is not object-oriented
ughm that's not true, you just have to realize that classes are objects too

sacred mountain
#

any ideas about why only one of the lasers does any damage

tender shard
#

because ofc the raytrace will always only return the first entity that's hit

tardy delta
#

people still instantiating bukkitrunnables for no reason smh

sacred mountain
#

only one of the lasers does damage

#

the others ones dont do anything

tender shard
#

hm then no idea. do some debugging, maybe you again have the direction fucked up, or sth?

keen basin
#

Does anyone understand the use of ProtocolLib?
how can I make the player break fast? I tried block breka animation. It's only animation. Don't break the block.

sacred mountain
#

spigot is stupid

#

i hadt o make my own vector class bc idk how spigots works

#

now it works for some reason, and i'm not changing it

tender shard
tardy delta
#

lookin' hot

hazy parrot
#

but they added singleton object class

#

that can act as utility class for instance

tender shard
#

i cannot think of any reason why it would be better than java

hazy parrot
#

corutines are cool

#

also extending functions

tender shard
#

i dont know much about coroutines so I cannot say anything about that. extending functions however are not very different to a static util method

#

I mean where's the difference? it's kinda the same

fun Player.kickForCheating() {
  this.kick("Kicked for cheating")
}
static void kickForCheating(Player player) {
  player.kick("Kicked for cheating");
}
#

i mean, whether you do somePlayer.kickForCheating() or kickForCheating(somePlayer), that's the same thing

#

in fact the extensions are quite confusing because one might think that this method is actually part of Player, although ofc it isn't

#

the only valid reason I'd see for extending functions is if they can access private / protected / etc fields or methods. I don't know if that's possible, but that'd be the only reason I'd see for them to exist

hazy parrot
#

there is also inlining functions

#

but who cares anyway

#

¯_(ツ)_/¯

tender shard
tender shard
# hazy parrot but who cares anyway

true. I just dislike kotlin, I don't hate it. I'm sure that I only dislike it because it's "different" from java, which I more or less grew up with lol

#

if I'd have grown up with kotlin, I'd dislike java, lol

echo basalt
#

grew up doing java gang

#

pretty sure I first started coding in C# when I was 6

#

then moved onto C

tender shard
#

my current thing is to properly learn lua and it's annoooooyyyyiiing

echo basalt
#

but wasn't a fan

ivory sleet
#

personally I believe kotlin is too bloated

tender shard
#

why is EVERY THING in lua global?!

#
function printReverse(text)
  text2 = string.reverse(text)
  print(text2)
end

-- Now guess what - text2 is still valid here and will always contain the last reversed string, since every variable, even when defined in a function, is global unless otherwise specified
#

this is really weird

#

there shouldn't be a "local" keyword, but rather a "global" keyword

echo basalt
#

okay that sounds like a wtf moment

tender shard
#

yeah

#

you can do
"var = something"
EVERYWHERE and it will be public / global

mighty pier
#

skript momento

tender shard
#

in my above example, one should use

function printReverse(text)
  local text2 = ...
#

/shrug but I mean, what did I expect from something that doesn't even have class definitions or strict typing or anything

hazy parrot
tender shard
#

I once did an internship at a company that made sattelites and they also wrote their stuff in lua and it was ANNOYING

#
if orbitalHeight() < expectedOrbitalHeight then
  startBoosters()
end
#

and yeah it really looked like this

echo basalt
#

looks like those bootleg programming languages that are a pascal clone

#

that they use to teach programming at schools

tender shard
#

yeah lol

echo basalt
#

looking like mfing

tender shard
#

I learnt coding with java with a tool called "Hamster Simulator" lol

#

it had methods like "turnRight()" and when you wanted to implement a "turnLeft()" yourself, you just did this

public void turnLeft() {
  turnRight();
  turnRight();
  turnRight();
}
echo basalt
#
variables {
  number : int
}

start

write("Input a number: ")
read(number)
write("You wrote: ", number)

end
#

yes they teach you how to code like this in school

#

no IDE, pen & paper

tender shard
#

oh yeah we also did our exams in coding with pen & paper

#

but nobody cared about a missing " or ;

echo basalt
#

okay

#

but

tender shard
#

it was more like "pseudo code"

echo basalt
#

now the thing is

#

it wasn't in english

#

all the words were localized

tender shard
#

yeah we had that too D:

echo basalt
#

And there was an IDE after like 3 months

#

that froze whenever you had an infinite loop

#

and had no autosave

tender shard
echo basalt
#

the thing is

jolly gust
#

How to create an ItemStack Collection? I can't find anything about it

tender shard
echo basalt
#

we all had english classes

#

and actively have

tender shard
#

Usually you just do new ArrayList<> or whatever

echo basalt
#

since like the 2nd grade

tender shard
#
List<ItemStack> myListOfItemStacks = new ArrayList<>();
echo basalt
#

country-wide

tender shard
#

deque

echo basalt
#

linkedlist

tender shard
#

binarytree

#

ok that's not a collection

echo basalt
#

HashTable

tender shard
#

that's also not a collection

echo basalt
#

fuck

mighty pier
#

porn collection

#

dvd

echo basalt
#

Set<Map.Entry<ItemStack, Object>>

tender shard
echo basalt
#

funny thing

#

reddit isn't blocked on the school network

#

but porn sites are

mighty pier
#

reddit not only pron

tender shard
#

that's useless, reddit has more porn than PH

echo basalt
#

so mfs in my class just watched porn subreddits

jolly gust
#

I need to create a collection with ItemStack in order to then compare them with another itemstack collection from the getDrops method in the BlockBreak event

tender shard
mighty pier
tender shard
#

a List is a Collection

echo basalt
#

bluegem is the polar opposite of most beginners asking for help

#

he knows the concepts but no execution

mighty pier
#

i watched a spigot tutorial before a java tutorial

echo basalt
mighty pier
#

learned java and spigot at once

echo basalt
#

I watched a tutorial on how to setup my ide

#

and just... tried and failed

#

until I eventually got there

#

now I don't even use the spigot api that much honestly

#

I think I use more mongodb and redis apis than spigot

mighty pier
olive lance
#

Yea lol the spigot tuts before Java is accurate asf

onyx fjord
#

is there a chance that listeners might fail to register? if yes what do they throw

#

just wondering

echo basalt
#

If you have an exception on your constructor...

mighty pier
echo basalt
#

but the registering process itself is flawless

onyx fjord
#

gotchu

tender shard
echo basalt
#

or yeah if you have something stupid like that

tender shard
#

i dont remember by heart what it throws but you can check the SImplePluginManager class to find out

echo basalt
#

IllegalPluginAccessException - if the plugin is null or disabled, or if you're listening to an event that doesn't have a static getHandlerList method

onyx fjord
#

ok ok

tender shard
#

yeah but there's another exception if the EventHandler annotated method takes anything besides one Event object

#

but why would you care about what it throws?

mighty pier
#

is there some tutorial that explains what static is, why its bad to use sometimes and other stuff about it

#

caus ei dont really understand it

echo basalt
echo basalt
mighty pier
#

thank

tender shard
noble forge
#

What does this syntax do

#

variable assignment inside of a method call?

echo basalt
#

yeah

noble forge
#

thats really puzzling

#

so its only assigning checkClass that value if this condition evaluates to true?

#

and then at the same time passing that value into the method call

dire marsh
#

if that condition is true it isn't going to check the next condition because of the or afaik

mighty pier
#

what is the garbage collector?

dire marsh
#

it removes your terrible code

fluid river
tender shard
fluid river
#

why not just if (2 == 2) hehe

tender shard
#

because it was an example

#

a real life example would be sth like this

while((line = reader.nextLine()) != null) {
  // do sth with line
noble forge
#

but

int i = 0;
if (someCondition() && i = 3 == 3) {
  System.out.println(i);
} else {
  System.out.println(i);
}

i would only be 3 if someCondition() is true right?

tender shard
#

if you'D use &, then i would always be 3

noble forge
#

ah

fluid river
tender shard
#

firstMethod() && secondMethod()
secondMethod() would only run when firstMethod() is true

#

if you'd use & instead &&, both would always run

fluid river
keen basin
#

Does anyone understand the use of ProtocolLib?
how can I make the player break fast? I tried block breka animation. It's only animation. Don't break the block.

fluid river
#

bro you look like a gigachad

delicate lynx
#

owo I heard femboy?

tender shard
fluid river
#

even more male than me

tender shard
#

I don't go full femboy when I'm going to the store, for example, lol

fluid river
#

oh

fluid river
#

imagine mfnalex be femboy

tender shard
#

easy

keen basin
tender shard
fluid river
#

true

tender shard
#

with "a bit" I mean "a lot"

#

obv

fluid river
#

after

eternal oxide
#

Not the place for this

tender shard
#

no, I look like myself

fluid river
#

who is she

#

hello She

mighty pier
sacred mountain
#

anyone got an idea of why (visually) end crystal and guardian lasers glitch out when looking at certain angles?

#

like i just cant see them sometimes

#

but my friend can see all of them

mighty pier
#

dilemma

tender shard
#

do you use any weird stuff like Iris or Sodium?

fluid river
#

sounds like YOU problem

#

might also be cuz of render distance

#

maybe you are too far, and entity is moving

errant narwhal
#

Hey

#

how to check if player in combat?

fluid river
#

who knows

#

if player deals damage

#

or gets damage

errant narwhal
#

oh ok

quaint mantle
#

how i get the LastDamageCause.....System.out.println(e.getEntity().getLastDamageCause()); i write this, but i want do:
if(e.getEntity().getLastDamageCause().equals(TypeOfDamage)) what should I do if the message changes every time

#

type EntityDamageByEntity @ A number that is always changing

vital sandal
#

how can i get the text line data ?

tender shard
quaint mantle
fluid river
#
if (e.getEntity().getLastDamageCause() == DamageCause.YOUR_MOMS_DOOR_SLAM) {}```
quaint mantle
#

lol

#

thanks

fluid river
static hollow
#

Hey.
I have this class for managing player settings:
https://pastebin.com/QFQcCKqR
But it doesn't work.
When I use this code:

PlayerSettingsManager.getInstance().CreatePlayerSettings(sender.getUniqueId());
PlayerSettingsManager.getInstance().GetPlayerSettings(sender.getUniqueId()).set("test", "test");
PlayerSettingsManager.getInstance().SavePlayerSettings(sender.getUniqueId(), PlayerSettingsManager.getInstance().GetPlayerSettings(sender.getUniqueId()));

sender.sendMessage("Option: " + PlayerSettingsManager.getInstance().GetPlayerSettings(sender.getUniqueId()).getString("test"));

It gives me Option: null

undone axleBOT
tardy delta
#

thats some nice combination of naming conventions there

static hollow
#

Oh, sorry.

#

My main language is C#

sacred mountain
#

can you set the color of a guardian beaem

static hollow
sacred mountain
#

i know you can call a packet to make the client change it but thats randomized

static hollow
#

But, can you help me with it? I'll rewrite it later, but first i want it to work xd

fluid river
#

you are using unmodified yamlconf to save file

#

ofc it's gonna be null

#

if you are using singleton anyway

#

you can store YamlConf to hashmap

#

or just don't do this shit

#
var conf = PlayerSettingsManager.getInstance().GetPlayerSettings(sender.getUniqueId());
conf.set("test", "test");
PlayerSettingsManager.getInstance().SavePlayerSettings(sender.getUniqueId(), conf);```
#

done

#

naming convention...

tender shard
#

tbh naming conventions become a joke when it's different for every language lol

fluid river
#

like you ignore the fact that getInstance is from lowercase

#

left from it 🙂

tender shard
#

lua is good in mixing UpperCamelCase and lowerCamelCase and also uses . and : and sometimes you also have snake_camel_case

warm token
#

@zealous osprey @last temple EntityBlockFormEvent doesn't get fired when you prime a TNT.

static hollow
#

yeah, it works...

#

thanks

tardy delta
#

i hate languages that use like begin and end, whats wrong with {}

fluid river
#

PascalABC enters the conversation...

sacred mountain
#

whats the best way to implement a "safe" .get() in a custom list object that will go back to the start index if it overflows, but infinitely

fluid river
#

waitwhat

sacred mountain
#

as in

#

for instance i have a list of size 10

#

if i want list.get(21)

#

it will return the first value

#

the math is easy im just making an api so i wanna make it as efficient as possilbe

eternal oxide
#

% 10

fluid river
#
int paramToGet = 21;
return list.get(paramToGet >= list.size()? 0 : paramToGet);```
eternal oxide
#

21 %10 = 1

sacred mountain
#

[i > length ? i % 10 : i]

#

thast the shortest i got it

#

ok cool

fluid river
#

first is 0 tho

tender shard
#

Dont worry about whats shorter but rather about whats more readable

fluid river
#

not 1

eternal oxide
#

no needs for the ter, literally list.get(length %(list.size))

sacred mountain
#

right yes

mighty pier
tender shard
sacred mountain
#

oh

fluid river
#

ternary operator

tender shard
#

Eg String name = someCondition ? „Yes“ : „no“

tender shard
sacred mountain
fluid river
#
int result = statementIsTrue? 1/*if-true*/ : 0/*if-false*/;```
mighty pier
#

it will be useful

sacred mountain
#

boolean isTrue = true ? true : false;

(efficient)

tender shard
mighty pier
#

what is the % called

sacred mountain
#
String myString;
if (condition) {
  myString = "Yes";
} else {
  myString = "No";
}
String myString = condition ? "Yes" : "No"

same

hazy parrot
fluid river
#

remainder of the division

#

🙂

mighty pier
#

ah so

fluid river
#

modulo isn't it

sacred mountain
mighty pier
#

4 % 2 would be 0

#

modular

hazy parrot
#

probably, i said it how we say in serbia 😄

fluid river
#

in pascal it's pascal mod

sacred mountain
mighty pier
#

makes sense

fluid river
#

5%2 = 1

sacred mountain
#

0%0

fluid river
#

5%3 = 2

#

1%10= 1 tho

fluid river
mighty pier
#

wjats the remainder

fluid river
#

that's like

hazy parrot
#

5 / 2 = 2 and 1 that cant be divided

sacred mountain
#

catch (Exception e) is true programming

mighty pier
fluid river
#

5 - 2 = 3
3 - 2 = 1
1 < 3, so result is 1

tender shard
fluid river
#

5 % 2 = 1

mighty pier
fluid river
#

same goes for 5 % 3

mighty pier
#

no modular yet

fluid river
#

5 - 3 = 2
2 < 3, so result is 2

tender shard
#

damn I learnt that in 3rd grade 😄

fluid river
#

same

mighty pier
#

bruh

#

math was hardest in 4th grade

#

now its all easy

fluid river
#

math was hardest in 2nd university grade

hazy parrot
#

depends on who you ask 😄

sacred mountain
#

does Location#distance() give the displacement

fluid river
#

it gives distance

sacred mountain
#

the direction as the crow flies distance

tender shard
#

x % y is the same as x / y - (x/y as int, rounded down) * y

tulip nimbus
fluid river
#

just literal distance

tender shard
#

e.g. 5 / 2 = 2.5, 5 / 2 as int is 2, so 5 / 2 - 2*0.5 is 1

fluid river
#

you can travel across the vector between two players

#

and you will run same amount of blocks

#

as what #distance() returns

sacred mountain
#

ok

#

thanks

fluid river
#

tho for comparing two distances(which of 2 entities is closer to the third) use a faster distanceSquared

#

it's not much faster

#

but just faster

sacred mountain
#

minecraft's gravitational field is a lot stronger than earths damn

fluid river
#

ok

#

will know

tender shard
sacred mountain
fluid river
#

sand is falling slower tho

#

i'm sure

sacred mountain
#

27

tender shard
#

yeah falling blocks are slower than normal entities

#

kinda weird but ok

fluid river
#

falling sand entity is just OP

sacred mountain
#

fr

fluid river
#

god-blessed entity

sacred mountain
#

defying gravity

#

summoning a sand block with AI when

fluid river
#

tooslow

#

spawn arrow with ai

sacred mountain
#

seeking missile

fluid river
#

already coded that

#

i have a new idea

#

Anybody watched Marvel's Guardians of the galaxy?

tender shard
#

I hated that movie, it was so ridiculous and boring. BUUUUT

#

the soundtrack is great

fluid river
#

there was a blue guy

#

with arrow

#

he whistled to control it

#

arrow was flying and killing people by itself

tender shard
#

when I open youtube, Guardians is right there

vital sandal
#

how can i do this :l

#

((AnvilInventory) gui.getInventory()).getRenameText());

fluid river
#

Описание: все в сборе: землянин Питер Квилл (Звездный Лорд), молчаливый громила Дракс, зелено-кожая наемница Гамора, живое дерево Грут и говорящий енот. Герои не изменяют себе и с завидной регулярностью продолжают попадать в немыслимые ситуации, выпутываясь из них почти без ущерба (а иногда даже с пользой) для окружающих. На этот раз им предстои...

▶ Play video
tender shard
fluid river
#

from 0:58

#

maybe i should code this arrow

vital sandal
sacred mountain
#

anyone know why i'm getting a negative value? loc.distance(loc2) is returning negative occasionally somehow and then i used Math.abs() still negative

vital sandal
fluid river
#

oh no you can

#

what's the problem with it

tender shard
tender shard
fluid river
tender shard
#

damn I had the wrong tab open

#

my bad

#

sorry

fluid river
#

🙂

vital sandal
#

Bukkit.createInventory(null, InventoryType.ANVIL); is NOT instant of AnvilInventory

sacred mountain
vital sandal
#

even its type is ANVIL

fluid river
#

you have anvil menu

tender shard
sacred mountain
#

im using the distance between 2 points as a speed regulator, so i'm putting the distance as the ticks

fluid river
sacred mountain
#

the error is saying the ticks cant be negative

vital sandal
#

use math^

fluid river
#

nooo

#

please

vital sandal
fluid river
#

so when you try casting inv to AnvilInventory you get Exception?

tender shard
fluid river
#

show your error

tender shard
#

FREE LUA LESSONS

vital sandal
fluid river
mighty pier
#

u used nms anvilinventory

#

wrong import

vital sandal
grim ice
#

anyone knows why intellij is SO SLOW with gradle

mighty pier
#

uh

#

then inventory is the wrong import idk

vital sandal
#

...

#

there is no wrong import here

mighty pier
#

then its cring

river oracle
#

😂 who knows try invalidating caches or something usually that fixes intellij shit

vital sandal
#

even getMethod() return no method :L

fluid river
#

try casting to

#

CraftInventoryAnvil

sacred mountain
#

java.lang.IllegalArgumentException: Ticks must be a positive value bruh

fluid river
#

print your distance

#

print your ticks

sacred mountain
#

it's positive hwen i print it

#

im so confused

fluid river
#

print everything

tardy delta
fluid river
#

maybe ticks need to be integer

vital sandal
#

no luck

fluid river
#

hmm

#

i guess you need to use something other than Bukkit.createInventory

vital sandal
#

actually it was from InventoryClickEvent

sacred mountain
#

it literally cant be negative

#
  1. it's a distance
  2. i put Math.abs() on it
fluid river
#

but still

vital sandal
sacred mountain
#

i may be really stupid

tender shard
#
try {
  somethingNew();
} catch (TrapAssertionError err) {
  // traps aren't gay
}
vital sandal
fluid river
#

i'm thinking

sacred mountain
#

i did a <= 0 not a < 0 in my exception manager

#

ffs

crimson vault
fluid river
#

maybe you need

#

PrepareAnvilEvent

#

instead

worldly ingot
#

Was going to say, distance can definitely be 0.x, which would get truncated to 0

crimson vault
tender shard
crimson vault
#

Ok, would find that really nice

vital sandal
#

no idea what is this

crimson vault
#

Ok thank you 🙂

tender shard
#

or you just use my existing jefflib thing but it's like 300kb in total 😛

crimson vault
#

I'll try it

tender shard
#

feel free to copy paste everything you need

fluid river
#

is prnt.sc blocked in russia or page is just incorrect

river oracle
#

pff my lib is only 80kb

#

not because it has less stuff in it or anything

fluid river
#

not loading for me

crimson vault
#

everything works for me

fluid river
#

well

#

rip russia

crimson vault
#

:/

tender shard
crimson vault
#

Spigot should really integrate something like this into the API

fluid river
#

can't you just use sendAdvancement

tender shard
river oracle
crimson vault
#

I wonder why they haven't done it yet.

tender shard
river oracle
#

don't worry I'll start committing to spigot next year guys

crimson vault
#

I can do?

river oracle
#

my 18th birthday present to spigot is my contributions

tender shard
crimson vault
tender shard
#

`stash

#

?stash

undone axleBOT
tender shard
#

there you can clone spigot and bukkit, add your additions, then PR them

crimson vault
#

ohh nicee

tender shard
#

(you need to sign a CLA though)

river oracle
#

what is hte CLA again just "You don't own this code"

tender shard
crimson vault
#

Ok

tender shard
crimson vault
#

thanks

river oracle
#

god I gotta write a report for my school programming project

#

idk how I'm supposed to write a report on something so logistically basic

crimson vault
tender shard
#

sure, dependency information is in the README file

river oracle
#

jefflib more like jeffmid

#

Y2Kcommons very unfinished and unpolished lib on top

tender shard
#

this mfnalex dude seems to be obsessed with OfflinePlayerPersistentDataContainers

crimson vault
#

but the API looks really good respect

#

yeah i see

river oracle
#

thats cool

tender shard
thorny marsh
#

If I want to get the distance from two different locations using location.distance, is the value in block length?

crimson vault
#

respect respect :d

tender shard
river oracle
#

oh cool

#

yesterday I tried to figure out motd stuff and I gave up after 4 hours

river oracle
#

surprisingly difficult to format that stuff

tulip nimbus
river oracle
#

mojang has their GSON format in a static final var which means the only way to edit it as far as I'm aware is just a bug in the jdk that was patched in jdk 18. That or mixins but that'd require a server patch

wet breach
wet breach
tulip nimbus
vital sandal
#

PrepareAnvilEvent only work for non-virtual anvil :<

wet breach
#

yes just an odd way to measure is all, since diagonals etc

#

typically when measuring by block length you are expecting whole blocks not odd fractions of a block

river oracle
fluid river
#

1 block = 1 meter = 1 unit

azure gate
#

hlo

#

why villager is not picking up material even mob griefing is true

fluid river
#

but the distance() is diagonal

azure gate
#

help

tender shard
fluid river
#

villagers can pickup items?

tender shard
#

but usually nothing else

fluid river
#

bruh

#

i should play minecraft more

tender shard
#

you can make them your slaves

azure gate
#

then also they don't pick

tender shard
#

e.g. you have a dispenser that throws wheat seeds at them, then they go replant your farm

wet breach
vital sandal
azure gate
tender shard
fluid river
#

0.1 is 1/10 of the full block

wet breach
azure gate
wet breach
#

so if you wanted just block length you do so by whole numbers not by fractions

fluid river
vital sandal
#

are they farmers :l?

fluid river
#

1 is a full block

#

again

wet breach
#

I guess you fail at understanding

fluid river
fluid river
#

oh you mean distance method itself

wet breach
#

typically when you want to measure by block length you do so with whole numbers, not fractions because there is things in MC that don't care or the fraction is not relevant

fluid river
storm scaffold
#

How do I fix
Required: object. Actual: string.
In command permissions and permission messages in a gradle plugin.yml

fluid river
#

then yeah it operates with 0.001 as lowest value

#

so 1/1000 of full block

#

so you have 111.222 X

#

222.333 Y

wet breach
#

which is meaningless for other methods that axe off the fraction anyways 😛

fluid river
#

and 333.444 Z

azure gate
#

can anyone help me

fluid river
#

when you do distance you basically do

azure gate
#

why villager is not picking up material even mob griefing is true
i spawned the villager from egg, breeding
then also they don't pick up seed

storm scaffold
crimson terrace
#

at least the bit where it shows that error

fluid river
#
distance = sqrt(pow((111.222 - 3.121), 2) /* which is X1 - X0 */ + pow((222.333 - 103.121), 2) /* which is Y1 - Y0 */ + pow((333.444 - 203.121), 2) /* which is Z1-Z0 */)```
storm scaffold
wet breach
#

when you measure in block lengths what is expected is whole blocks to do so, even if the final number is half a block you would still use a whole block for it

crimson terrace
#

a screenshot would do nicely comet

wet breach
#

I am not saying you can't measure blocks with fractions

#

you are just not understanding the two different measurements

storm scaffold
crimson terrace
#

verify

wet breach
#

lets take example of beard length measurement which is used to measure the length of beards in a given time. You could still use any other measurement that you want, but it would be more accurate or better to use beard length not that it must absolutely be used.

#

that is what you are not understanding when someone asks if its measured in blocks or not

fluid river
fresh timber
#

How can I get the player's version in a PlayerJoinEvent?

fluid river
#

0.001

#

and yeah result of Location#distance(Location) has more zeros

#

after the point

#

cuz it's just a scalar value represented by double

twin venture
#

hi , how i can keep the chunk loaded?

#

after player leave the server?

#

i mean for entites?

wet breach
#

anyways distance doesn't factor in diagonals so you really couldn't say its measured in blocks. Because a diagonal isn't a full representation of a blocks length.

storm scaffold
fluid river
#

it's diagonal of a rectangle

wet breach
#

a diagonal is about what 1/3 larger then a blocks length?

#

if I remember right from math

fluid river
#

yeah

#

but length + width is bigger than diagonal anyways

crimson terrace
fluid river
#

for square diagonal is

#

side * sqrt(2)

twin venture
#

🤔 sooo how i can keep the chunk loaded?

fluid river
storm scaffold
fresh timber
#

cant u use /forceload

#

to keep a chunck loaded

wet breach
wet breach
crimson terrace
fresh timber
#

ok

fluid river
#

so well @wet breach

wet breach
storm scaffold
fluid river
#

we are talking about what distance() returns

wet breach
#

just when someone is asking about measurement being in block lengths typically they mean by whole blocks

river oracle
#

pfff I don't even use my plugin.yml

crimson terrace
fluid river
#

it basically diagonal of the rectangle

#

where each point has format number.3numbers

#

123123.000

crimson terrace
mighty pier
fluid river
#

so if distance returns 1 then you have 1 full block between you 🙂

#

or 1 meter

#

or 1 default unit

#

or 16 pixels

twin venture
fluid river
#

and for 1.3 you have one full block plus one third of the block(or meters or units(or 16 * units PIXELS))

twin venture
#

i dont want to remove it after i leave , i want to keep it working

fluid river
#

or 1.3 units

twin venture
#

like it suppose to be

#

i just want ideas on how i can do that

wet breach
twin venture
#

its an armorstand , it rotate , but when i leave it stop rotate + break ..

twin venture
#

without creating huge lag?

wet breach
#

you could use NMS to override the AI stuff, but I mean why does it need to keep rotation when no one is nearby?

#

couldn't you just have a method that resets it?

twin venture
#

its not packets armorstand , normal armorstand

tardy delta
twin venture
#

so when a player click on the lootbox [armorstand] it drop an item

river oracle
#

its a meh out of 10

mighty pier
#

cum

wet breach
twin venture
mighty pier
river oracle
mighty pier
#

what that mean

wet breach
tardy delta
#

do one query to get a resultset and call your get... methods on that

wet breach
#

why is it important that it keeps rotating even if no players exists

twin venture
wet breach
#

yes

tardy delta
river oracle
twin venture
#

but will that check make it a bit laggy?

wet breach
#

would it matter if there is no players? And no most checks don't lag the server especially if they are part of events in most cases

tardy delta
river oracle
#

oh my god

#

I misread lol

twin venture
tardy delta
#

AsyncPreLoginEvent

wet breach
#

you should be using async method

#

unless there is a specific reason to use sync

mighty pier
#

is banning player good reason to use sync

#

like if player is ban

#

kick

river oracle
#

I dont' think you can kick async

#

you can't kick async*

wet breach
#

sure since you are not doing it hundreds times a second 😛

tardy delta
#

what is this supposed to do

mighty pier
#

check if player wasnt kicked pretty sure

#

stole code

#

from friend

tardy delta
#

cleaning up invalidated player instances ig?

mighty pier
#

exaclyt

wet breach
#

if you had an appropriate caching mechanism like what guava provides this is unnecessary

#

as the cache should be one that expires

river oracle
#

^ I was about to suggest guava caches

tardy delta
#

why is an userdata object aware of its player?

mighty pier
#

i dont even know what that means

tardy delta
#

feels kinda weird this

wet breach
#

basically they are saying, a manager type object or class should be the one aware of the player and doing the removing

mighty pier
#

fully stolen class

tardy delta
#

^^

wet breach
#

not the object itself that is suppose to represent the player

river oracle
wet breach
#

this ^ lmao

mighty pier
#

the one i stole the code says i suck at coding

wet breach
#

well they appear to not be much better

mighty pier
#

and asks why i dont use completable futures and other shit

river oracle
#

the one you stole the code from also sucks at coding

wet breach
#

so don't feel bad

#

odds are they stole code too

river oracle
#

lol

tardy delta
#

probably

mighty pier
#

so

tardy delta
#

third hand code

mighty pier
#

he is obsessed with optimizing performance

#

but

#

he sucks at it?

wet breach
#

apparently

mighty pier
#

ok

mighty pier
#

userdata is useless

wet breach
#

its not that, has to do with semantics being referred earlier

#

or better way to say it, Standards

#

doesn't mean you can't do it like that, just according to standards it isn't appropriate

tardy delta
#

i'm wondering why the userdata isnt put in the UserData class but in the User class and in UserData theres a random uuid->user map 🤔

#

which isnt static either

wet breach
#

don't be mentioning statics to them yet >>

tardy delta
#

what have i done 🥲

wet breach
#

they might be one of the golden few to learn appropriately without static mess 😛

tardy delta
#

and i just fucked up

#

im sorry

river oracle
#

I remember being yelled at on spigot about using static as soon as I started so I used DI straight from the start xD

wet breach
#

lol

sacred mountain
#

is there a listener for drawing back a bow?

tardy delta
#

i didnt want to use di at first cuz i saw too much 'this' lol

hasty prawn
tardy delta
#

teach 'em while theyre young

river oracle
sacred mountain
#

theres shoot bow event but i wanna do stuff before they shoot

hasty prawn
#

PlayerInteractEvent and check if they're holding a bow

mighty pier
#

can someone spoonfeed me code or explain it in simpler terms caus ei dont understand 90% of this

hasty prawn
#

Idk id there's a specific method for it

tardy delta
hasty prawn
crimson terrace
#

the interact event comes closest

wet breach
#

if you are wanting to know if they drew back the bow all the way or not there is this

sacred mountain
#

might have to use interactevent workarounds ig

river oracle
wet breach
#

well usually there isn't a need to know if they drew back a bow or not except if you wanted to know how much force

#

which the shootbow event has the method for it

sacred mountain
#

well i need

wet breach
#

but the reason there isn't a listener for it is because the client doesn't report that the player is drawing a bow back and all that

river oracle
#

if you don't understand cacheing spend some time reading up on it if you don't understand some design patterns there are plenty of resources explaining them in depth

mighty pier
#

im not very creative

#

give suggestions

wet breach
#

basic plugins are things like ban managers

#

or teleportation plugins

#

those types of plugins can start basic

mighty pier
wet breach
#

and go all the way into advanced things if you want

#

without changing what they do

tardy delta
#

ill probably make a custom items plugin

hasty prawn
#

spawn Mr Pig plugin is one of my favorites

wet breach
# mighty pier i do that in utils

while you might do that in utils, doesn't mean you have grasped the full potential a ban manager can have though. Especially when you start learning to use other systems or software with your plugin. Like using a DB with it to track banned players instead of letting the server do that

twin venture
#

Sorry for mention frostalf , what i should do with my problem with chunks?

river oracle
#

also don't go to broad just make one really good plugin that does one thing

twin venture
#

is it better to check in the runnable when i start spawning armorstand , check if the chunk is loaded then start spawning

mighty pier
#

yes

#

ill do that

wet breach
#

sqlite only works so well, if you get into the millions of objects area sqlite is going to choke on it

river oracle
mighty pier
#

i used mongo

#

everyone puked on it

#

im using swlite

river oracle
#

the thing that I think is really amazing about mongo is its java drivers they are super nice

wet breach
river oracle
#

but outside of that for your use case sqlite is fine

wet breach
#

no problem, and as per the usual come back if you get stuck again 🙂

#

can't say I will be on at that given time but I am always here and so are others to help 😄

twin venture
#

something like this?

wet breach
#

use ||

#

well I guess you could go with and

twin venture
#

alright

wet breach
#

if it was me I would use methods that just load a chunk regardless

#

this way there shouldn't be an instance of an unloaded chunk you are spawning into as well as it removes the check for that

#

then all you really need is just to check if players are nearby or even on the server

#

the methods to load a chunk do not error if the chunk is already loaded, well they do just they do so silently and don't hurt anything

twin venture
#

i see thanks for explaining again

tender shard
worldly ingot
#

Was just going to say

#

World#isChunkLoaded(x, z)

tender shard
#

whenever you do getChunk(), it will load the chunk (in a blocking way, ofc)

twin venture
tender shard
tardy delta
#

hmm refactored some things

tender shard
#

basically
chunkX = normalX / 16;
// same for Z

#

and then do World#isChunkLoaded(chunkX, chunkZ)

worldly ingot
#

Or >> 4 if you want to be fancy

tender shard
#

yeah but tbh it's the same

worldly ingot
#

I think it's marginally faster than a division too

twin venture
#

the lootboxes [armorstand ] locations will be in 1 world only ,

tardy delta
#

isnt bitwise natively implemented?

worldly ingot
#

Is it >> or <<? I always fucking forget which way to shift the bits to divide by 4 PES_CryHands

tender shard
#

yeah I also thought that >> might be faster but CPUs do these kinds of optimizations anyway so ....

#

it's pointless

#

/ 16 is more readable so I'd rather go for that

worldly ingot
#

YOU'RE POINTLESS. MY CPU CYCLES ARE IMPORTANT

tardy delta
#

4

worldly ingot
tardy delta
#

i paid for the cpu, im gonna use the whole cpu

tender shard
worldly ingot
#

Sorry... can you tell I've been learning C++ a bit more lately? lol

tardy delta
#

same lol

thorny marsh
tardy delta
#

well my course site randomly stopped

tender shard
#

idk I'm learning lua right now so I guess I'm lost