#help-development
1 messages · Page 1873 of 1
There is a team option for disabling name tags
I use it in one of my plugins to hide player names of players that aren't visible
(Like behind a wall)
ok so my custom lines work and i got the logic down but now how do i add more lines? what entities should I stack?
(for context i'm tryna make a multiline api above player's name)
I have find that i can do it without Ptc Lib. But thanks!
player.getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(hidden.getName(), true, 10));
it worked
dont ask me why. Btw
Hey how do I edit the entity's NBT like invisibility or tag
player.getWorld().spawnEntity(chairLoc.add(0.5d, 0, 0.5d), EntityType.ARROW).addPassenger(player);
Don't edit tag use api methods
please elaborate
Just use Entity::setInvisible for instance
Actually arrows can't be invisible that way. They aren't living entities
what happens if you set a player on an arrow and then send arrow remove packet to the player ... ? will the player just stops flying ?
Yeah it was just an example
oh wait I can only add one
Let me do that
A Cat is no Wolf. Both are in the BukkitAPI both have the method setCollarColor(DyeColor). Should I make a feature Request for a interface like Collarable or is this word to near to Colorable? Or should i direct create a pullrequest if this is possible anywhere?
?cla
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Good morning/day/evening comrades, I am currently messing around with yml. I want the code to find for example the "beverage" section in my config, and in that section add say a drink such as "beer". How would I accomplish this? I suspect I need to first ofc find my section config.getString("Beverage"), but how can I add the beer into this section? In a new line?
wat
I replied to the wrong message, sorry
Do you wanna add a new section?
oh you use ``
A new section beneath "beverage", indeed.
EntityType suitable = EntityType.ARROW; correct? because that is not helping
🤔
there
getConfigurationSection("beverage").createSection("nestedSection"); @heavy heart
Arrow arrow = player.getWorld().spawnEntity(chairLoc.add(0.5d, 0, 0.5d), EntityType.ARROW)
Although you probably want Player#launchProjectile instead
Oh, that makes so much more sense
bruh
Thank you comrade, I appreciate the help c;
Oh no, I am not trying to move it
its just the perfect entity
for my chair
How to get who killed someone using respawn anchors or other explosions that don't count as player? Since respawn anchors will kill the person, but not give kill credit to the one that blew the anchor.
Is there a resource for this out there?
Or if not, how would I do it myself
How would I remove all teams from the main scoreboard?
Bukkit.getScoreboardManager().getMainScoreboard().getTeams().clear();
is it this simple?
Huh, I am getting an error
Have you tried?
Ah right the type one doesn't return a generic
Use Arrow.class instead of EntityType.ARROW
Coll1234567 I just needed to cast to the Arrow
Listen to the PlayerInteractEvent or atBlockEvent if that exists... then store that in a map. And when player is damaged read data from map and see the player who damaged
Arrow arrow = (Arrow) player.getWorld().spawnEntity(chairLoc.add(0.5d, 0, 0.5d), EntityType.ARROW);
lol
does player#setResourcePack take into account changes in the resource pack?
like how does it calculate the SHA1
backtracking is pain
Files.readAllLines >>>
also the closing method should be in a finally statement
Files.readAllLines reads all of the lines from a file and puts them into a List<String>
very helpful
- it uses the Path api and not File
only downside ig is then u gotta collect the strings into one, but i think theres a String.join method that will work, if not then .stream().collect(Collectors.joining or whatever
and if you want them in a big string:
String.join("\n", Files.readAllLines(...))
oh string.join does take in collections, cool
Well you could simply go with Files::newBufferedReader and do whatever you want otherwise
mayhaps
wdym
BufferedReader + StringBuilder 😎
I'm actually not sure if Files.newBufferedReader is faster than wrapping a BufferedReader around new FileReader(file).
But nio is generally preferred since it's newer.
Someone known how to get the falling distance of a falling block (like an anvil) without monitoring each tick this falling block ??
.getFallDistance maybe
Hmm maybe benchmark it
Maow will eventually make his own IO library though.
How would I add a Player to a Team
eventually
It'll use the pre-existing Java IO library but provide some niceties :)
team.addPlayer(playername) ?
Like better abstractions over sources/sinks.
Team#addPlayer is depricated
Yes but at what event ?? I try with EntityChangeBlockEvent but the falling distance is always 0.0
Add the username
what
addPlayer is deprecated. Use addEntry with the player name
hey, is there more emoticons that could be used in spigot, or i've already collected all set?
huh, is that safe tho? no way of adding a OfflinePlayer object?
can I have this
Anyone one know how I can get a player's client version with tiny protocol?
sure
Teams use strings and player names. It doesn't track player objects. Ask Mojang why
do you have all those ?
alright thank you
private?
nope, where i can get it?
I'd use enums for that
References on computer symbols. How to type computer symbols with keyboard on Windows, Mac and Linux operating systems. Generators for text messeges. Computer text art.
Get falling distance of anvil
thank you
i've just stolen this file from internet 🙂 refactor will be done
does Player#getScoreboard#getTeams return a collection of Team that the player is a member of?
or the teams in the players main scoreboard
the latter im guessing
if so, how would I get the Team the player is a member of
I would presume the latter, check the JavaDocs for it
if they connect, theyre using server protocol 😎
jk
wait is event.getDismounted the entity that was dismounted in the event?
Check JavaDocs
It does not help
i think if u listen for the handshake packet that should say the client protocol version
usually it has a description but it doesn't
so I guess I will just try it out
Is also good
Oh and https://spigot.download
Fun stuff
LMAO
xD
wait what xD
Someone at Paper made that one
Lol
Where do you find that?
Im interested on that
pd: Sorry for the tag
i send you private
Allright thanks!!
LMFAO
54% of minecraft server software moment
its faster and i cant see a disadvantage of using the faster software O.o
I LOVE IT
I have a string = "&c[Admin] &7"
Now I want to get the last color code wich is &7 as a ChatColor, how would I go about this
how i multiply a vector to left direction?
Purpur better
for example, the vector is for this arrow, but I want to multiply it for my right arm
change x and z coordinate of the direction the player is looking
like a x.add ?
no
why do i intend to do this relative to the world
Vector direction = ....
Vector left = new Vector(direction.z, 0, -direction.x)
you will probably need to check if "-direction.x" is right and play around with the - before the x value and z value
https://dontasktoask.com is nice sometimes too
how do you get an instance of the current running server using the Server class? I want to access it to get the current playercount
Bukkit.getOnlinePlayers().size()
well you need to do more math ... creating the orthogonal vector is just good to move the startLocation to the right or left ... from there you need to use the normal direction vector to get something from that position
wtf
well, i have that method but dont working very well
lmao
private void Vector rotateVectorAroundY(Vector vector, double degrees) {
double rad = Math.toRadians(degrees);
double currentX = vector.getX();
double currentZ = vector.getZ();
double cosine = Math.cos(rad);
double sine = Math.sin(rad);
return new Vector((cosine * currentX - sine * currentZ), vector.getY(), (sine * currentX + cosine * currentZ));
}```
with bats
nice ideia
how do you log inside a Listener object?
Grab your logger instance and logger#info
For example
Or if you're lazy sysout like you normally would
i have something else that now shoots a laser from the player right shoulder in facing direciton ^^
what
you want the weapon to be turned 90° ?
what main language ?
i made the armor stand stay resumed for a weapon, now i would need to move it to the center of the stand
portuguese brazilian, but let's keep english
and how
Hi guys. I need to be sure about smth. I have my BlockBreakEvent listener on priority LOW. This listener also does nothing if the event is cancelled (it has ignoreCancelled = true. Does that mean when I break a block inside a WorldGuard region (and it does not break) my listener won't fire? (I think WG listeners have priority HIGH)
dif = weaponstand.location - displaystand.location
weaponstand.location.add ( dif )
^^moves the weaponstand above the displaystand
this a vector or something?
private ArmorStand spawnHologram(final ArmorStand armor, final Material type) {
final Location local = armor.getLocation();
final Vector dir = rotateVectorAroundY(local.getDirection(), 77).multiply(2);
final Location newloc = local.add(dir);
final Location loc = newloc.add(getDirection(newloc, local).multiply(2));```i used it
you can/should use the locations as vector
do you can send me your resourcepack for this ? would make things a lot easier
yes i can
My goal is to make a config.yml that looks alike this:
Beverages: (which is preset)
Beer:
- text
Starting from:
Beverages:
So my question is how do I set "beer" beneath beverage? and how do I set "text" again into "beer"?
My "main" code so far goes as following:
"Beer" and "text" both being variables, beer(string) and text(integer). Though I believe this is irrelevant when making this. As they will be converted accordingly..
config.getString("Beverages").set(beer);
config.getString(beer).set(text);
this.saveConfig();
wait... if you now move the player rotation.... does everything sync with it or is it a laggy delay ??
wtf is these texts
resourcepack
I need to store some data, like.. a lot. I need to be able to retrieve them and build stats. Is SQLite a decent solution? I want zero configuration for the end user.
Is there an event for when water breaks a block/entity?
trying to get the 2nd screenshot as a result
tried setting it to null and that didn't work either
SQLite is good if you need to store a few things but I would highly recommend using an actual DB if you plan on using it to store lots of different things.
this is what I got from the 1st screenshot
is there a specific reason ?
SQLite is exceptionally good for smaller programs and is much faster in that regard. If you don't plan on having a crazy amount of data it's probably your best bet. Just know it has limitations. SQL Server is kinda slower but it's got more to it.
Oh, okay, i'll check the doc, thanks a lot
You can always try them both. It'd be a bit of work but if you write a generic CRUD system it wouldn't be to much work to try both.
also keep in mind, if the data is needed elsewhere sqlite isn't going to work for this
how can I create a blank path in my custom yml file so that I can add paths to it later on
I need to store mostly numbers and integers to make some calculations on it, i won't need elsewhere but i'll keep looking if there is a better alternative.
Hey what is the best way to get a random online player?
you would need to make the value a space or some other character. Null values removes items from yaml
Create a random function that generates the index of the players arraylist
^
produces this
for the space
Hi. Im again. Is there a way to convert an specific icon to a string format. Like unicode/UTF-8 so i can send it to the console/player?
I have seen that in some resources they use them
Is there an event for when water breaks a block/entity?
https://www.baeldung.com/java-a-star-pathfinding I have found this and made my own version of it, however when i run it in 3D even a two block distance takes AGES to complete, why's that? (Note, in two dimension it was instant at pretty much any distance)
like?
a:
b: 'c'
```?
I only want the first one so that I can build off of it later on
the a: from your example
this is what I'm planning on doing:
players:
theiruuid:
playerinfostuffhere
if so just run
config.set("players.playerUUID", someVal)
if you run this multiple times it will append the other player UUIDS to players, otherwise if it does not exit it will create players
this makes:
players:
playerUUID: someVal
you can also do
question
mhm
that might work
will it create players again if it's set
no
ok
it will just add it to players
they want a configuration section rather than a key they can get a value from
?
either way you needs to have some kind of value that isn't consider null
it won't tell me if when getting the player's uuid from there if it's null or not
you can also use config.setConfigurationSection("players") imo
wdym
public static Boolean hasPlayed(Player player){
UUID uuid = (UUID) SkyMining.getInstance().getPlayedConfig().get("players." + player.getUniqueId());
return uuid != null;
}
no
thats
not
how you do it
why do you use A boolean wrapper btw
just use boolean
also I am aware there is already a hasPlayedBefore() method
config.contains("players." + player.getUniqueId());
config.containsKey("players." + player.getUniqueId());
```one of the two
check which of the methods exist
i forgot
If you want to have mutiples player values like this, you should do:
players:
uuid-one:
name: "name"
age: 10
uuid-two:
name: "name"
age: 10
For getting first player name or age do: config#get("players.uuid-one.name") and for the second player: config#get("players.uuid-two.name")
Is there a secure way to host a plugin's SQL database for all users using that plugin?
yes I know that stuff
thank you though I appreciate it
❤️
there's a "database: true" in config i believe
Is it possible to create custom achievements? i found some old threat about that but it seems that class CustomAchievement no longer exists
Like for spigot/paper?
in your plugin.yml
yes
no no I mean, I develop a plugin, and rather having the server owners needing their own SQL database, could I the developer securely host a database that hold all the info for everyone using the plugin
@wet breach so how can i do this, and is it possible to achieve that without NMS?
Like maybe through a web API or something
yes, you'd need your own servers, and to find a way to encrypt the data between your servers and the plugin without hardcoding anything in the plugin otherwise it will get found and used
If you uplaod the plugin you cant do that. Because every spigotmc plugin cannot depend from internet connection for working
when i listen for an PlayerQuitEvent, i get the count of online players on the server. for some reason it registers as if the player is still online. for example, if there is one player on the server and they leave, this code:
private int getPlayerCount() {
return getServer().getOnlinePlayers().size();
}
returns 1, even though the player has already left. Is there a way to delay the handling so it gets an accurate count?
it wouldn't really be possible and probably wouldn't fit with the rules. I mean you can host a DB server and attempt to do such things but even if its allowed, most server owners prefer to host and keep their own data
Maybe have the owners get a pass when they download the plugin (say in your disc), and put that in config, and then encrypt/decrypt the data sent/received with that pass
this as well
Yeah makes sense, Im also wondering the same thing for general java applications
Another way you can do is using a key-value for credentials. Look it on internet
tho if you don't have internet... your server can't have players?
you can make a restful api if you want for your general java stuff and probably good practice
it is one of the few ways you could securely add stuff to a DB without exposing credentials
ive been learning Spring Boot for java but dont fully understand it yet
Yes but spigot rules says your plugin cannot depend on internet
tokens/passwords/keys also do the trick
So go for smth easy. Dont complicate your self
really so DataPacks are illegal?
Btw for a fast HttpServer i'd suggest Undertow, i am using it for my plugin (Update checker) and it works wonders, even with hundreds of requests it keeps up nicely
Yooo day changed xD
Its easy he use the key-value that why it was created by Microsoft
To solve database credentials problems
🤔
a simple 128bit or 256bit key would also work
Wait but
Doesn't that go against the entire point of Spigot's library loader?
if this was the case my plugin would be long gone xD
Oh lol
A built-in feature of Spigot?
I have never thouth that
Heyo, are there any known issues with serialization with the bukkit api and kotlin?
That part of Spigot does require an internet connection btw.
Good point of view Maow
So many things in this world are dependent on the internet.
you need your server to have kotlin in its classpath/boundle it in with your plugin
You know how many services exist on da interwebz?
then it works fine
It's recommended to use the library loader for Kotlin if you use a recent enough version.
just for serialization I assume ?
Yes but its retarded because the spigot rules say that the plugins cannot depend on inthernet. But it has a feauture from them that its dependent from internet. BTW
Hell, you can't even build a Spigot plugin without an internet connection because of Maven resolution.
no since kotlin has its own special "quirks" you need the kotlin runtime library shit
what feature?
and its pretty annoying, tho i've gotten around it by using the lib loader
The library loader system from their api
Yes
Umm the plugin works just fine just when getting a serialized thing from a config..
how does that depend on internet? o.O
libraries:
- org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin.version}
```that's how i am loading
loads dependencies from maven central
Yeah
its amazing
Isn't that also against Maven Central policies tho or smthn?
Does that exists on spigot 1.8.8?
At least from what I've heard?
my plugin went down by 2mbs in one swoop
no 1.16.5+
Oh ok
then all I can say is that you make your plugin designed in such a way that no internet doesn't cause it to just simply break 🙂
Some spigot rules are really controversial.
if you have no internet how are you expecting to run your server?
I mean plugins can depend on internet, but if they do, all internet requires resources must be provided with a download link or sth iirc so for instance runtime dependencies
local
not all servers require internet, just a way for the proxy to connect to it
which can be a Vlan
That what not said spigot rules...
have you read them?
ofc
Of course
Ah ok
fair enough, however i don't want ppl downloading a 2.3MB plugin just because of kotlin
2.3mb isn't a whole lot in the grand scheme of things
My internet speed would like to disagree
Pretty sure "ofc" is "of fucking course," not just "of course."
Its controversinal. Because the rules said that the plugins cannot depend from a connection for running. But the spigot has a built-in system that yes or yes requiere
hahaha
both, both is good
if that is the case, you most likely are not doing a whole lot of gaming at those speeds lmao
also not hosting a server either
meh i get avg 160-260 ping on hyp xD
You can btw
sure maybe like 1-2 players at those speeds if 2.3mb is a lot for a download speed wise
What site is that?
I have a asigned a simple web server to run with 6mb. And it support over 100 clients per second without problems
my router allows port forwarding but does not, any time you put a port in it gets blocked by its own firewall
Urbandictionary, ofc
I trust Urbandictionary with slang definitions :p
So do I
the thing is my pc does not even handle an mc server and mc, so yeah even if my internet was better i still couldn't host
my point was while you don't have great speeds, those who are going to be using your plugin or the sites that host the servers generally have such high speeds that ultimately it doesn't matter 😛
Meanwhile me getting 20k ping requests to my update server
my dedi, I had a gigabit connection
LOL
2.3mb for such a connection is nothing at all
but most dedi's in data centers generally have gigabit connections
Please take me out from latam
at minimum you might have a 200mb connection
How i can disable the mongodb logger?
some pings are 0-100 ms others are 200-20k
Import the no-op logger.
how do you make player-specific config
wdym
like each player has their own config
Didnt understand. To complex btw
Kotlin with the serialization api in bukkit
declaration: package: org.bukkit, interface: UnsafeValues
A file per player?
I didn't forget about you @gleaming grove
either make a new file or do this
no, just each player has config
thank you
Literally just add a dependency to this and it works.
My mvn dependency its not working idk why
😕
I think i having a cache problem
sounds like it needs to be replaced with a newer maven version
its what I do with software that doesn't work
it gets replaced with a new one 🙂
there is a command to clean out the cache in maven
Logger.getLogger("org.mongodb.driver").setLevel(Level.OFF);
Mnns
That worked btw
same
so much hours why?
driving nearly to the east coast in the US
i personally am gonna sleep
Lol i have just get up
however one of my family members wants us to drop them off at family in Southern Cali bay area
we are in northern Cali and the mountain pass isn't passable
so how do i make it so every player has their own config
Let talk via dm
or thread or smth
Anyways verano I don’t believe spigot rules state that your plugin must not depend on internet or sth
so I am going to be driving to go to so-cal, then b-line it for arizona where I already have a hotel room because by the time I get to near flagstaff it will have been nearly 12 or so hours 😛
fortunately even though I am driving 2,550 miles
there is 3 drivers
Maybe the premium guide lines altho it should be fine if you leave download links to potential services such that it can be used w/o the dependence of internet
what class use to hold Date in java? i thought OffsetDateTime would be good but Gson don't really like it
Gson got broken time type adapters I believe
At least it used to
For a long time
Very long time
so any alternatives for OffsetDateTime ?
Could write your own type adapter
Yeah might be needed
How do i export my plugin from Intellij into my server?
Do you use maven or gradle?
maven
<outputFile>${project.basedir}\builds${minecraft.version}${project.name}_${project.version}.${project.packaging}</outputFile>
try this
but with own path
Expand the window in the up/left corner
Then click install
should generate a target folder in your project file tree
Do I need to prop drilling the plugin instance in order to access it from other components? Or is there some magic static method that can do that?
@quaint mantle var instance = Main.getPlugin(Main.class); this is one way
where?
if u expand the lifecycle
wat... where are you getting this "Main" class?
in my case Main is the class that starts plugin
i prefer to use Dependecy Injection
and i guess thats all options, by Static (getPlugin) or Dependecy Injection
Appreciate a lot, thanks
Here you have sir
guys
TimeUtil#format("1m") -> will give you the mili-seconds
TimeUtil#parse("m", duration) -> will convert the mili-seconds to minutes
That how works
hi
hi bruh
Hi, please tell us what do you need help so we can help you
found it! Do I just take the .jar file into my server or the entire folder?
maven or gradle?
maven
the snapshot file?
No problem just tag me for help
apprecieate the help
thank you it works
Allright
Omg i couldnt solve this error
Btw
I will have to a dept reasearch on google
I remember having the exact same problem
don't recall the solution toh
Google will help you
You are probably missing the api implementation ... i'm start to remember
I didnt understand
Oh i have imported their driver, via maven
so im spawning shulker bullets to orbit the player in a circle
when they spawn they circle some offset by one block in a cardinal direction relative to their starting degree for about 10 seconds before just magically changing their orbital center to be around the player
is there any reason why this is?
public class ShulkerOrbit extends BukkitRunnable{
private ShulkerBullet shulker;
private Player player;
private int n;
private double oldDegree;
private double degree = 0;
public void run() {
oldDegree = degree;
Location playerLoc = player.getLocation();
playerLoc.add(Math.cos(degree)*(n == 1 || n == 3? -1 : 1), 0.5, Math.sin(degree)*(n == 0 || n == 2? -1 : 1));
shulker.teleport(playerLoc);
shulker.setGravity(false);
shulker.setTarget(player);
shulker.setGlowing(true);
degree = (degree+(Math.PI/20))%Math.PI;
if (oldDegree > degree) n = (n+1)%4;
}
public ShulkerOrbit(double degree, ShulkerBullet bullet, Player player) {
this.degree = degree;
shulker = bullet;
this.player = player;
}
}
Maybe this can help you:
https://www.slf4j.org/codes.html#StaticLoggerBinder
Thannks
Please format your code with:
code here
i did though?
you can attach the highlighting that is pretty nice
whoops
Generically speaking, dependency injection wins; For spigot plugins it does not matter.
Thanks a lot
It’s a bit hard to rant about why, unless you have a deeper understanding of Java and object orientation. But yeah (:
Yes because some people said:
1- Static methods consume to much resources
2- Singleton has some problems
So idk what to use
What lmao
First one is false
Second one is true and false
It has cons and pros like all things
2nd depends from thread safety and implementation
A bit late but the entities don't seem to move, the entity ladder always faces the same way and when i move it follows me perfectly
badly implemented singleton has problems when it comes to mulitthreading
synchronised to the rescue or ... a static holder class
And if you don’t know a jack shit about concurrency, even guice provides some stuff to do it for you
synchronized kinda sucks
but yeah
you can avoid it
Im talking about class methods, fields, etc. Like some people recommend me using statics and others using class instance (singleton)
Yes much better off using a ReentrantLock, tho it depends on how many threads will be accessing the singleton
static methods usually boils down to 4 types
no 😦 i dont want to
- Static singleton
- Static helper method
- Static factory method
- Utility method
For fields
if it’s a constant or stateless object, or if lazy static singleton might require a non final static singleton
singleton is a design pattern
got it
Ya, pretty sure google got some fairly sophisticated explanations
_zer0 just reminding us that hes here like: 👍
I like listening more than speaking
i see that lol
To be fair I use static singleton for my plugin instance lol
So im using jackson Json for data storage
Idk if anyone is familiar with that
Anyway
Oh god Lombok
Should i just get the map
ik, im trying it out cause people told me to
I dont like it so far
Who told you that
mfnalex
what's wrong with lombox, i told him
Don’t listen to him
Straight to jail
Or well at least in this matter
Although if you don’t want contributions I guess lombok is an effective tool
Should i get the map, and then use .put() or should i make a method in this data file class for it?
package me.silentprogram.betterbounties.jacksondata.files;
import lombok.Getter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public class Data {
//On every kill, check if player has claimed bounty in playerBountyMap if they do, loop through claimed bounties and check if the person killed was a bounty
@Getter
Map<UUID, Bounty> bountyMap = new HashMap<>();
@Getter
Map<UUID, List<UUID>> playerBountyMap = new HashMap<>();
}
Its litterally just this as the class
Well
I very much advice you to encapsulate the map
And not just expose it
And then serialize the class instead
you mean use private rigth?
pretty sure thats what its doing
@Getter
public class Data {
//On every kill, check if player has claimed bounty in playerBountyMap if they do, loop through claimed bounties and check if the person killed was a bounty
private Map<UUID, Bounty> bountyMap = new HashMap<>();
private Map<UUID, List<UUID>> playerBountyMap = new HashMap<>();
}```
Yeet the @Getter
you can use getter like that
I still need to access this data form outside the class
Provide methods from the Data class itself
alr
make the class speak for itself
no, its not about lombok its about code architecture
I probably will stop using it
Well partly but also encapsulate your data rather than just exposing it
Else you might be better off with a public field instead
And even more depending of how much i use it in a jar
conclure
Well I’m against lombok because it’s effectively useless and too ide dependent
Are you telling me to make it private, and make a getter and a custom .put method?
Inside the data class
Yes
aaaa
And cya then
You don’t
Only the Data class itself can touch the map instance
If any other class wants to flirt with the map
Then they must go through Data themselves
do some methods for getting or setting data in hashmap like that
so you can control flow of data
^
what is SpigotBean
it's attribute for my own implementation of Dependecny injection
You got your own di framework?
ye
I should make my own DI framework
That’s interesting
Optional<T> .....aaaaahhh....such a lovely class. I'm melting...
So does it just instantiate the declared constructor Jacek?
optional its for sync or async?
High abstraction over null
yes
Nothing to do with concurrency actually verano
Anyone know how to help me, Cloud (the plugin seen with the error) works perfectly fine before i add my hub core, when I add my hub core I get this error. Anyone understand what might be the cause of this?
Hmm what if you have a static factory?
and a good one at that 🥺
optional is to return object that could be empty
Yaaaa
maybe he is asking if it's thread-safe
I think Guice still uses standard reflection.
Yes
I could probably over-optimize it with ✨ method handles ✨
oh
But possibility
i get all Injected objects like that, or they are automatically deliver to constructor
I mean Unsafe would be the fastest option actually
And what if you have two constructors jacek
You could essentially recreate a constructor
Ye true
or like that
Hmm
hmmm i need to check to be honest XD
Ah right lol
propably i forgot about this case
Unsafe.allocateInstance + Unsafe's field reflection methods
for sure it works if one constructor has no params and second has some
Yuh, so we’ll get Maow’s IO lib and Maow’s DI framework
Ah, but if you have two bi constructors
If you have two bi constructors
Oo yeah
they'll probably kiss 😳

