#help-development
1 messages · Page 202 of 1
might also be called shading sometimes
Mavens method of compiling dependencies into your project
Uh no
ok
i think i know what it is
i dont know how to make this a shade
<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>
is that the jdbc
Pretty sure Spigot already has an SQLite driver
when i try to do the connection
thats the thing you need for shading in general
did you call Class.forName("")?
you arfe big brainedf
is there a method for detecting if some coords are instide 2 points?
BoundingBox
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));```
I see no abstraction there
I see two commands, mod and mutechat
Yes, dependency injection
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
have you registered your event listener?
remove static
same
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
Still if that was the issue it should print "A"?
remove the static and check it
you have to parse &
i did that
if you did you would not have &c displayed
?paste the code
thats a config file not code
arent they meant to be wrapped in ""
thats true
yep
` is used for single line code blocks like this
and accents in some languages like portuguese with their á à
does any1 know a good way to find a safe location within a radius?
is there an efficient way to check if a player touches a man made guardian beam
as in not a natural thing
Is there anyway to get other plugins metadata?
you mean like Entity#getMetadata? If so, sure, they are not "sorted" by plugin or anything
The question is why do you want to do this?
So we can use metadata cross other plugins
Make an API
But
I'd rather use the Entity's PDC instead of using metadata
sure
ahha I got it!
you can also loop over all existing data so you don't really need the other plugin's instance
copypaste chorus fruit code
mfnalex wit hyour superior knoweldeg plaase help me
e.g.
for(NamespacedKey key : myEntity.getPersistentDataContainer().getKeys()) {
print("Data found from plugin " + key.getKey());
}
raycast
Depends on the server version
of you can just check the angle between start and finish
make a cuboid
declaration: package: org.bukkit, interface: World
1.19.2
and match both within the cuboid and within the angle
wouldn't this work?
it would
ill see
Start with the start location and end-start as a vector
the double will be distance(start, end)
FluidCollisionMode doesn't matter
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
would a raysize of above 0 create a cuboid ray
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
therse a collision mode in the params
^ yeah rayTrace is for both blocks and entities, if you do not care about blocks inbetween just do rayTraceEntities
if you want to look "through" blocks, use rayTraceEntities
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
try it and see
probably
no need to cast
well
ah that livingentity concept is stupid
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
currently every tick
just to check
nothing
bruh the direction is backwards
_>
hello
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
show your code
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);
}
}
}
}
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
did you register the listener? also NEVER compare strings with ==, use .equals or equalsIgnoreCase
shit i didnt
well, you should cancel death with EntityDamageByEntityEvent ideally, I don't know if this would work at all
check if the damage is fatal and set it to 0
oh btw do not name the class "DeathEvent" but rather "DeathListener"
this is probably what you're looking for
is an external class
thanks
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I really disagree with whoever wrote this
Static on the other hand is not object-oriented
ughm that's not true, you just have to realize that classes are objects too
one of the lasers, or only one of the players gets damage?
because ofc the raytrace will always only return the first entity that's hit
people still instantiating bukkitrunnables for no reason smh
hm then no idea. do some debugging, maybe you again have the direction fucked up, or sth?
ight
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.
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
nah spigot is smart
lookin' hot
I mean, its fun that kotlin (also jvm based) removed static keyword for the same reason
but they added singleton object class
that can act as utility class for instance
kotlin is quite funny anyway
i cannot think of any reason why it would be better than java
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
yeah there is no difference in any case, i just like to do for example "&4ban".colorize() insted of colorize("&4ban)
there is also inlining functions
but who cares anyway
¯_(ツ)_/¯
hm yeah then they are pretty useless. I mean, sure, nice idea, but nothing that would make anyone think "yeah kotlin is so much better"
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
grew up doing java gang
pretty sure I first started coding in C# when I was 6
then moved onto C
my current thing is to properly learn lua and it's annoooooyyyyiiing
but wasn't a fan
personally I believe kotlin is too bloated
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
okay that sounds like a wtf moment
skript momento
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
I only dislike it because it's "different" from java
Yeah that was true in my case too, tbh its matter of personal preference like nearly anything
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
looks like those bootleg programming languages that are a pascal clone
that they use to teach programming at schools
yeah lol
looking like mfing
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();
}
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
oh yeah we also did our exams in coding with pen & paper
but nobody cared about a missing " or ;
it was more like "pseudo code"
yeah we had that too D:
And there was an IDE after like 3 months
that froze whenever you had an infinite loop
and had no autosave
but I guess it makes sense if you're a beginner because otherwise, the coding exam would fail everyone who's bad in english
the thing is
How to create an ItemStack Collection? I can't find anything about it
what kind of collection?
Usually you just do new ArrayList<> or whatever
since like the 2nd grade
List<ItemStack> myListOfItemStacks = new ArrayList<>();
country-wide
deque
linkedlist
HashTable
that's also not a collection
fuck
Set<Map.Entry<ItemStack, Object>>
I call this "reddit"
reddit not only pron
that's useless, reddit has more porn than PH
so mfs in my class just watched porn subreddits
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
and I sent you an example above
why dont they do it at home like the rest of us
a List is a Collection
bluegem is the polar opposite of most beginners asking for help
he knows the concepts but no execution
i watched a spigot tutorial before a java tutorial
learned java and spigot at once
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
i forced my friend to learn java for 2 years and then i asked him to help me with that
Yea lol the spigot tuts before Java is accurate asf
is there a chance that listeners might fail to register? if yes what do they throw
just wondering
If you have an exception on your constructor...
they throw a kitten at the wall
but the registering process itself is flawless
gotchu
ofc, for example if you have a method like this:
@EventHandler
public void doSomething(BlockBReakEvent event, String someUnexpectedParameter)
or yeah if you have something stupid like that
i dont remember by heart what it throws but you can check the SImplePluginManager class to find out
o
oops wrong method
declaration: package: org.bukkit.plugin, class: SimplePluginManager
IllegalPluginAccessException - if the plugin is null or disabled, or if you're listening to an event that doesn't have a static getHandlerList method
ok ok
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?
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
there isn't, it's just a warning
thank
oh ok
yeah
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
if that condition is true it isn't going to check the next condition because of the or afaik
what is the garbage collector?
it removes your terrible code
map is part too
oh right I mean false
if(int i = 2 == 2) ...
is the same as
int i = 2;
if(i == 2) ...
why not just if (2 == 2) hehe
because it was an example
a real life example would be sth like this
while((line = reader.nextLine()) != null) {
// do sth with line
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?
yes, because && is lazy
if you'D use &, then i would always be 3
ah
firstMethod() && secondMethod()
secondMethod() would only run when firstMethod() is true
if you'd use & instead &&, both would always run
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.
bro you look like a gigachad
owo I heard femboy?
you can look differently at different times, you know 😄
even more male than me
I don't go full femboy when I'm going to the store, for example, lol
oh
haste
imagine mfnalex be femboy
easy
This makes the hand movement fast ):
some feminine clothes + makeup and a bit of alcohol, done
true
after
Not the place for this
no, I look like myself
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
dilemma
do you use any weird stuff like Iris or Sodium?
client issue
sounds like YOU problem
might also be cuz of render distance
maybe you are too far, and entity is moving
oh ok
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
how can i get the text line data ?
what
explain yourself
yeah obviously, that's the HashCode of that object
and how i pick a static name
if (e.getEntity().getLastDamageCause() == DamageCause.YOUR_MOMS_DOOR_SLAM) {}```
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent, enum: DamageCause
...
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
so much boilerplate code
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
thats some nice combination of naming conventions there
can you set the color of a guardian beaem
and it has inverted naming conventions lol
i know you can call a packet to make the client change it but thats randomized
But, can you help me with it? I'll rewrite it later, but first i want it to work xd
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...
.
tbh naming conventions become a joke when it's different for every language lol
oh, right xd
lua is good in mixing UpperCamelCase and lowerCamelCase and also uses . and : and sometimes you also have snake_camel_case
@zealous osprey @last temple EntityBlockFormEvent doesn't get fired when you prime a TNT.
i hate languages that use like begin and end, whats wrong with {}
PascalABC enters the conversation...
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
waitwhat
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
% 10
int paramToGet = 21;
return list.get(paramToGet >= list.size()? 0 : paramToGet);```
21 %10 = 1
first is 0 tho
Dont worry about whats shorter but rather about whats more readable
not 1
no needs for the ter, literally list.get(length %(list.size))
right yes
what does the ? mean
good poitn
Its called the „unary operator“, just google it
ternary operator
Eg String name = someCondition ? „Yes“ : „no“
Oh yeah
efficient method right there
int result = statementIsTrue? 1/*if-true*/ : 0/*if-false*/;```
it will be useful
boolean isTrue = true ? true : false;
(efficient)
If someaCondition is true, name will be yes, otherwise no
well this thing is readable
what is the % called
String myString;
if (condition) {
myString = "Yes";
} else {
myString = "No";
}
String myString = condition ? "Yes" : "No"
same
moduo
ah so
modulo isn't it
modulus, modulo
probably, i said it how we say in serbia 😄
in pascal it's pascal mod
yes
makes sense
5%2 = 1
0%0
Exception
wait so you would do 5/2 and then get the what
wjats the remainder
that's like
5 / 2 = 2 and 1 that cant be divided
catch (Exception e) is true programming
k thanks
5 - 2 = 3
3 - 2 = 1
1 < 3, so result is 1
didnt you have math classes lol
5 % 2 = 1
8th grade
same goes for 5 % 3
no modular yet
5 - 3 = 2
2 < 3, so result is 2
damn I learnt that in 3rd grade 😄
same
math was hardest in 2nd university grade
depends on who you ask 😄
does Location#distance() give the displacement
it gives distance
the direction as the crow flies distance
x % y is the same as x / y - (x/y as int, rounded down) * y
No, it gives scalar distance.
just literal distance
e.g. 5 / 2 = 2.5, 5 / 2 as int is 2, so 5 / 2 - 2*0.5 is 1
you can travel across the vector between two players
and you will run same amount of blocks
as what #distance() returns
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
minecraft's gravitational field is a lot stronger than earths damn
lol, not 9.81 blocks/s^2 ? 😄
nah
27
falling sand entity is just OP
fr
god-blessed entity
seeking missile
already coded that
i have a new idea
Anybody watched Marvel's Guardians of the galaxy?
I hated that movie, it was so ridiculous and boring. BUUUUT
the soundtrack is great
there was a blue guy
with arrow
he whistled to control it
arrow was flying and killing people by itself
when I open youtube, Guardians is right there
Описание: все в сборе: землянин Питер Квилл (Звездный Лорд), молчаливый громила Дракс, зелено-кожая наемница Гамора, живое дерево Грут и говорящий енот. Герои не изменяют себе и с завидной регулярностью продолжают попадать в немыслимые ситуации, выпутываясь из них почти без ущерба (а иногда даже с пользой) для окружающих. На этот раз им предстои...
requires packets IIRC
what is this ?
you can't
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
i mean if there is a way to do it
if you use Math.abs then it MUST be positive
there is no getRenameText() in AnvilInventory
🙂
Bukkit.createInventory(null, InventoryType.ANVIL); is NOT instant of AnvilInventory
bru hwath
even its type is ANVIL
and when you open it
you have anvil menu
I had the 1.8 docs open D:
im using the distance between 2 points as a speed regulator, so i'm putting the distance as the ticks
sad
the error is saying the ticks cant be negative
sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)
use math^
but i cant get the RenameText out of it
so when you try casting inv to AnvilInventory you get Exception?
why not?
show your error
FREE LUA LESSONS
Free PascalABC lessons
anyone knows why intellij is SO SLOW with gradle
then its cring
ahhh theres your mistake use maven
😂 who knows try invalidating caches or something usually that fixes intellij shit
even getMethod() return no method :L
java.lang.IllegalArgumentException: Ticks must be a positive value bruh
print everything
maybe ticks need to be integer
actually it was from InventoryClickEvent
yeah when you click it's always craftinventorycustom
but still
code ?
i may be really stupid
try {
somethingNew();
} catch (TrapAssertionError err) {
// traps aren't gay
}
no idea how to deal with this :L
i'm thinking
Hi, is there any way to programming something likes this? https://prnt.sc/ALcQ9fnt9H5v - thanks in advance
sure, but it requires NMS
Was going to say, distance can definitely be 0.x, which would get truncated to 0
ok and then? :9
I made this for my JeffLib, I'll send links in a minute
Ok, would find that really nice
no idea what is this
"core" class: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/ToastMessage.java
example code for 1.19.2: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_19_2_R1/src/main/java/com/jeff_media/jefflib/internal/nms/v1_19_2_R1/NMSHandler.java#L353
@crimson vault
basically you need to create a fake advancement, then grant it to the player
Ok thank you 🙂
or you just use my existing jefflib thing but it's like 300kb in total 😛
I'll try it
feel free to copy paste everything you need
idk?
not loading for me
everything works for me
:/
yikes okay I'm at 550kb
Spigot should really integrate something like this into the API
can't you just use sendAdvancement
everyone's free to pull request
yea they should alex come on do us a favor
I wonder why they haven't done it yet.
I wonder why YOU haven't PRed it yet 😛
don't worry I'll start committing to spigot next year guys
I can do?
my 18th birthday present to spigot is my contributions
that's what I also said 2 years ago. Now, I actually did contribute many times, but everything was just javadoc fixes lmao
where?
there you can clone spigot and bukkit, add your additions, then PR them
ohh nicee
(you need to sign a CLA though)
what is hte CLA again just "You don't own this code"
but you can do that online
Ok
basically, yeah
thanks
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
I prefer to use the whole Jeff Liberay instead of copying that
sure, dependency information is in the README file
this mfnalex dude seems to be obsessed with OfflinePlayerPersistentDataContainers
damn thats possible?
thats cool
haha thanks. It's basically just stuff that I need in all of my plugins
If I want to get the distance from two different locations using location.distance, is the value in block length?
respect respect :d
sure with NMS you can just read the player's .dat file (MojangsonParser or whatever it's called)
surprisingly difficult to format that stuff
The value is a double representing the distance in blocks between the two locations, yes
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
depends what is returned. If a double is returned no not quite as it can have decimal. If its an int, yes it would be.
doubles don't represent block length, since blocks are whole numbers not fractions
I thought a block is considered a meter, so can’t it be considered that a fraction of a block is a fraction of a meter
PrepareAnvilEvent only work for non-virtual anvil :<
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
Virtual Anvils are scuffed honestly most virtual inventories are scuffed outside of chests and dispesners
use MATH
yes
1 block = 1 meter = 1 unit
but the distance() is diagonal
help
because villagers do not pick up random items
villagers can pickup items?
they can pickup edible stuff and seeds etc
but usually nothing else
you can make them your slaves
i give then seed
then also they don't pick
e.g. you have a dispenser that throws wheat seeds at them, then they go replant your farm
typically when measuring by block lengths you do so by whole blocks, not fraction of a block, so while true not quite accurate either.
their inventories are full maybe ?
i spawned villager
then their inventory is maybe already full?
1 is a full block
0.1 is 1/10 of the full block
I am aware of this and there is methods to return only whole numbers IE ints.
i spawned the villager from egg, breeding
then also they don't pick up seed
so if you wanted just block length you do so by whole numbers not by fractions
are they farmers :l?
I guess you fail at understanding
any dev here ?
oh you mean distance method itself
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
.
How do I fix
Required: object. Actual: string.
In command permissions and permission messages in a gradle plugin.yml
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
which is meaningless for other methods that axe off the fraction anyways 😛
and 333.444 Z
can anyone help me
when you do distance you basically do
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
What am I doing wrong here? I followed the guide on spigotmc
how about you show some of your code
at least the bit where it shows that error
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 */)```
permission: customenchants.customenchant
permission-message: You do not have permission to use this command
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
a screenshot would do nicely comet
I am not saying you can't measure blocks with fractions
you are just not understanding the two different measurements
The attach button doesn't work
verify
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
this numbers in formuals are from minecraft absolute minimal length
How can I get the player's version in a PlayerJoinEvent?
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
hi , how i can keep the chunk loaded?
after player leave the server?
i mean for entites?
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.
it's diagonal of a rectangle
a diagonal is about what 1/3 larger then a blocks length?
if I remember right from math
youre trying to make a command with a permission?
🤔 sooo how i can keep the chunk loaded?
i guess you cancel chunkunloadevent
yes a command that requires a permission to be ran
cancel the event if its a chunk you don't want unloaded using chunkunloadevent
that doesn't keep something loaded, that tells the server to load it anyway you can
you dont do that in the plugin.yml. you check the player who runs the command for Player#hasPermission() (usually)
ok
so well @wet breach
just so we are on the same page, I am not disputing you can measure blocks via fractions lmao
Oh ok, the guide i saw on spigotmc said to set it in the plugin.yml, do i still define the command in the plugin.yml just without the permission?
we are talking about what distance() returns
just when someone is asking about measurement being in block lengths typically they mean by whole blocks
pfff I don't even use my plugin.yml
its possible but if its not working just use the other way.
it basically diagonal of the rectangle
where each point has format number.3numbers
123123.000
also maybe try using a Command framework like ACF... its a bit to read into but definitely keeps your code cleaner
https://github.com/frandma/Utils rate plugin
so if distance returns 1 then you have 1 full block between you 🙂
or 1 meter
or 1 default unit
or 16 pixels
well the problem is when i leave the server the entity stop working like it suppose to be
and for 1.3 you have one full block plus one third of the block(or meters or units(or 16 * units PIXELS))
i dont want to remove it after i leave , i want to keep it working
or 1.3 units
yes because even if the entity is still there, the server requires a player to be on the server for it to keep doing stuff. Not only does the chunk need to be loaded but a player needs to be nearby as well
its an armorstand , it rotate , but when i leave it stop rotate + break ..
is there a work around?
without creating huge lag?
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?
its not packets armorstand , normal armorstand
doing 5 queries 💀
so when a player click on the lootbox [armorstand] it drop an item
its a meh out of 10
cum
ok, doesn't change my response
do you want to join my test server to see what i mean?
what do id o then
I bet they aren't being done async either
what that mean
or you could answer why it needs to continue doing something with no one nearby
do one query to get a resultset and call your get... methods on that
why is it important that it keeps rotating even if no players exists
is it possible to make it stop spawning / rotating , and only do that if player exist?
yes
nope
afaik PlayerPreLoginEvent isn't async either so its being queried on the main thread. So not only does it query 5 times it halts the main thread
but will that check make it a bit laggy?
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
explain in english terms
why are you talking bout sync event and showing me an image of an async event?
alright thanks for answering i sent you the server ip , if you like to join and see what i mean ..
AsyncPreLoginEvent
sure since you are not doing it hundreds times a second 😛
what is this supposed to do
cleaning up invalidated player instances ig?
exaclyt
if you had an appropriate caching mechanism like what guava provides this is unnecessary
as the cache should be one that expires
^ I was about to suggest guava caches
why is an userdata object aware of its player?
i dont even know what that means
feels kinda weird this
basically they are saying, a manager type object or class should be the one aware of the player and doing the removing
fully stolen class
^^
not the object itself that is suppose to represent the player
steal from someone who has higher quality code
this ^ lmao
the one i stole the code says i suck at coding
well they appear to not be much better
and asks why i dont use completable futures and other shit
the one you stole the code from also sucks at coding
lol
probably
so
third hand code
apparently
ok
so only one user class
userdata is useless
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
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
don't be mentioning statics to them yet >>
what have i done 🥲
they might be one of the golden few to learn appropriately without static mess 😛
I remember being yelled at on spigot about using static as soon as I started so I used DI straight from the start xD
lol
is there a listener for drawing back a bow?
i didnt want to use di at first cuz i saw too much 'this' lol
Gotta fix it when they're young
teach 'em while theyre young
me now appreciates it even if I didn't when I started a year and a half ago
theres shoot bow event but i wanna do stuff before they shoot
PlayerInteractEvent and check if they're holding a bow
can someone spoonfeed me code or explain it in simpler terms caus ei dont understand 90% of this
Idk id there's a specific method for it
bruh

