#development
1 messages · Page 99 of 1
So what should I use?
return true
@strange remnant replace all your return falses with return trues the purpose of return false is in case they used it incorrectly you can fast send the correct usage kinda redundant
for (Player player : Bukkit.getOnlinePlayers()) {
if (!(p.hasPermission("flipsmc.sc")));
player.sendMessage(mess);
return false;
}
And for this you need to use continue if they don’t have the permission and continue also if they do
No return!
Any questions please lmk
what in the is that code
Anyone got experience in the luck perms api, i can't see to find on how to remove all parent groups from a player if they match my filter
How would i remove that group from the player?
https://img.olziedev.com/iN551mkpR551555511ci.png like this maybe
public static List<String> getUserGroups(String player) {
ArrayList<String> groups = new ArrayList<>();
net.luckperms.api.model.user.User user = plugin.api.getUserManager().getUser(player);
if (user == null) return new ArrayList<>(Collections.singleton("null"));
for (Node group : user.getNodes(NodeType.INHERITANCE)) {
groups.add(group.getKey());
}
return groups;
}
with this you can find all groups that user has
if you change it a bit you can make it remove group from user
Take a look into the NodeMap.clear(Predicate) method
you can do something like```java
user.data().clear(NodeType.INHERITANCE.predicate(inheritanceNode -> {
// your filter
}))
btw you can get the User in other ways;
UserManager#modifyUser(UUID, Consumer<User>) will load it and save it after running the function you pass to it
If you have a Player you can use the PlayerAdapter (LuckPerms#getPlayerAdapter) to simply convert a Player into a User (or get other kinds of cached data)
how come?
Why can't i use these imports?
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity;
import net.minecraft.server.v1_12_R1.EntityInsentient;
it cant find craftbukkit & minecraft
it is NMS
If you want to use NMS, then you have to install the NMS into your local repo
whats nms?
where can i download those file to put in my plugin?
I must be doing something wrong, but when using the AutoSellAPI ```Multiplier multiplier = AutoSellAPI.getMultiplier(e.getPlayer());
returns null
In general, is it good practice to ALWAYS have a priority level next to an event handler?
no
next?
Oh
parameter
Well probably personal preference
maybe
I mean
but it adds extra verbosity
Yeahh sure but
its also like doing ignoreCancelled = false
If I got a pretty big plugin
Which has multiple classes handling the same event in different ways, then it's a good idea to give them different priorities
To make sure things run as I expect them to
Nah that'd be way too messy
And then have x amount of observers which you invoke in that event handler
what i do is have a class ex PlayerJoinListener and have the actual listener handling in there
I don't want one event handler to handle 4 different things related to how arrows behave when they hit an entity
Assuming it’s the same priority and same ignoreCancelled state
Ah I have different listeners based on what they handle
I mean given what I said, you don’t necessarily need to register 4 event handlers
so like ```java
@EventHandler
private void onJoin(PlayerJoinEvent event) {
someAction(event);
sendWelcome(event);
}
private void sendAction(PLayerJoinEvent event) {
// ...
}
¯_(ツ)_/¯
So EntityListener, ItemListener, WeaponListener (for some stuff in my plugin), InventoryListener, MiscListener
You could diminish the amount to 1 and then have something like dkim or like an array of Consumers with that event type
Oh
And I probably won't until I got more time in my hands
These days I got time to just do small changes to my plugin, not big refactors that may take a few hours but yeah I need to look into those
How can i check if an hook exist?
what hook?
You look at your bedroom door
and try to find a hook behind the door
if there isnt one, you can't hang your clothes
is there any problem into having multiple methods registered for the same event?
No not at all
Just if they all happen to be with the same priority and ignoreCancelled state, why not just use one direct Bukkit event handler and then delegate?
I see, well, yes, I have already done both ways
Yeah, I usually do it due to the reflection (invocation) overhead which is usually negligible but yeah
this is what i do too xD
High level!
I’ve tried ext funcs with Lombok and that was quite nice and hella confusing
I almost thought you were going towards "hooker" instead of a "hook"
it feels super good to be able to use the class properties as if you were inside itkt private fun InfernalDeathEvent.dropMobLoots() { // 'infernalType' is a property of InfernalDeathEvent // 'world' and 'entity' too infernalType.getLoots().forEach { world.dropItemNaturally(entity.location, it) } }
Hmm yeah
I really don’t know what’s best
Just using a static method where you take the instance as an argument
Or that
Extensions are probably the better way to go in kt
Yeah, but just generally?
Yes
could you provide a brief example of this?
Not sure if there will be any proper answer if we disregard language
Hmm yeah language is probably playing a major role in it
Extensions here would serve the same purpose as the static functions except making it easier to see where its invokable
Ah true
hook up with people!
static void dropMobLoots(InfernalDeathEvent event) {
//do stuff here
}
Then we would just call dropMobLoots(event)
but this way we would have to use event. before the properties, right?
but why static though? would this method be on the same class as the listener?
Yeah well if it doesn’t require any variables from the listener instance (or methods)
Then why not make it static
- invokestatic is supposed to be a little bit faster than invokevirtual (if we made it an private instance method for example)
sure, in Java, why not, but I'm usually lazy a bit careful with static cause sometimes it might throw the reader off a bit (or at least I get thrown a bit sometimes by it)
If you get thrown of by it, you can use the class name before invocation like
ListenerClass.dropMobLoots(event);
That has to be like the smallest of differences lol
im i high or when i press k it wont work
for i in range(360):
# setting pace with a modulus
if keyboard.on_press_key == "k":
print("test")
break
if i%6==0:
pyautogui.moveTo(X+Rmath.cos(math.radians(i)),Y+Rmath.sin(math.radians(i)))
where tf is my key
omg
this keyboard dont have it
i cant do the three keys
`
`
`
`
`
`
Is there a way to present an api in a api (third party dependency in my api) without shading it?
Maven or gradle?
Gradle
Thank god
The API module/project would use the java-library plugin instead of java, and the exposed dependencies you'd include as api/compileOnlyApi as opposed to implementation/compileOnly
The "internal" dependencies would stay as implementation/compileOnly
Anyway goodnight uwu~~\✨
Thanks and gn!
Maven vs gradle pros and cons?
Besides length of the build script
compilation speed of gradle is above maven's for example
Gradle is more configurable without the need of plugins
(Which in itself takes time to write from my experience)
As someone who recently moved from Maven to Gradle, Gradle is insanely faster
So would it be worth my time to learn to use gradle
Hm aight
I was a maven fanboy for ages, but can’t lie Gradle is pretty nice
And fast to compile
I won’t ever go to that Kotlin crap though
Any downsides/things to know about or watch out for when switching?
With your current maven script, what do you use? Just dependencies?
If you’ve got something complex like a full on task, then a bit harder
If you’re just compiling against spigot for example isn’t too bad
Default build script made by Minecraft plugin and yeah dependencies/repos
Then you’re good to go, next level up would be shading libraries and relocating, which isn’t that complex once you get your head round it
I recently started moving projects to Gradle
Got many projects to go yet tho 😅😅
The only problem I’ve encountered is sometimes when IntelliJ struggles a bit with the integration although using the kotlin DSL fixed that as opposed to groovy DSL regarding build scripts
gradle > maven for speed @cerulean birch
and it's 10x easier
and it's way more configurable
I mean maven isn’t harder than gradle necessarily
I find it a bit more harder
Idk I mean they’re arguably at the same difficulty level, though for sure gradle is more concise.
Yeah maven is more in huge blocks, Gradle is more condensed
Alright this is I guess a bit of a stretch
I got this default method in my interface, which I want to return a different class based on the provided parameter
default SoulState getSoulStateIfPresent(SoulStateType type) {
switch (type) {
case MARKED -> {
return (Marked) getCurrentSoulStates().getOrDefault(type, null);
}
case DAZZLED -> {
return (Dazzled) getCurrentSoulStates().getOrDefault(type, null);
}
case HASTED -> {
return (Hasted) getCurrentSoulStates().getOrDefault(type, null);
}
default -> {
return null;
}
}
}```
I have no idea how to have it return `Marked`, `Hasted` or `Dazzled` based on the `SoulStateType`
Do I need some wildcard? Or a generic?
Is it like this...?
default <T extends SoulState> T getSoulStateIfPresent(SoulStateType type) {
return (T) getCurrentSoulStates().get(type);
}```
I am getting a warning about an unchecked cast though
you really shouldnt be making this a default method in your interface
it kind of defeats the purpose of the interface cause its implementation specific
Oh yeah that makes sense
the point of interfaces is to try and generify stuff. By adding that switch statement for implementation specific method it gets rid of that generality
so its bad
cause anything should be able to implement the interface
Do I not need to declare a generic next to my class name
I just pasted this method to my SoulStateType enum class and it works fine for the most part
So this:
public static <T extends SoulState> T getSoulStateIfPresent(Soul soul, SoulStateType type) {
return soul.getCurrentSoulStates().containsKey(type) ? (T) soul.getCurrentSoulStates().get(type) : null;
}``` just as a static method in my enum class
is better to use get and do a null check instead of containsKey and get
because that's basically what containsKey does
or just literally only do soul.getCurrentSoulStates().get(type)
lmfao
no need to check
as soul.getCurrentSoulStates().get(type) will already return null if key doesnt exist
not sure how casting null works but sure
Yeah that's the thing, casting null seems sus
thy { , } and return ?
why*
Am I right to assume that the constructor and the getters are completely redundant here?
I can basically remove the whole body of the class and just use possibleDrops() instead of getPossibleDrops() when working with the object?
public record CustomDropSet(Integer xp, Map<CustomDrop, Float> possibleDrops) {
public CustomDropSet(Integer xp, Map<CustomDrop, Float> possibleDrops) {
this.xp = xp;
this.possibleDrops = possibleDrops;
}
public Integer getXp() { return xp; }
public Map<CustomDrop, Float> getPossibleDrops() { return possibleDrops; }
}
Makes the scope more explicit probably
But it’s preference at most
absolutely, yes
Also FYI record classes are meant to be "immutable data carriers"; that means that, ideally, none of its components should be mutable too
Basically: the record type is the data, so the map should not be modifiable, it just holds data (also you can just use int lol)
Hi, I've an issue with registering a custom placeholder.
I have this in my main class:
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")){
PlaceholderAPI.registerPlaceholderHook(this, new PluginPlaceholders());
}```
And it says the following in the console:
```XML
[17:10:07 INFO]: [TAB] Expansion BedWars is used but not installed. Installing!
[17:10:07 INFO]: Failed to find an expansion named: BedWars```
How can i fix this?
I'm assuming you're using your own expansion in TAB?
You might need to add TAB as loadbefore in your plugin.yml
To ensure your plugin, well, loads before tab
Nope, didn't work.
Thanks for your reply 🙂 I believe I'm using the record correctly. I set the data when I'm initializing it, but I'm not modifying it afterwards, I'm just using getters to work with the data.
The Integer is nullable, that's why I'm using the object as opposed to just int. I actually have it annotated with @Nullable in my code, but I simplified it a bit because I didn't want to post huge ass code block in here 😄
new PluginPlaceholders().register()
isn't a function
Check the papi wiki to register the expansion, I can't give it to you I'm in my phone rn
@vale spindle
barry said no
I have counter a issue. When download a project from github change one method and push it to github it take whole class (it first remove all methods and imports and add that back). Only happens when push that class first time. Even if I only change one method or add 1 space.
I am getting these errors trying to send a message through the "Bungeecord" messaging channel. https://paste.helpch.at/yudiqiteni.sql
So im trying to teleport the player to a location but im getting
@odd prawn Change the .get to .getDouble for yaw and pitch
remove the extends main
Do I have the change thew Float to Double too?
Then my HashMap wont work
Float yaw = (Float) cfg.get("Spawn.Yaw");
Float pitch = (Float) cfg.get("Spawn.Pitch");
to
Float yaw = (Float) cfg.getDouble("Spawn.Yaw");
Float pitch = (Float) cfg.getDouble("Spawn.Pitch");
I am trying to get all servers on the network through "GetServers"
it will
It gives an error
Red underlines, doesn't work.
show ur code
In my eclipse
Me or him 😅
Hey everyone 👋
I'm having some trouble with Gradle building a plugin. I've tried searching the issue online, but to no avail.
FAILURE: Build failed with an exception.
* What went wrong:
Could not find spigot-api-1.17.1-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT:20211030.233838-4).
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.17.1-R0.1-SNAPSHOT/spigot-api-1.17.1-R0.1-20211030.233838-4.jar
As I understand this is typically a failure to find the specified dependency in the maven repo. I've went ahead and added these guys to the repositories section. No change in build result.
repositories {
mavenCentral() // Added
mavenLocal()// Added
maven { url = "https://dl.cloudsmith.io/public/arcane/archive/maven/" }
maven { url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } // Added
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' } // Added
maven { url = 'https://oss.sonatype.org/content/repositories/central' } // Added
}```
What should I try next? I keep searching things but at this point I feel like I'm not going anywhere. This is a nearly unmodified public repo btw, in case anyone wants to take a look: https://github.com/VolmitSoftware/Iris
@strange remnant Make something in your main like
public static Main instance;
public static Main getInstance() {
return instance;
}
then you can go in your Freeze class and change the plugin.frozenPlayers to Main.getInstance().frozenPlayers
you
I'm not particularly familiar with Gradle. Might be doing something glaringly stupid and obvious.
this.getCommand("freeze").setExecutor(new Freeze());
This gives me an error now
for idk what reason
?di
Dependency Injection
Dependency Injection is a way of providing objects with the objects they need ("dependencies"). This is usually done with a constructor, but can also be done for individual methods
Read more here: https://en.m.wikipedia.org/wiki/Dependency_injection
Dependency Injection in Java:
https://paste.helpch.at/yijawupoju.java
Dependency Injection in Kotlin:
https://paste.helpch.at/esogakutod.kt
Show your command class
I didn't make an command class
I’d suggest you all learn this rather than static public variables
You can see what I mean with the dependency injection part above
I do know this, just wanted to help him quicker
was easier to type on phone
^ three things even easier
Alright, but thanks for the info for him and also me
Also sorry if it sounds harsh just a pet peeve of mine
naah all good haha, i appreciate that, would have needed that type of persons when i started to learn to code haha
Main:
Is this good?
Thanks for all the help this time
I fixed it all myself 😉
`` Main plugin;
public Freeze(Main freeze) {
plugin = freeze;
}``
This was the only problem
Yeah that looks like dependency injection so good
this.plugin = freeze
🤢
who?
u
^ wrong name but it’s technically fine
Hate all you want but I still fixed myself?
I am a beginner so don't judge lmao
(unless u meant this.plugin = plugin with plugin being a parameter)
although again thats also preference
I assume that’s what he meant
Technically it’s more logical, but it’s just a variable name
also in the future u should ask the question/error since thats prob why no one responded
¯_(ツ)_/¯
I just use he cause I’m old
If I offend you I apologise. But it’s not done with ill intention
im just fucking around, i didnt mean that
smh
then open your mouth and don't just ignore it
tf
i just saw ur message
this dude lmao
Developers are lazy what can I say
and we all apparently switched to the development channel at the same time xD
pastes his code without any problem description
Indeed
first you want to laugh at it. And now you want to be the good guy with next time give us the error, If you scroll up I gave the error but nvm dude
It’s fine we were all beginners once. As for your code I can’t fully assess it but from that snippet you seemed to have read what I asked the bot to send.
first you want to laugh at it.
And now you want to be the good guy with next time give us the error, If you scroll up I gave the error but nvm dude
well sorry, I didn't see that as again, I wasn't looking in #development as long as Jerry was
You probably want to reformat that code a bit 🍉
For instance generally all the fields should be above constructors and methods
this is what i would see
- none of your messages besides the one with the code
- other people
- your message not in a reply
conclusion: you're not in a conversation
sorry that I didn't see it, mb
Yeah should probably consider a refactor there
and if I saw it before you sent the "i fixed it" message, I would have asked for the error
Dkim I think he heard you
ok he is probably new here
It’s okay dkim I understand why you got confused so I presume he has also now
dont be rude dkim, we all have our hard days or smth, just chill
I stopped talking cus i didn't want to go further with this conversation but you can't stop talking for a reason dude
boyss just stop it
Anyways Flips, dkim is nice if you just get to know him (: I promise
Sleep tight and good night
😋 ✨ ✨
Anyhoo, some tips for your next project or you can refractor like conclure suggested.
- Try and avoid naming your main class main (it’s messy when you start working with dependencies)
- Try and use getters and setters as your public variable accessors and keep the variable itself private.
- Try to keep up Dependency Injection it will help you out a lot in the long term
I know the Main class thing because of an video "Why you shouldn't name your Main class Main"
And from my time in this discord if someone doesn’t smack me in the first minute my advice was probably not awful
I mean a spigot thing
I’d consider MainPlugin doable, but yeah Main is probably a bit too ambiguous of a name for a plugin
Wdym private
So an example would be your freezePlayers map
The problem is It's my first small big plugin with multiple classes
And really learning
so Main was just easy
Yeah, keep fighting (:
Instead of having that variable public instead have it private and create some getters and setters to modify it.
Example:
private List<UUID> playersIds = new ArrayList<>();
public List<UUID> getPlayerIds() {
return playerIds
}
Done on phone so don’t smack me too hard guys
ex in java public HashMap<Player, Location> frozenPlayers = new HashMap<>(); the variable is public - which means that you can do plugin.frozenPlayers (accessing the variable directly)
a better way would be ```java
private HashMap<Player, Location> frozenPlayers = new HashMap<>();
public HashMap<Player, Location> getFrozenPlayers() { // a getter method
return frozenPlayers;
}
```which you would have to do plugin.getFrozenPlayers() instead (and since frozenPlayers is private, if you try doing plugin.frozenPlayers, it'll error out)
an example from the spigot api would be Bukkit.getWorlds() instead of Bukkit.worlds
I just read a small explanation about Private and Public
It's just basically Private cannot access other classes in the same package
and public can
that is it right?
so the public HashMap<Player, Location> getFrozenPlayers() { return frozenPlayers;
is actually calling for the HashMap frozenPlayers
yes
Wait can you copy that message and send me that privately?
this one?
Yes so I can read threw that if I need it
sure
Should I test myself tomorrow and send you the end result of that?
Because it's a bit late today for me
yea :)
Ok I will if I have enough time to go on my pc a lot of tests this week and learning Java.
Is a lot to do at the same time
private and public doesn't have to do with packages (although if you don't put any modifier then it's package private I think - which is what you might be finding out about)
private means that it can't be accessed from any other classes - packages don't matter with private
public is correct - for example if getWorlds() in Bukkit.getWorlds() was private, then it would error when you tried to do Bukkit.getWorlds(), since Bukkit is a different class than what you're calling it from
and if you don't want to read all that xD:
tldr: you got it correct except private means cannot access from any other class, not just from package
but if I make it a private HashMap it needs another line to call that HashMap and that needs to be public so it can be accessed in any other class
yep
variables should always be private (with one exception), and so to get that variable from another class you'd use a variable which is public
so in my freeze class I will need to change it to example "plugin.getfrozenPlayers"
yes
remember that methods always have () (which are used for parameters) - plugin.getFrozenPlayers()
ex ```java
private HashMap<Player, Location> frozenPlayers = new HashMap<>();
public HashMap<Player, Location> getFrozenPlayers() { // a getter method
return frozenPlayers;
}
```notice how the variable name is just frozenPlayers while the method name has getFrozenPlayers()
and if you remove the () from the method it'll start erroring 🥴
so it will be plugin.getFrozenPlayers().put
yep 👍
Ideally we don’t expose virgin data structures like that but yeah it’s somewhat better than a mere public field.
virgin data structures ;o
lol
i think what conclure means is that instead of getFrozenPlayers().put it's better to do addFrozenPlayer(player, location)
^
parameters are used to call for something, That's why we need that because we are calling a HashMap?
plugin.frozenPlayers.put(target, target.getLocation().clone());
I now have this
so I will need to do
plugin.addfrozenPlayers(player, location)
close - methods are used to call for something
this is a method: ```java
public HashMap<Player, Location> getFrozenPlayers() { // a getter method
return frozenPlayers;
}
and this is a parameter: ```java
()
an example of using a parameter in ur plugin is ```java
public Freeze(Freeze freeze) {
plugin = freeze;
}
the "method" is ```java
public Freeze(Freeze freeze) {
plugin = freeze;
}
```while the parameter is ```java
(Freeze freeze)
```which are basically variables passed into methods
No you Freeze, freeze
}
Would also be a constructor
you don't have to, but it's good practice to do so - and if you do want to here's the code required: ```java
public void addFrozenPlayer(Player player, Location location) { // parameters!
frozenPlayers.put(player, location);
}
Should be this.frozenPlayers.put(player, location);
Come on Dkim
Never forget this
🥲
but
No buts
I have a workaround
👀
Sort of
i hate this
o
genius
can you send me this pm
and this
Plugin should be named This
so I can find it easily
click on my profile and rate my steam name
100% certified banned on 15 fivem servers for that
❗
Just don’t use the smile-…

Btw Flips are you familiar with the four principles of object orientation?
Dkim for the sake of god
That’s haunting me lol
FlipsMC r u still here
Remember
Always
Use
Static
?
Dang
barry isn't educated about the secrets of coding D:
You have to be alt f4’d
Doesn't even know Skript
skript = best coding/programming language
Un-bel-ievable
indeed
And I just fixed it so default players can't use the command without flipsmc.freeze 🙂

now if the don't have the permission the will get a nice message "You don't have the facilities for that!'

over 2 days I am gonna learn about config's so I don't have to hard code it with my own prefixes
btw
a suggestion: don't store Players
instead store the player's UUIDs
when putting in map: map.put(player.getUniqueId(), ..) instead of map.put(player, ..)
and to convert a UUID to Player, use Bukkit.getPlayer(uuid)
reason: the Player might become invalid
ex if a player leaves the server
which will cause a memory leak 🙃 (not a noticeable one for now, but good practice to not storing Players)
Remember Always Use Static and Lombok and Jython
Memory leaks are just so nice on god
dont forget javaassist too
XD
do you mean with map the HashMap
yes
I tried there is nothing like getUniqueId
player.getUniqueId()?
I haven't heard of it,
when would you ever want to do
ClassFile cf = new ClassFile(
false, "com.baeldung.JavassistGeneratedClass", null);
cf.setInterfaces(new String[] {"java.lang.Cloneable"});
FieldInfo f = new FieldInfo(cf.getConstPool(), "id", "I");
f.setAccessFlags(AccessFlag.PUBLIC);
cf.addField(f);
Over creating a new class yourself?
Or is it for editing classes?
dynamic class generation
luckperms uses dynamic class generation with bytebuddy i heard
i just said javaassist cause a lot of plugins have it shaded but dont know what it does
XD
luckperms uses it for generating implementation of event interfaces
bytebuddy
it doesnt use java assist
The LuckPerms API has so many events you can subscribe to on the event bus that the implementation is generated at runtime
❤️
@EventHandler public void onPlayerMoveBlock(PlayerMoveEvent e) { if(!frozenPlayers.containsKey(e.getPlayer())) { return; } if(e.getFrom().getBlockX() != e.getTo().getBlockX() || e.getFrom().getBlockZ() != e.getTo().getBlockZ()){ e.getPlayer().teleport(frozenPlayers.get(e.getPlayer())); }
I changed it based on UUID like @dusky harness told me to but now I fucked up my @EventHandler
Because it can't get the player out of the HashMap
contiansKey(e.getPlayer().getUniqueId())
and then teleport(frozenPlayers.get(e.getPlayer().getUniqueId()))
I click this server only to see dkim spitting facts 😤
😳
hi remence
nothing
agree
What've you been up to
i'm just waiting atm for a server owner to test smth ¯_(ツ)_/¯
but they busy with uni and stuff D:
Uni???
I thought you were 14 wtf
you know I tried this I looked threw my redo and undo and I tried this but without the ()
im not the one in uni
Stupid parameters
🥲 🥲 🥲
I didn't see the "they" 🥲
Yeah
I fixed a potential memory leak, That wasn't there yet
Are you seeing what I'm seeing?
You must die
Wow that's annoying 😂
alt + f4
I see someone has been watching Demon Slayer
You know what its already so fucking late for me just let me try to fix the hashmap thing
now add this
while (true) System.gc()
easy fix
Yeah I saw it a while back, just looked over some scenes again and realized how cute baby Tanjiro was
What did you think of Demon Slayer?
Would you look at that
while (true) Thread.sleep(1000)
would that be the kind of garbage collection that gets disabled by the +DisableExplicitGC flag?
for anyone that has done C++, are methods usually in PascalCase, camelCase, or snake_case? I heard that variables should be in snake_case.
I've mostly been using PascalCase personally for variables and methods. But I guess it's personal preference
Rn, I'm using PascalCase for Classes, camelCase for methods, and snake_case for variables. Feels all over the place.
- coming form languages where I never ever use snake_case, half my variables end up in camelCase :/
I'm following an online course thingy (for game development with c++ and Unreal Engine) and i've been using PascalCase for everything. (apart from the usual prefixing bools with b or enums with e)
I personally think it looks better with c++ but for something like Java, it's PascalCase for classes, and camelCase for methods and camelCase and snake_case for variables.
My online course thingy said to use this. So I followed it, and I still don't know if it's right cause there's so much conflicting info.
Time to go clean up all my camelCase variables and change them into snake_case ones :/
I guess it really comes down to personal preference. I like how it all looks with everything being PascalCase for c++
If I was going to use something else for variables and methods, Id pick camelCase for them unless its long, then i'd use snake_case for readability.
I believe when I was doing c++ a while back, everything camelCase was the way to go.
Personally, I do actually prefer snake_case for variables tho. It's a little more annoying to write, but way easier to read imo.
Yes
Oh god that was 7 hours ago lmao
Hehe, I was just curious 😄
Question: How do you deal with NullPointerExceptions, unchecked casts etc. IntelliJ complains about that can only occur for example if the user deletes essential parts of the config file?
Do you just annotate them with @SuppressWarnings and call it a day?
I mostly ignore warning like that but sometimes I dealt with it.
But you should consider trying to fix that tho.
are you asking?
yeah
well, there's a lot but the most important is you will code more faster and efficient
because of the auto-completions and lots of shortcuts
What are you switching from?
Personally, I had been using Eclipse at uni and getting my hands on IntelliJ was a night and day difference.
Eclipse
it will be so much better
Eclipse is easy to use but people keep saying that IntelliJ is gonna be beter
and today I am gonna start watching this.
https://www.youtube.com/watch?v=xk4_1vDrzzo&list=WL&index=71&t=20s
It is much better. Just give it a shot. You can test the community version for free or even the full version if you are a student. The only reason not to use IntelliJ is if you have an old PC, because IntelliJ will eat considerably more RAM and be heavier on your CPU.
Ryzen 5 3600
16 gb 3600mhz
I guess I will be fine
you probably uses eclipse because the video tutorial that you watched is using eclipse
how to out zoom in IntelliJ
I use ctrl + wheel but I'm pretty sure I had to change it to use that. in the settings you should be able to set the keybinds
File - Settings - Editor - General and first setting Change font size with Ctrl+Mouse Wheel
That's what I do as long as I'm confident. The way the config works is that it'll try to get a value from the config.yml in the server. If that is null, it'll then try to retrieve a value form the default config bundled into the plugin. If that too fails, then it gives null.
No?
If the value is not present in config it will return null or a default value specified by you or for instance 0 for getInt
I couldn't get it ho work with docdex, never properly used it before
Can someone compile a plugin for me? Its with Gradle and Kotlin.
why? compile it yourself, it's easy
Im not a Developer
no worries
open your terminal, cd "the path of the folder", run ./gradlew shadowJar and that should be it
if on windows, open your cmd, cd /d "the path of the folder", run gradlew shadowJar and that should be it
.rar folder or a normal folder?
extract the .rar into a folder
Done
then just follow the instructions
your jar will be located at "projectfolder"/build/libs/theJar.jar
Do you mean location with the path of the folder?
are you using windows or linux?
windows
then navigate to the project folder (where you extracted the .rar), and click on this empty space, then copy the text that will appear, that's your path
I have some questions about permission management:
- What is the
easiestbest way of temporarily giving or taking permissions from a Player? From what I've read, seems likePermissionAttachmentis the way to go, but I never really used it so I'm not sure how it works, for example, does those "attachments" persist between server restarts (do I have to explicitly remove them)? How do they behave alongside permission plugins like LuckPerms? - If
PermissionAttachmentare not the best way of doing this, then does LuckPerms expose some kind of method to allow plugins to easily give or remove (temporary) permissions?
Btw, for the use case I'm looking into, all permissions can be safety reset when a player logs off, that's completely acceptable (and even desirable).
@vagrant bobcat send a pic of your project files, it seems like you're missing the gradle wrapper
I will send it in a bit, eating rn.
pretty sure they dont persist, and permissions plugins should respect them
run gradlew wrapper shadowJar
Could not find or load it
In command sl, description & aliases have only 3 spaces. They need 4 spaces.
IntelliJ keeps telling me to convert a lot of my listener classes into records
Should I do that..?
no
commands need 2 spaces, description and aliases need 4
`depend:
- SL`
Do you have on your server plugin called SL?
Do you know what for is depend?
do those "attachments" persist between server restarts
as far as Bukkit (no perms plugin) or w/ LuckPerms is concerned, no they don't
How do they behave alongside permission plugins like LuckPerms?
LP integrates with them nicely, it's just like another permission added but that doesn't save to storage
does LuckPerms expose some kind of method to allow plugins to easily give or remove (temporary) permissions?
it has a whole ass API so you bet it's possible
all permissions can be safety reset when a player logs off
again, with just bukkit or w/ LP that is the case; I personally don't know the behavior with other perms plugins (pex, groupmanager, powerranks, ultrapermissions, ...) because I'm simply not interested lol
seems likePermissionAttachmentis the way to go
it's probably the least convoluted way; depending on how the other perms plugins work, it may or may not be a "one size fits all" solution
Are you using Eclipse/Intellij?
is there any way to check what is different between two items which seem identical to me?
It's something with the NBT tags for sure
But I have no idea what it could be, still
And where is your plugin.yml in your plugin?
Try to open the extracted .jar file with rar/zip and see if there is plugin.yml
nah tbh I don't care about other permission plugins since the plugin I'll have to make is targeting a single network which uses LP so I can safely use its API if it is the best approach
This is such an annoying warning that imo doesn't make any sense in the context of when I use such method
Is there any way to suppress the warning just for the setBaseValue() method?
It may throw an NPE
with KT you can easily use there should be a suppress for that, you only have to press your ALT + Enter key, press whatever arrow it is on the first option, then select "suppress warning for this method"?. to avoid that
ItemStack#equals or ItemStack#isSimilar
That suppresses it just for the method, meaning that if I do setBaseValue() in 100 methods in other classes I need to add that suppress line in each of those
Why not null check?
if you don't want the warn for the project, then select the option that disables it on your entire project man 🤷♂️
And you shouldn’t be repeating code that much
Doesn't that disable the warning for ALL methods in my entire project?
It doesnt disable it just for setBasevalue()
yes, isn't that what you want?
I might need it for other methods
I mean
it's not the attribute method, is for YOUR method
Yeah I know, but if I got a lot of methods that use that method... it's a lot of repetition
then disable that shit on your project or class man
you have to choose the scope: line, method, class, package, project
DRY
If I got 25 entities with different stats I have to repeat myself in order to give them different stats
Kinda unavoidable
You can simplify it
Adding a method which takes 3 parameters like HP damage and speed I know
I just got around to refactoring that I guess lol ops
Either way I am using that specific method in a LOT of methods in different contexts in different classes
That's why I was asking if there was a way to suppress a warning related to one specific method
Just use null checks
hi! I am trying to get all the current servers on a bungeecord network, when a command is sent. But it doesnt return any. I think I am not waiting long enough for the message to be send back, but I am not sure. The code is a bit separated but I can try and send the bulk of it
here is the code that runs the first function: java public Inventory createLobbyInv(Player p) { SendMessage.sendGatherLobbies(p); lobbyGUI = Bukkit.createInventory(p, 54, ChatColor.AQUA + "Lobby Selector"); for (int i = 0; i < lobbies.size(); i++) { lobbies.get(i).setAmount(i); lobbyGUI.addItem(lobbies.get(i)); } return lobbyGUI; }
when the command is run, it runs the first function, the second is receiving the message, https://paste.helpch.at/bicisitado.cs
LP API 🥰
I might be asking a bit much
👀
But I made a method which supposedly returns a 'safe' location for a mob to spawn in, can someone tell me if it's any good or if it's utter trash 😂
/paste = broken
Well that didnt work
Tried using it for the first time 😂
min and max are two corners of a square area
not allowing negative numbers
btw how come?
There's Block#getRelative btw
Honestly now that I think about it I don't remember, I have made this method like 1.5 years ago and I am just now revisiting it to see how I can improve it
What's that..?
ex Block#getRelative(BlockFace.UP) to get the block above
Oh that's cool I didn't know
so Block beneath = world.getBlockAt(spawnLoc).getRelative(BlockFace.DOWN); instead of Block beneath = world.getBlockAt(spawnLoc.clone().add(0, -1, 0));
Either way, the method is probably slow
But I don't know how else I could improve it..?
Also, you are telling me that with BlockFace I can technically get a block's surrounding 26 blocks?
d;sub_interfaces spigot BlockState
org.bukkit.block.Banner
org.bukkit.block.Bell
org.bukkit.block.EndGateway
org.bukkit.block.Chest
org.bukkit.block.Dispenser
org.bukkit.block.Comparator
org.bukkit.block.BlastFurnace
org.bukkit.block.Conduit
org.bukkit.block.SculkSensor
org.bukkit.block.Sign
org.bukkit.block.CreatureSpawner
org.bukkit.block.CommandBlock
org.bukkit.block.Dropper
org.bukkit.block.Campfire
org.bukkit.block.Container```
hmm
blockdata
nvm found it
just search noteblock on spigot javadocs and you wouldve found it
ok so it changes the state, but then instantly it converts it back to a normal state, whats the problem?
You have to do Block#setState if you didn’t
doesnt exist
is Block#setBlockData
and I did that
here is the code I used https://paste.helpch.at/idelocirit.java
BlockState#update
could you explain a bit more? cant really find where to use it 
my little brain cant understand it
Get block state
Modify block state
Update block state
https://paste.helpch.at/nomihehizu.java like this? 
tried like that
nothing
and nothing is that it still instantly changes back to harp
Why does this only run once?
public void run() {
vc.getManager().setName(getConfig().getString("channel_name").replace("{online}", String.valueOf(Bukkit.getOnlinePlayers().size()))).queue();
}
}, 0, 60*20);```
so it runs every minute?
Discord do be like that sometimes
yea
How would you get all the classes that implement an interface?
hmm
how come?
if you're trying to register listeners then I can give a solution
Not really no, but i found a better way of doing it
alr
But thanks anyway
how would i solve this? https://paste.helpch.at/inevotofan.sql
idk where it came from
reload 👀
show CorePacket class
can u show me Scheduler class?
really?
yes
np
how
yea gradle
compileJava.options.encoding = 'UTF-8'
add that somewhere near source compatibility or somethin
like this?
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
compileJava.options.encoding = 'UTF-8'
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}```
i guess
didnt change
show your whole gradle file 
version = '1.0'
compileJava.options.encoding = 'UTF-8'```
didnt work
How do you build?
shadowjar
Try clearing your cache first (./gradlew clean)
where
used it
Try again then
oh its working ty

okay can someone helpo me with python minecraft coding?
i have this smp that me and my friends play in
im trying to make a script that breaks trees
but i just cant get the player to look where i want him too
i give it the right cordents but it just barly moves or just doeswhat i want it to
im so confused
if anyone understand what im trying to say
Python minecraft coding?
- why
- what library are you using
button='right'
- wouldn't the trees uh... disappear once you break them?
from the context theyre trying to make a script to auto break logs ingame, kinda like a macro
if you want something to break logs you'd need a hack client or a mod
aka Impact
🤡
when using Gradle is it possible to specify isTransistive = false without using () around the compileOnly?
the FAWE API has this as an example compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:1.17-<version>") { isTransitive = false }
but in my Gradle I don't use () around the dependency because I think it looks better, is there a way to specify it anyways?
it looks like this for me : compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:1.17-393'
What logger should I use with a fabric mod?
Someone knows a good regex to detect links?
the same it has 
Thank you for that help
lmfao
Don't think so, just embrace the parenthesis and change to gradle kts 😌
your own lol
Logger LOGGER = LogManager.getLogger(UrMumMod.class)
Thanks
thats what I wanted to say 
🙃
Question, Sooo I have this idea where i want to make a miniture world basically, 10x10 chunks inside a void world and then spiral it outwards like skyblock islands. I have the spiral down, but im not sure how to generate only the 10x10 chunk inside the void world based off a central location. Can someone explain how i should go abt this
So I have made a very similar project, the Files for it are on a different Machine which I cannot access right now. Your best shot would be waiting for Emily to respond, she was the one that made the Code for my Project. I have the same thing, I have a 2x2 Chunk area which goes outwards in a spiral pattern, but in my case I also place a Schematic
Ok
is there an easier way to get commands registered in the plugin.yml? I have got an entire custom system for the execution and so but for the plugin.yml thing is a pain
ping me if you have an idea
Lots for plugin command frameworks have automatic adding to plugin.yml. You can probably take a look at their annotation register thingys if you really want.
How would I get the world name of a world with fabric? Sorry I'm new to making mods.
World::resourceKey or something like that
Thank you
How do I turn a UUID as a string into a players name?
Bukkit#getPlayer(uuid)#getName() ?
Turn the UUID string to an UUID object by UUID.fromString method, then get the name by Bukkit.getOfflinePlayer(uuid).getName or Bukkit.getPlayer.getName if you're quite sure that the player is online
Read what I said
ty
you're very welcome
There's this thing I've seen in spigot coding where there's an Entity enum, then inside of Entity they have a LivingEntity and inside of that they have a Mob category and a Monster category and its this whole tree. I want to use this in one of my plugins but I have no idea what this is called. Can someone point me in the right direction for what to look up?
If it helps, specifically what I want is an Enum called CustomSound which has both drum sounds and musical sounds. I want a function to specify if it takes a drum sound or a musical one. drum and musical sounds would both have the same information which is just a minecraft Sound
I already have the CustomSound enum I just dont now how to make the sub enums
same information as a minecraft sound? mind elaborating on that one?
public enum CustomSound {
HARP(Sound.BLOCK_NOTE_BLOCK_HARP),
BASS(Sound.BLOCK_NOTE_BLOCK_BASS),
IRON_XYLOPHONE(Sound.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE),
BELL(Sound.BLOCK_NOTE_BLOCK_BELL),
BASEDRUM(Sound.BLOCK_NOTE_BLOCK_BASEDRUM),
SNARE(Sound.BLOCK_NOTE_BLOCK_SNARE),
HAT(Sound.BLOCK_NOTE_BLOCK_HAT);
public final Sound sound;
CustomSound(Sound sound) {
this.sound = sound;
}
}```
I have this an an enum. HARP, BASS, IRON_XYLOPHONE, and BELL are musical sounds but BASEDRUM, SNARE, and HAT are drum sounds. I was hoping there would be a way to categories them into categories like "drum" and "musical" and only take one of those categories in a function but I think I've realized that what I'm looking for doesn't actually exist :/
If i understood you correctly, you could create two Enums, Drum & Musical. from there, move the appropriate sounds to their own respective category
hold on
right, apparently Enums could implement interfaces so, you could have those two Enums implement CustomSound and have a static? method on CustomSound which would take CustomSound as an argument?
That pretty much sounds like what I'm looking for, what would I look up to find how exactly to do that?
which parts do you want me to elaborate on?
Public static -
I was mostly looking for the exact syntax which is why I was looking for what I could look up to find it
was this a response to the think I'm asking about?
are you new to Java?
Eh? I've been doing it for a year or two
sorry I didnt mean to reply to that message like that
I don't mind
I think at this point I've gotten enough to be able to find what I'm looking for? So thank you for this
I hope that was the case, feel free to @ me if you couldn't figure it out
You're very welcome, good luck to you! :)
Would i be able to give a potioneffect to a player infinitly?
Yes give it max value length
Has anyone here ever user JDA? If so, then why does ShardManager not return any guild if the bot clearly is in one?
no. never heard of it
ugh. both getGuildCache and getGuilds are marked as not nullable. so don't think it should be returning null at all?
oh wait you didnt say null
fuck nvm
check the CacheFlags you've disabled
maybe there's one for that
also apparently that can return empty if the jda hasn't fully started yet or something like that
yeah. according to this post, guilds are always cached and another post said that JDA#getGuilds can return null or empty if the jda has not fully started yet.
ah nvm i had to do shard#awaitReady()
yeah. tho they recommend you use the ReadyEvent instead
u should join their discord. there's a lot of useful stuff there
that just makes everything stop until the jda instance is fully loaded. so exactly the problem described above
anyone here experienced with jda?
no
why?
because i am getting an error when disabling the bot
gotcha, but which one do you recomend?
well what error? you'll have to share more information with us if you want help. put any errors or code snippets in https://paste.helpch.at
Matt's framework. even tho maybe u should wait for the rewrite to be done
yeah but who cares, I'll just base out of it
Looking for useful libraries/frameworks?
Here are some which have been deemed useful by the community and are used daily.
-> Menus: https://mf.mattstudios.me/mf-gui/gui
-> Commands: https://mf.mattstudios.me/mf/mf-1/getting-started
-> Messages: https://mf.mattstudios.me/message/mf-msg
-> Config: COMING SOON™️
I fixed it
changed shutdown to shutdownNow
ye ty ^^
Grats
yeah barry is stupid
the point is that Matt's code is way too wonky and confusing for me
then I come to ask
how come, what code are you talking about?
I was looking for how he did manage the annotations
I want to be able to use em for registering commands like you do in the plugin.yml
There's literally a commented section that says "used to register in plugin.yml"
how can I get the center of an AABB constructed by 2 vectors?
(I am shit at math btw)
What's wonky about it? I get confused but wonky? 
also does anybody know PacketWrappers for Protocolllib for 1.17?
or anything above 1.15
bad
Very 
so how does this: ```Java
int id = ThreadLocalRandom.current().nextInt(99000, 99999);
WrapperPlayServerSpawnEntityLiving wrapperPlayServerSpawnEntityLiving = new WrapperPlayServerSpawnEntityLiving();
wrapperPlayServerSpawnEntityLiving.setType(EntityType.ARMOR_STAND);
wrapperPlayServerSpawnEntityLiving.setEntityID(id);
wrapperPlayServerSpawnEntityLiving.setX(player.getLocation().getX());
wrapperPlayServerSpawnEntityLiving.setY(player.getLocation().getY());
wrapperPlayServerSpawnEntityLiving.setZ(player.getLocation().getZ());
wrapperPlayServerSpawnEntityLiving.sendPacket(player);
WrapperPlayServerEntityEquipment17 wrapperPlayServerEntityEquipment17 = new WrapperPlayServerEntityEquipment17();
wrapperPlayServerEntityEquipment17.setEntityID(id);
wrapperPlayServerEntityEquipment17.setItem(EnumWrappers.ItemSlot.HEAD, new ItemUtils(Material.DIAMOND_HELMET).build());
wrapperPlayServerEntityEquipment17.sendPacket(player);``` end up in this?
Is that a new Type of ArmorStand?
that is such a long variable name holy shit
its also probably because of the entity id
entityIDs matter?! I thought its just an int to keep track of the entity
Tbh that's good, better than wpssel
Matt hewp :c why I have a Ghast and not an ArmorStand with a diamond Helmet?
Matt is currently unavailable please leave your message
Jokes a side, idk sorry i don't really play around with packets that much
No, but entity type id matters
Those don't exist anymore
I think its caused by the Wrapper I am using? its last update was for 1.15.2
but there isn't anything newer
and building Packets from scratch is painful
they are used in packets
the Wrapper does that, it takes the EntityType uses #getTypeId and puts that into the Packet
my guess is that something got changed in some update which causes the Wrapper to break
Yes but he already has that setType(EntityType.ARMOR_STAND)
let me try using EntityType Ghast instead of Armorstand 😄
are you spawning entities with packets
he is
Okay so using EntityType Ghast does nothing?
https://github.com/Oribuin/EternalCrates/blob/main/NMS/v1_16_R3/src/main/java/xyz/oribuin/eternalcrates/v1_16_R3/NMSHandlerImpl.java#L33 might not help but try looking at that
that spawns a clientside entity
do with it what you will
That is exactly what I am looking for buuuuut It has NMS :c
aka I need to add the bukkit dependency thing
which might even be easier then what I am doing
Do you think that will also work in 1.17?
also when getting the Entity from the Method making it invisible isn't a problem right?
that plugin has 1.16-1.17 support for it
A member of staff has requested I move your pastebin.com paste to our paste.helpch.at!
that was expected
I will just add NMS, it will probably be easier
what dependency do I need again?
craftbukkit?
try using packet.getEntityTypeModifier().write tho!
will do, can you tell me the dependency for NMS if that doesn't work
For NMS you need to run buildtools then add spigot instead of spigot-api
then paper instead of paper-api
You can still ad spigot for NMS but i think paper has a different way
also to add it to local maven is very easy
you need to run one command on the paper server jar
yeah paper is different in this case
does paper also have something like buildtools?
yes. you run a command on the server jar
Yes, paperclip
let me see if I can find the command
java -Dpaperclip.install=true -jar paperclip.jar
But tho if you're on gradle you may just use paperweight-userdev to develop against mojang mappings!
paperclip.jar being the server jar you downloaded
but this only works on 1.16.4 or newer
That is cool, all done. took one command, me like
ehh wait? net.minecraft doesn't exist?
did it work btw? Just interesting
nope
you need to use maven local and paper instead of paper-api
same? You got a ghast?
nope: No field with type net.minecraft.world.entity.EntityTypes exists in class PacketPlayOutSpawnEntityLiving.
ahh I forgot mavenLocal i think
ohh I will give it a look once I get this working
but currently struggeling with IRegistry
YES!
Thanks alot!
just the entityCount field was wrong because it doesn't exist in Paper its called "b"
Field entityCount = Class.forName("net.minecraft.world.entity.Entity").getDeclaredField("b");
doesn't look sketchy at all
But I can't seem to Cast the returned entity to Armorstand ?
oh because you never return it lol
its called obfuscation
md reverted all fields back into their obfuscated form
it used to be named properly like entityCount between 1.12 and 1.16, but in 1.17, md just decided to revert them to the obfuscated form
your code wont work for 1.12 - 1.16
but then again, 1.17 supremacy good
lol
this doesn't seem like a good Idea nor a good solution: return loc.getNearbyLivingEntities(1).stream().filter(p -> p.getEntityId() == packet.b()).collect(Collectors.toList()).get(0);
doesn't matter it will be 1.17 only
Mhm thats why i dont think its a big deal at the end of the day XD
okay so my solution did not work :/
https://paste.helpch.at/itovaroqow.java this is the current code it normally returned null but I need the Entity so I can modify it further
let me upload to paste
first().orElse(null);
my current solution doesn't work because the List is empty
so I need a different way of getting the Entity
maybe you need to do .equals for uuid but im not sure how spigot handles it internally
because idk if spigot copies the uuid over, or sets it into the memory with like same value you know
print the ID's just in case
d;paper Entity#getUniqueUUID
int getEntityId()```
Returns a unique id for this entity
Entity id
so neither using the entityid nor the UUID of the Entity I am able to get the Entity
it returns null
I am printing out the UUID and I get : fb9b705b-9a23-48fb-9992-d458e9f4aa91
is it maybe because its spawned using Packets so it doesn't actually exist?
Hi, I'm trying to get an entity that is max 5 blocks away from a Player, I know I should use raytrace, but I couldn't find a raytrace entity method. can anyone help? I use spigot 1.17.1
d;spigot World#getNearbyEntities
@NotNull
Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z, @Nullable Predicate filter)```
Returns a list of entities within a bounding box centered around a Location.
This may not consider entities in currently unloaded chunks. Some implementations may impose artificial restrictions on the size of the search bounding box.
the collection of entities near location. This will always be a non-null collection.
location - The center of the bounding box
x - 1/2 the size of the box along x axis
y - 1/2 the size of the box along y axis
z - 1/2 the size of the box along z axis
filter - only entities that fulfill this predicate are considered, or null to consider all entities
the player needs to be looking at entity
Player#hasLineOfSight(entity)
How this method work?
d;spigot livingentity#haslineofsight
boolean hasLineOfSight(@NotNull Entity other)```
Checks whether the living entity has block line of sight to another.
This uses the same algorithm that hostile mobs use to find the closest player.
true if there is a line of sight, false if not
other - the entity to determine line of sight to
foods.contains(event.getItem().getType()) btw, no need to loop
and use enumset
This doesn't seem to be a thing
@EventHandler
public void onFoodDrop(PlayerItemConsumeEvent event) {
Bukkit.broadcastMessage("contains: " + foods.contains(event.getItem().getType());
Bukkit.broadcastMessage("sprinting: " + event.getPlayer().isSprinting());
}
@ashen sigil
= 3 food bars iirc
you cant run while your food bar is equal or lower than 3