ok i was lazy, so i always get first contructor
and thats good enought for me
There’s just so many times we have two constructors right
especially with classes to Inject
Yeah
SpigotBean? just call it Bigot
i mean in company i working for there is no class that has 2 constuctors
wait
Yeah well same when I worked professionally
good one
I just tilted towards static factory methods
Spygot 👀
so in case of static factory i just getting injected classes from Injection container
chinese spigot
HAHAHA
Hmm I guess
i mean i would get
FUNNILY ENOUGH
maowhist
ONE OF MY FRIENDS GOT MAD AT ME YESTERDAY FOR MAKING A CHINESE JOKE
Well I use guice time from time but I find it hard because the static analyzer can’t work well with it
And the compiler
So it’s a bit meh
I dislike Guice because it doesn't make any fucking sense
😔
What I'd do is combine annotation processing and unsafe reflection
So the annotation processor would generate bindings files
So basically dagger
And then the framework would read the bindings to find out what provides what
And then when you would retrieve an instance for a class from the framework
do you know how can i add own code generator to Inteliji?
It would use the bindings + unsafe reflection to construct an instance of that class
The benefit is that you only have to use annotations and like minimal injector calls
One word
Gradle
:3
Maven has support for annotation processors tho
Yeah
I'd argue Maven support is actually better than Gradle's
Hmm well gradle’s configurability is op
O
And it'll use TOML as opposed to Groovy/Kotlin or XML
Oh that’s interesting
But with the added ability to define a build src plugin like Gradle
With what langauge?
Java
Ah
I don't want to tether people to Groovy or Kotlin like Gradle does
Why not kotlin
Because sometimes I just want to write something in Java for my Java-based project.
Kotlin is a bit slow to compile.
Then they can use Kotlin lol
Good
Kotlin is a JVM language, it supports Java libraries
Oh yeah also I won't do any weird shit like what Gradle does
D A E M O N S
And supporting C++ compilation
Or deprecated features
Or a wrapper
Hmm fair
For Facere, the version being used shouldn't really matter
Hell I wanna make sure that I don't have to put in any additional work to allow it to support newer Java versions
Your buildsystem failing to work is one of the most infuriating things ever.
Which is why I will also prioritize good error handling.
gradle when it cant find a class / method u used for a build task bc it got removed 3 major versions ago
Gradle when you're modifying a 3 year old project
There's always some weird problem with that :p
But yeah
Speed is also a priority
its amazing how backwards-incompatible gradle is
Which is why TOML is being used as opposed to a buildscript like build.gradle(.kts)
Yeah, I hate that groovy dsl doesn’t tell me what’s deprecated also or well IntelliJ’s fault perhaps
Yes Ik kotlin dsl
I hate that the Groovy DSL doesn't tell me what the docs are for the method I'm calling.
That too lol
I never felt happier than when I swapped to the Kotlin DSL and all of my Gradle-related problems were mostly solved.
lets all switch to sbt
Yeah, kotlin dsl makes it a bit more doable
Let's all use Ant 😎
🌞
This also means no unnecessary reflection or DI usage.
I want it to be able to run as fast as running Javac by itself most of the time.
Ah yeah I'll also steal some ideas from Maven, like maybe archetypes.
Since archetypes are nice for setting up frameworks.
And I have this very based opinion when it comes to Gradle
We don't need tasks.
Let me know when you get a test build I can try out 
Aight I'll contact you in 1.5 years.
Consider it considered
all i want in build system is repos dependencies and a built-in fat-jar generator
Oh yeah I was planning on adding some shading features
the amount of times i actually need to shadow stuff in to my projects bc i make standalones
Same
I'll also add additional stuff for MANIFEST.MF generation in case you need to do a Main-Class thing or whatever.
cba to learn that one shadow plugin everyone else uses tho, i just kinda make a new configuration that compile[Only] extends from
You don't have to learn it.
i cba to use it then
It just automatically adds stuff under implementation or compile to the jar.
Also use implementation not compile
compile is slower and deprecated.
da hell da differnece
There is no difference.
wtf
Apparently the name was misleading
compileOnlyApi iirc also
And then runtime-only also?
I believe gradle got it tho you end up using it once in a blue moon
magic voodoo not needed to compile
out of curiosity, someone here writes code as a professional?
I don't even know how 3 gradle
I use implementation and yet it still yells at me over transitive dependencies
Question: When I do Bukkit.getWorldContainer().getAbsolutePath() there seems to be an extra character added to the file path
Is this regular behavior?
Weird
. Just means that directory
Shouldn't affect you in any way
You can normalise if if you want
you may get rid of it using Paths.get and then normalize()
From time to time
Got it, idk why ig but I’ll do that,
Sorry I didn’t respond earlier
Things got crazy
Well basically it defends your code against yourself
(There are other reasons) but that’s one clear reason why it most likely is going to be a beneficial choice
in simple words if you want to work as programmer just stick to this approach
Yeah there’s a lot more to it
For instance if you decide you wanna refactor the code (which is a semantic change to the system which does not change behavior) and switch to another implementation, let’s say a list, then other components of code which depend on the Data component won’t likely get affected as hard as they would if they were to depend on the map directly. More over does it make the Data class a unit which might be worth testing. Over and above all you make your class speak for itself so in other words, you’re bound to write code that explains itself much clearer.
looking for help to my server !
how do i get a player's luckperms prefix?
If you can tell us the issue, we may try to provide a solution
Also if it's not a coding issue ask in #help-server
Hi
Anyone know how to get rank expire time from Luckperms api?
I cannot find in their documentation
Is this what your looking for?
https://luckperms.net/wiki/Developer-API-Usage
Yes i have already red the api
But i couldnt find how to get the rank expiration time
Like i want to show on scoreboard when your rank will expire
Ok
Sorry I work help but I've never used that api
Is there some sort of delay between WorldSaveEvent and the region files actually being written?
I seem to have issues with saving data, but calling /save-all works
Hmm, how are you trying to call it?
Nothing I can see from WorldSaveEvent that would say it should be delayed in any way (in the JavaDocs that is)
I have a listener for worldevents that I add a callback to (when WorldSaveEvent hits, run runnable)
So I indicate a runnable to run (which saves region data elsewhere), call World#save and it's giving me the old data
hmm
?paste
hello why this is deprecated ?
public void hoverEvent(TextComponent component, String message) {
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder(message).color(ChatColor.WHITE).create()));
}
any idea why this instantly crashes the server without errors? (used to work, didnt touch it and now it doesnt)
https://paste.md-5.net/atikuzavav.java
Witch part is depreciated
the new HoverEvent()
Are you calling this async?
You know you don't need the times loop right
when are you calling that?
when a command is run or when the player takes a finaldamage which is higher than their health
ok restarted the server now theres error spam
looks like that methods only way of exiting is by crashing
user.getCachedData().getMetaData().getPrefix()
unless
thats the best feeling ever
this stuff never changes, always a pleasure
It was deprecated in favour of a new constructor. See the docs for that constructor
https://javadoc.io/doc/net.md-5/bungeecord-chat/latest/net/md_5/bungee/api/chat/HoverEvent.html
It now requires a type of Content, which can be one of either Item, Entity, or Text
i want to stores a text so how do it ?
new Text() instead of the components
Basically just wrap your component in new Text()
got it thank you
[Server thread/ERROR]: Could not load 'plugins/PluginName-1.0.jar' in folder 'plugins'
Attempting to make my first plugin on IntelliJ (maven), I've got the Minecraft plugin installed on IntelliJ so most is done automatically. All I did was installing it from the Lifecycle folder, and retrieved the .jar from the target folder. To which I transferred it onto my server. Any tips?
whats the rest of the error
That's all I got..
I did use a filter tho so hold on
Ima setup a test server rlq
Got it!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
c;; Is I have the wrong glasses on a valid excuse?
2nd line of your error tells you exactly whats wrong
I'm aware of this, but I'm not certain how to fix the problem. I just started using IntelliJ
I did just now realize that I have this thing called searching, however
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Haha yea I love that gif
Anyone know why the mongo cloud its not creating the collection when it doesnt exists?
I'm having trouble using HEX color codes when setting the chat format using setFormat
method for translating hex colors:
https://pastebin.com/8TMvgS5w
It doesn't work when I do it like this: https://pastebin.com/yP51x9cw
But it works when I do it like this: https://pastebin.com/LKyztrwW
The only issue with that is I don't want it to translate color codes in the message
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
??
report
is there a way to get the texture of a players head using the spigot api?
value for what
?!?!?!?!?!?!!?!??????!?!?!!?!?!?!?!?!?
@ancient plank
@ancient plank help here
?ban @chilly prawn toxicity off joining
Done. That felt good.
Thanks
🙏
Sorry for tag adele
i dontthink so
but with nms you can
well i found out how to get the full skin
but now getting the head will be annoying
?
well
Someone toxic
If you remember, DM me it lol
He was already banned
I'm still curious as to what was said though 😂
Am i making things too confusing?
import java.util.*;
public class Data {
//On every kill, check if player has claimed bounty in playerBountyMap if they do, loop through claimed bounties and check if the person killed was a bounty
private Map<UUID, Bounty> activeBountyMap = new HashMap<>();
private Map<UUID, List<UUID>> playerBountyMap = new HashMap<>();
public void acceptBounty(UUID playerUUID, UUID bountyUUID) {
List<UUID> bountyList = playerBountyMap.get(playerUUID);
bountyList.add(bountyUUID);
playerBountyMap.remove(playerUUID);
playerBountyMap.put(playerUUID, bountyList);
}
public List<Bounty> getBounties(UUID playerUUID) {
List<Bounty> bounties = new ArrayList<>();
for (UUID i : playerBountyMap.get(playerUUID)) {
if (!activeBountyMap.containsKey(i)) {
removeBountyFromAll(i);
continue;
}
bounties.add(activeBountyMap.get(i));
}
return bounties;
}
public void removeBountyFromAll(UUID bountyUUID) {
activeBountyMap.remove(bountyUUID);
for (UUID i : playerBountyMap.keySet()) {
for (UUID bounty : playerBountyMap.get(i)) {
if (!bounty.equals(bountyUUID)) continue;
List<UUID> bountyList = playerBountyMap.get(i);
bountyList.remove(bountyUUID);
playerBountyMap.remove(i);
playerBountyMap.put(i, bountyList);
}
}
}
}
Ignore the comment
You should be able to infer what the methods do by the names
But ask me questions if your confused
Idk if im making things loop more than they should
It feels hacky, idk why
With acceptBounty() i feel like theres gotta be an easier way to do this right?
less lines?
In acceptBounty() and removeBounty you could definitely shorten it a bit, hashmap.put() overwrites any previous values for that key, you don't have to remove the key-value pair first.
org.bukkit.plugin.InvalidDescriptionException: name is not defined
at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:876) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:228) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:157) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:305) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
at java.lang.Thread.run(Thread.java:823) [?:1.8.0_272]
Caused by: java.lang.NullPointerException
at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:869) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-f4830a1]
... 7 more```
hi can someone help me?
hello?
@night patrol it says right there. "InvalidDescriptionException", so there's something up with your plugin description (plugin.yml). It also tells you exactly what: name is not defined. So the name field in your plugin.yml is missing.
main: org.hammer.Main
version: 1.0
author: obsidian```
idk what i type wrong name?
name is not defined, you only have Name. two different things
lmao
capitalization matters
thank it working
@EventHandler
public void onBlockBreak(BlockBreakEvent event){
Player p = event.getPlayer();
Block block = event.getBlock();
if (p.getItemInHand().getType() == Material.GOLD_PICKAXE) {
if(block.getType().equals(Material.STONE)) {
Location loc = event.getBlock().getLocation();
event.getBlock().getDrops().clear();
loc.getWorld().dropItem(loc, new ItemStack(Material.GRAVEL));
}
if(block.getType().equals(Material.GRAVEL)) {
Location loc = event.getBlock().getLocation();
event.getBlock().getDrops().clear();
loc.getWorld().dropItem(loc, new ItemStack(Material.SAND));
}
if(block.getType().equals(Material.SAND)) {
Location loc = event.getBlock().getLocation();
event.getBlock().getDrops().clear();
loc.getWorld().dropItem(loc, new ItemStack(Material.CLAY));
}
}
}```
hmm what wrong with my code
it have no errors but still not working
does it? Ive had issues in the past of it not doing that
I do it all the time with no issues
can someonehelp?
block.getType().equals(Material.STONE) use == for Enums, not .equals()
is there a way to tell if a player doesn’t load a server resource pack? does spigot know anything about that i’m not sure how it works
PlayerResourcePackStatusEvent might have what you're looking for
thank
it still not working ;-;
Throw in some debug println's in to figure out where it's getting held up
What version are you coding for?
ah 1.12 nvm
So, I've got a design question for you all. Is dependency injection of our main class really necessary? For example, I've noticed I've just been using the built in getProvidingPlugin method throughout my classes. It seems pointless to require each class an instance of the main because I believe all plugins are singletons. Am I missing something here or...? Here's what I'm talking about.
https://www.spigotmc.org/wiki/using-dependency-injection/ goes into detail here a bit
I mean I suppose you could argue its less safe because its "JavaPlugin" rather than our plugin object, but then again I can just cast the name of the class and is that not essentially the same thing?
Will checkout, thnx
which event will be called when player kill a mob?
EntityDamageByEntityEvent, check entity health - event.getFinalDamage() <= 0
does it include ranged weapon damage and cause fall death?
e.getCause().compareTo(EntityDamageEvent.DamageCause.PROJECTILE)
thanks
Hopefully that works for you, I've not gone into that end of things too much
xd I am check it out, probably works
cancel EntityShootBowEvent for crossbow will not return the arrow but set crossbow to empty load, is it intended behaviour?
it doesn’t really matter but yeah, for speed di is faster, and tbh i think it is just more of an expected java syntax that the getProviding is
How can I handle 10 quad + in code?
Big Integer?
The question being do you really need to handle such a large number?
name: Spigot-ExpTech
version: 22w02
author: whes1015
main: Spigot_ExpTech_whes1015.whes1015
commands:
et:
description: Control ExpTech Plugin
usage: /et <args>
permission: exptech.admin
cam:
description: 自由視角
usage: /cam
permission: exptech.admin
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(Objects.equals(label, "et")){
if(Objects.equals(args[0], "reload")) {
plugin.getServer().getPluginManager().disablePlugin(plugin);
plugin.getServer().getPluginManager().enablePlugin(plugin);
}else {
logger.log("WARN","onCommand","Unknown Command");
}
}
if(Objects.equals(label, "cam")) {
System.out.println("1");
}
return false;
}
Why I can't use cam command?
>cam
[15:58:04] [Server thread/INFO]: /cam
>cam
[15:58:04] [Server thread/INFO]: /cam
>cam
[15:58:05] [Server thread/INFO]: /cam
did you register your command executor?