no
the interact event comes closest
if you are wanting to know if they drew back the bow all the way or not there is this
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityShootBowEvent.html#getForce()
declaration: package: org.bukkit.event.entity, class: EntityShootBowEvent
basically you are in way above your head tone down your projects a bit if you got no clue whats going on and teach yourself some basics alongside doing basic plugins
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
well i need
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
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
what are basic plugins
im not very creative
give suggestions
basic plugins are things like ban managers
or teleportation plugins
those types of plugins can start basic
i do that in utils
ill probably make a custom items plugin
spawn Mr Pig plugin is one of my favorites
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
Sorry for mention frostalf , what i should do with my problem with chunks?
sqlite in utils
also don't go to broad just make one really good plugin that does one thing
is it better to check in the runnable when i start spawning armorstand , check if the chunk is loaded then start spawning
.
sqlite only works so well, if you get into the millions of objects area sqlite is going to choke on it
imagine not using mongo 😂 (I'm using sqlite rn 😢 )
the thing that I think is really amazing about mongo is its java drivers they are super nice
you should always be checking if the chunk is loaded. Can't spawn entities in an unloaded one, second check if there is players nearby or even on the server otherwise why have your server consume resources for no one? lmao
but outside of that for your use case sqlite is fine
alright thanks
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 😄
something like this?
alright
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
i see thanks for explaining again
getChunk() will always load the chunk, so the whole thing is pointless
whenever you do getChunk(), it will load the chunk (in a blocking way, ofc)
what i can do then? the problem is kind of weird
yep! I learnt that the hard way lmao
hmm refactored some things
what Choco said
basically
chunkX = normalX / 16;
// same for Z
and then do World#isChunkLoaded(chunkX, chunkZ)
Or >> 4 if you want to be fancy
yeah but tbh it's the same
I think it's marginally faster than a division too
the lootboxes [armorstand ] locations will be in 1 world only ,
isnt bitwise natively implemented?
Is it >> or <<? I always fucking forget which way to shift the bits to divide by 4 
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
YOU'RE POINTLESS. MY CPU CYCLES ARE IMPORTANT
4

i paid for the cpu, im gonna use the whole cpu
THATS WHAT SHE SAID
Sorry... can you tell I've been learning C++ a bit more lately? lol
same lol
thx
well my course site randomly stopped
idk I'm learning lua right now so I guess I'm lost