#help-development
1 messages · Page 891 of 1
i already downloaded
Then throw it into your project and build an artifact
ALTERNATIVELY, use spigot's libraries feature
Given that it is on mavenCentral, that should work if you are on an up-to-date version
I'm on version 1.20.4, how can I call the function
Which one?
in maven give me this error when i try install
erm, does anyone know why my compound interest ain't working correctly?
private fun getEnchantCost(currentLevel: Int, increaseLevel: Int): Double {
val increase: Double = enchant.getIncreaseProgression() / 100
val initialCost: Double = enchant.getInitialCost()
val totalLevel: Double = (currentLevel + increaseLevel).toDouble()
return initialCost * (1 + increase).pow(totalLevel)
}```
1 = 1.1K
5 = 1.1K
25 = 1.2K
50 = 1.4K
fastboard
If you use maven, then dont add any jars to your project manually

idk i see in internet
If you intend to build this plugin a year or two, I urgently recommend to not use system, it is deprecated for removal
what i use? provided?
provided and hunt down the repositories in which the dependencies are included in
you can send me a example?
https://mvnrepository.com/artifact/net.luckperms/api/5.4 for luckperms, for example
Does getIncreaseProgression() return 0.0 - 1.0 or 0.0 - 100.0?
but some plugins dont have this
currently its returning 0.5
for 0.5%
EZRanksPro probably does not have a repository attached - in that case you need to use the classic mvn install:install-file [...] workaround most people here can tell you more about (I use another workaround but can't be bothered to explain that one)
Vault is also available via maven, though only via the jitpack repo
Hi @eternal oxide ! I develop my plugin that changes player skins and use your code of PlayerSkins. All works perfectly on player join, but when I try to update player skin on another event it takes 30 secs to load and it loads first layer only. Can you please give me some advice what should I do next, I'll be so grateful
First layer only means you didn;t se the correct flags.
Probably something up with your EntityDataPacket
I mean your values look completely fine to me
Why do you think its not working?
i dont see any tutorial to use mvn install
well i'm adding 0.5% (0.005) each time, and those numbers are so close together. Should i increase the progression?
thanks a lot
1 and 5 shouldn't have the same value
0.5% isnt much
The exponential growth properly kicks in around lvl 220
hmm let me increase it to like 1%
the problem is that the max value will be like 25K
should i use a different algorithm? Im calculating the enchant cost, without having to loop
and i came across compound interest
ig it would be fine since i kinda do want it kinda easy at the start then get harder the more you play
does it ever happen to anybody that your ssh connection just goes on a disconnection spree
like i connect, i do stuff for 20 seconds and it disconnects me
and that happens like 10 times
then it stabilizes again
happens at random points in time
i'm not too bothered by it and i'm not gonna try to fix it unless someone actually has encountered such a problem and knows what exactly why it is & a solution
Sometimes you have a certain .jar file that you need as dependency, but the author of that .jar was too lazy to properly upload it to a public repository. That’s bad, but not a problem. There are two ways to solve this, but only one proper way. The proper way: install the dependency The proper...
the pom is irrelevant, the maven artifact resolver still works with just the jar in place
(hence why this is still just categorised as an INFO)
give me the same error
Cannot invoke "java.io.File.mkdirs()" because the return value of "java.io.File.getParentFile()" is null
What is the full stacktrace?
And where exactly does this error occur?
Assuming this happens while executing maven's package goal - are you using IJ's built-in maven integration or are you using the system's maven installation? If latter, how did you install it - manually or via a package manager? Does the maven local repository exist under %userhome%/.m2/repository?
Can you tell me how I can put text with RGB changing color effect?
```<language>
<code>
```
But that is irrelevant for stacktraces. There generic code blocks or a plain paste suffices
How can I have a plugin start with root permissions?
root permissions as in ?
Run server with root perms
Altrough there is probably no reason to do it
Why on earth would you want that
I need it
You most likely don't
ignorant
It's aways better to give correct permissions then just toss in root
what if somebody has a server on a hosting and doesn't have access to the server starting file?
Regardless, you can only start individual processes as the superuser - nothing else
?
So what you are asking for is a privilege escalation exploit?
which you generally need multiple of
Don't see how, but okay ig, gl
I see absolutely 0 reason to need root permission.
Well that specific example is attempting to making use of a software vuln
I just need access to the iptables
and I need root perms for that
but ofc, all of you are quick to judge
Well that is an appropriate use
(or ignorant)
You should have opened with your purpose
^
no
I was taught here to not state what I'm doing unless absolutely necessary
Well, you were taught wrong.
mmm yes, amma hack
I feel that virtue was self-taught.
so, how can I do it?
sudo
Compromising system security should always be a red flag.
sudo iptables ...
Won't work lol
/\
because
That would be a free privilege escalation exploit right there
They seem to want to ignore those
Of serious magnitude even
iptables sounds like you're trying to mess with a ban plugin of some sort, but we wouldn't know since you won't tell us what you need access to that command for.
serious XY problem here
firewall
wut?
if you're not gonna help then shut it
I did
I mean you could set the executable bit for the iptables wrapper script to allow non-root access (so something like 777, but I am not sure if that even works)
It likely wouldn't
every info on the web that I found
tells me I need root perms
and they are correct
for any iptables interaction
I know a solution to his problem, but idk if I want to say it.
Is it time for plugins with ring 0 level access
Depends on if he already has root access to begin with.
Apparently you can also modify the /etc/sudoers file to whitelist some wrapper script so it has superuser perms
well depends
but lets say that yes
Depends....
on who uses the plugin
why exactly does this need to be a plugin
I can always just tell the user to start this file for extra performance
If the JVM process is executed as root you can execute the iptables command with no problems
if this is like a fail2ban type thing
this very thing interacting with the firewall does not
but it would be an addon to the plugin
to have the firewall be extra fast
microoptimization
(really necessary, like there's some great exploits)
bro stuf
Just run server as root
you don't even know why I want to do it
But we do.
no, because you won't tell us
if it were microoptimizations I wouldn't do it
Otherwise we can't give you a good solution.
You seem to like playing this game of "let's see how little info I can give and ask for also outrageously-dangerous solutions to these problems"
That is exactly why it's important to explain what are u trying to do
bro I don't need you blabbering if you won't help
Right now https://serverfault.com/a/636449 is the best option you have.
Running the entire server as root is very dangerous.
Anything else is impossible unless you somehow find a way to run iptables without superuser perms
Firewall
I know that running the server as root is dangerous
Putting others down and insulting people for asking for more info or giving possible solutions is not a good idea
so I came to ask for that as well
You have been given the solution
(many)
and told the ramifications and side-effects
Running the server as root is as simple as logging in as root and running the start script. Or using sudo.
Yeah, hence you don't and instead only allow subcommands to be executed as root but for that you need to modify the sudoers file. There are no reasonable alternatives that I am aware of.
I came to ask for the soultion
And you got it
I guess you could change the path of the iptables installation to not be within root? But requires even more setup on the user's side of things
still wouldn't work
it interfaces with the kernel
modifying iptables is a privileged operation
But what about the underlying database?
Yes, but what if we were to change that? If not - well then modifying sudoers it is. It is basically a one-liner anyways in terms of effort so there is little to complain
Aren't rules stored in ram?
log(n) space complexity
Still need sudo perms in this instance though.
At worst they are cached in ram
You need sudo somewhere along the line - no questions asked
You just have to ask yourself when you are going to run the sudo
Reject incoming packets from ip using nms 🤔
that still incurs the overhead of netty
Why would iptables need database? 
Basically the idea is to move the firewall a layer down instead of keeping it on the application layer
Database as in a file where all rules are stored in
also not sure what "great exploits" there are
since you can't store them in volatile RAM
not fast enough
I'm already doing that
But I mean iptables probably loads them into volatile RAM on startup so there is little point in doing so
Bros can do rest api for iptables and run it on root. Users can do post/delete requests with that.
Sooo, we're dealing with packet spam of some sort then?
Or socket
well analysed people.
Not much we can do other than speculate without being told what the actual issue is. :p
ddos
You are not gonna stop ddos with iptables
Yeah, but this was known from the get-go
You want DDOS protection, look at cloudflare
it's still much faster than netty channel close
Attacker have multiple ips
I know
One of them can be your client
?
it's just enough
for it to be iptables
Well the lower the firewall is the more bandwidth you have available for the upper layers
Okay well you've been given the solution to use iptables
What more exactly are you looking for?
They found the option out themselves
Now I assume they want to automate that via a plugin. Hence, running iptables from a plugin. Which requires root perms. So you need to give it root perms
but how can I use them?
how can I gain access to them?
You've been told....
show me
/\ bruh moment
That is the funny thing: There is no way.
you were annoying
This is impossible within the constraints provided.
hmmm
Isnt it hosting's job?
Technically speaking, if you are running on a shared host it is not the responsibility of the server admin to avoid a DDoS
Preventing ddos attacks
yes
they allow all connections if they disguise themselves as minecraft traffic
big brain
I mean
There won’t be a “fix”
Provider
Even on hetzner's could infra you don't have access to iptables as-is afaik
Tipp of the day
Cloudflares “fix” is by just throwing more resources at the issue and outresource the ddos attack
well yes
Kind of hard to do anything else
True
But uh, in the case of hetzner the firewall is not built into the VPS but rather somewhere else in the datacenter
I expect most other big datacenters to behave similarly
Anyways, does anyone know any annotation built into the JRE (Java 8) that has the TYPE_USE target and is public API?
I'd say no - but perhaps there is some random annotation that actually fits (as said, it can be literally anything, it just needs to compile)
@tender shard doing what you said, i hope it doesn't take forever again, also i created this heapdump while the server was set to 12GB ram
so i want to code a plugin that toggles seeing glowing effect on players (for the command executor). Do i need to use protocollib or something?
for all players?
no, for command executor
?jd-s
its not working
i've a gen 3 ssd, why?
Nah, it's your RAM. Heapdumps are friggn massive and 8 gigs of memory is a lot less than needed unless you go with unconventional tools
Btw: You are killing your SSD right now as it is using your SSD as a replacement for the RAM.
i know i'm damaging it
but i'm damaging my player count too with this memory leak on my survival server
mfnalex said 64gb swap may help you, but it doesn't
Swap is incredibly slow. You should benchmark and find the memory leak.
benchmark?
*profile
well i did, everything looks kinda normal except a huge PlayerMoveEvent and Location instances in memory
Spark has a pretty nice memory inspection tool
Would you mind sending what you found?
sure. i'll send it in dms but before that i've to find it in activity log or creating another one
also i have 32gb on my pc, it loads the heapdump easlity in visualvm but it can't calculate the gc roots and refrences
takes over a decade
sent it in dms
Hm, what jvm params do you use?
aikars
1GB of Location seems like a lot
you can see it in the link i sent
300mb PlayerMoveEvent? D:
The player moved and caused a reconstruction of the multiverse event
lol
How many people have played during this snapshot?
0 to 80 and now 40
80 at the same time, at all? i don't know
Same time. Im trying to estimate how many move events you could expect on average each second
would love to know what plugin is doing that xD
me too
Well in that case there is a horribly coded plugin which keeps hard references to the PlayerMoveEvent
Transitively increasing the Location amount
Oh gosh
I GOTTA TRY THAT
22M WeakReferences are probably a result of the Locations holding references to their World as well
oh gosh
so the question is which fucking plugin
i guess i've to purchase a VDS with 256GB memory to figure out which one
this is the only way to analyse a 12gb heapdump
i've 32gb
that's enough then
it loads the heapdump
Is a heapdump just the whole ram dumped into a file?
but it cannot compute the refrences or gc roots
i don't know just did /spark heapdump
Its object container
Quick question cause idk a clear answer
Is naming your artifact ID supposed to be all lowercase followed by dashes?
that'd be a coredump
spark's heapdump is hprof I think, that should work just fine in visualvm/eclipse mat
i can share my screen in #690688600895127683
well, no idea, anyone?
Can you tell class path of 300mb event listener?
well i have no idea how this visualvm and stuff work, but someone said to just calculate gc roots which it takes a decade, is there another faster way to find out?
lemme load the heapdump into visualvm
Do you have a list of plugins? Maybe we can spot garbage right away.
F
i'll send it to you in dms
Ive seen the slimefun package which is already a gamble to put on your machine 🙂
hmm
what should i do exactly?
my favorite
click on the lil +
CraftMetaSkull is probably just slimefun having hard references to all its tile entities ok
Is a hard reference one that causes memory leaks
No
stupid git filter-repo --mailmap didnt change anything
how i can add prefix to nps in nms?
It's just a reference to a java object
what property i need
keep clicking lil +s until you find something interesting :^)
well the second lil + on refrences lead me to wait untill 2077
Hm stream visualvm in voice?
sure
Hi, i am getting this error when i try to execute query on mariadb server and idk what causes this: [23:13:31 ERROR] [aauth]: java.sql.SQLException: No connection available within the specified time (option 'connectTimeout': 30,000 ms)
when i was try create nps with nms minecraft say "big nick size"
what query are you running
NPS?
NPCs you mean
?
an NPC
Its called NPC. Not nps
ok
Hello everyone, please help me, I can't add a placeholder with the privilege prefix "%luckperms_prefix%" to my plugin for the staff chat. Other placeholders also don't work. Help me how to add it to my plugin
"Non Playable Character"
You have to use PlacerholderAPI.setPlaceholders(…)
NMS
Hi I just cloned a repository but I cant seem to find, wheres the build button gone?
Wait till sync
public boolean usernameExists(String userName) {
String sql = "SELECT COUNT(*) FROM Accounts WHERE userName = ?";
try (Connection conn = getConnection();
PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, userName);
ResultSet resultSet = stmt.executeQuery();
resultSet.next();
int count = resultSet.getInt(1);
return count > 0;
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
Is it still setting up? Gradle takes FOREVER when you first clone a large project
Idk I just cloned it like 5 seconds ago
yeah wait
Make a coffee, come back in 20 minutes
Ok its here yay
Its probably still not done kek
does anyone know if CoreProtect needs shadowJar or not?
If its in their build file, its probably needed
how can i make string text chaging color like white A next blue A
ChatColor.X?
Impossible when alr sent
its in the Shadow folder
then probably necessary
<red>A<blue>B<yellow>C (beware: the actual syntax is something like \u00A7<code> instead of <red>, <blue>, etc. - <code> is some character from 0 to f and a few other letters. Look it up or use the ChatColor constants which have the \u00A7 "magic" character already defined)
&fA&bA
yeah but like rainbow
ah, in that case use adventure if using paper, or bungee's chat components if on spigot
Or use some more user-friendly API such as minimessage
who you have one example
i using spigot btw
Shadow adventue library(Platform bukkit) and minimessage
I always use paper when doing funny things with chat, so I don't know any examples from the top of my head - sorry.
Ye bros gonna wrap player object every time when need to send a message
Well minimessage works the same on spigot and paper, except that you need to create audiences manually
That’s where kotlin extension functions are very useful for :3
fun Player.sendMessage(component: Component) …
is anyone knows how to fix and what causes this?
What's wrong with it?
Are you using Hikari? Is your mysql connection limit set too low? Shared hoster or self hosted mysql?
[23:13:31 ERROR] [aauth]: java.sql.SQLException: No connection available within the specified time (option 'connectTimeout': 30,000 ms)
@sage patio eclipse memory analyzer has its own automated memory leak detection, I suggest you to use that instead of visualVM
Btw you never close the ResultSet i think?
lol
closing the statement closes the resultset
shared host but there is no problems with other things that connected to this mysql, my maxpoolsize is 8 and i am using mariadb jdbc
Ah ok didn’t know
what does that getConnection() do exactly :hmm:
its datasource.getConnection()
do you always get this, for every query you're trying to do with your plugin?
plugin have only one query right now
i am connecting with this
private DataSource initMariaDbLDataSource() throws SQLException {
try (MariaDbPoolDataSource dataSource = new MariaDbPoolDataSource()) {
String url = "jdbc:mariadb://" + getAnnotatedConfig().getDbHostname() + ":" + getAnnotatedConfig().getDbPort() + "/" + getAnnotatedConfig().getDbDatabase() + "?user=" + getAnnotatedConfig().getDbUser() + "&password=" + getAnnotatedConfig().getDbPassword()+ "&maxPoolSize=8&allowPublicKeyRetrieval=true";
dataSource.setUrl(url);
testDataSource(dataSource);
this.dataSource = dataSource;
return dataSource;
} catch (SQLException e) {
logger.error(e.toString());
server.shutdown();
throw e;
}
}
private DataSource dataSource; -> ```java
public boolean usernameExists(String userName) {
String sql = "SELECT COUNT(*) FROM Accounts WHERE username = ?";
try (Connection connection = dataSource.getConnection(); PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setString(1, userName);
ResultSet resultSet = statement.executeQuery();
resultSet.next();
int count = resultSet.getInt(1);
return count > 0;
} catch (SQLException exception) {
logger.error(exception.toString());
return false;
}
}```
you must not create the datasource in a try with resources
i am using ```java
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
your datasource gets closed at the end
do not use try-with-resources for creating the datasource!
because i am using org.mariadb.jdbc-mariadb-java-client in this
I told you what the issue is. get rid of the try-w-resources
private DataSource initMariaDbDataSource() throws SQLException {
MariaDbPoolDataSource dataSource = new MariaDbPoolDataSource();
try {
String url = "jdbc:mariadb://" + getAnnotatedConfig().getDbHostname() + ":" ... ;
dataSource.setUrl(url);
testDataSource(dataSource);
this.dataSource = dataSource;
return dataSource;
} catch (SQLException e) {
// ...
}
}```
ok.
😍 Never knew this, gonna start kotlin soon at my school cant wait:D
now its working, thanks for help!
np!
what's also fancy is that you can compare object with > and < lol
val myMcVersion = MinecraftVersion.current()
val minimumSupportedVersion = MinecraftVersion(1,19,4)
if(myMcVersion < minimumSupportedVersion){
error("Fuck you")
}
operator overwrite truely was the greatest invention known to mankind
we get it, you hate kotlin and every single thing it adds
:O
I really don't hate everything
I adore the delegate feature
1,19,4 looks cursed
I'd love it if java pulled that
doesnt lombok have a similar thing?
lombok should introduce operator overloading
just use manifold
true ..
Manifold dors **^
does anyone know how to fix this? this has been bothering me for days (since I updated gradle to 8.6). idk why IJ doesn't understand that there's a setter
Does Kotlin only recognize setters that return void?
yes
Rip
but why does it compile fine then?
it's only IJ complaining
when going back to gradle 8.5, it also returns T and IJ does NOT complain
gradle doesnt have friends
I just wonder why it complains about it in gradle 8.6 but not in 8.5 when the method has not changed at all
and as said, it works fine, it's only IJ not understanding it 🥲
at least it's not make
touche
Why does abstraction have to be so damn difficult?
It’s not
I guess I'm just bad at it then. 😭
We've all been there. You'll grow with experience
?paste
Why does this not change the death message ? https://paste.md-5.net/ipaxapaziy.java
did you register the listener?
Yes
It give me this error: https://paste.md-5.net/uhehamahiz.sql
then probably RoleUtils.getPlayerRole(deathPlayer) returns null
I'll check
Yeah it returned null, now it works thanks!
np
btw if you use newer java versions, the error tells you what exactly is null
in java 14 and newer it looks like this
Cannot invoke "Role.getColor()" because the return value of "RoleUtils.getRole(player)" is null
I'm using java 8
so i don't have it
time to upgrage:)
u can also do things like
if (object instanceof Player p) {
p.sendmessage()
}
instead of
if (object instanceof Player ) {
Player p = (Player) obj
p.sendmessage()
}
and lots lots of cool stuff in newer versions
Hey, I'm trying to make it so I can change the title of the GUI from outside, but for some reason no information can be passed into the createInventory method.
https://pastes.dev/h1VdnPGytc
Does anyone know what is blocking this information and what I can do to solve this issue?
once you open the inventory to someone, you got an InventoryView. And there you can update the title as often as you want https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/InventoryView.html#setTitle(java.lang.String)
declaration: package: org.bukkit.inventory, class: InventoryView
Like this?
InventoryView inventoryView = (InventoryView) getInventory();
inventoryView.setTitle(title);```
an Inventory is not an InventoryView
an InventoryView is available to you when the player opens the inventory (or is made open via Player.openInventory)
no
player.openInventory(yourInv) returns an InventoryView
no like this public abstract class InventoryGUI implements InventoryHandler {
private final Inventory inventory;
private final Map<Integer, InventoryButton> buttonMap = new HashMap<>();
public InventoryGUI(String title) {
this.inventory = this.createInventory(title);
}
public Inventory getInventory() {
return this.inventory;
}
// 5 methods irrelevant to the problem
protected abstract Inventory createInventory(String title);
}
public class BuyItemGUI extends InventoryGUI {
public BuyItemGUI(String title) {
super(title);
}
@Override
protected Inventory createInventory(String title) {
System.out.println(title);
return Bukkit.createInventory(null, 3 * 9, title);
}
}
when you next create an instince of buyitem gui example bud need further assistance lmk
BuyItemGUI buyItemGUI = new BuyItemGUI("New Title");
Inventory inventory = buyItemGUI.getInventory();
// Now the inventory will have the title "New Title"
Thanks yall, I think this should work "player.getOpenInventory().setTitle(title);" and I will also try your solution jacob
no problems have a blast with it might need to change a lil bit but if you do shoot a question here and will pick it up if you do
Anyone know datapack stuff?
If so
Does setting terrain adaptation in a structure to anything but 'none' just break it or am I somehow failing to spell
How could I use block displays to draw a vector?
every mathematician shivering
weeeeell, it has a direction also
Is line the English word for Gerade?
I mean, it isn't a gerade either
I thought a line has a start and end point
Yeah thats what i meant
Its a line between start and end point
🤓
is there any event for clicking item (like not inventory but hotbar you know) i cant find
any githuh workflow nerds know how to improve speeds, mainly with like caching dependencies
I assumed they meant a bukkit vector which is just 3 doubles or floats
Yes
It is. It just says java.lang.IllegalStateException: Failed to parse revamp:worldgen/structure/desert_pyramid.json from pack file/Structure_Revamp

That already caches stuff reasonably
Default settings haha
well it has to download and do whatever to every single dep each time i run it instead of having a local m2 with them in or smth
You can set „cache: gradle“
on setup java?
On the same level where you do runs-on iirc - IJ has autocomplete for it
appears it is on setup java
Oh ok might be
Oh yeah it should be in the „with“ part of setup java i think
you can also manually add directories to cache, sth like this
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
not sure if this is correct
when testing in act it just says this
hm mine says "cache saved successfully"
I only used this
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: "gradle" # <- this
the rest is exactly like the repo I sent above
mines this
ill try it without m atrix
same thing, ig ill try it on actual github
Huh where did you try it
act locally
seems like it caches as expected on workflows
What kind of wizardry
Hi the FileConfiguration save methods remove all " " from my config.
before:
item-name: "TEST"
item-lore: "sdfgsdgf"
after
item-name: TEST
item-lore: sdfgsdgf
is there a way to prevent save methods to remove " ?
no
You’d have to use a custom implementation of SnakeYaml
The spigot one is set to remove unnecessary quotes
For some entries they are necessary
true
but for TEST and sdfgsdgf they aren't
and .save shouldn't be dangerously removing quotes.
yep
So i figured it out... They just really like to hide the error in the log lol
Large
lol
Its like 80
so it shoukd work fine
I got it to work tho
is it doing it for everything, or just things that are normal strings?
Got a screenie. Its spawning underground for some reason but it is spawning
Is it possible currently to increase entity size and such yet (via code)?
is there a way to allow arrows shot from a player to hit players who they can't see (are hidden using the vanish api)
You’re one version too early
damn
I might make it a plugin datapack combo
🤔 https://sourceb.in/kbh7AQqg8q having the weirdest issue rn
It seems like this doesn't work
what should my POM file look like for latest version spigot plugins? how do i change the default pom file, i keep having to manually change it to 1.8 from 1.7
What is your JDK version
Could someone familiar with populating chest inventories help me out?
I'm intercepting a BlockPlaceEvent to populate a placed chest with an ItemStack[].
I want to use the Container.getInventory.setContents(ItemStack[]); but it's not working.
If I set up a for loop and use the Container.getInventory.setContents(int,ItemStack); it doesn't work either.
Only Container.getInventory.addItem(ItemStack) works, but then I lose the original placement of the items in the ItemStack[].
I have confirmed that my ItemStack[] is populated, it's just not filling the chest with the two functions I'd like to use.
Going to bed now, but if anyone has any advice please @ ping me
Thanks all
LootGenerateEvent
?
Show how you are intercepting the event
^^
Dont force an update on the BlockState in the BlockPlaceEvent. Tell me if that works.
I'm not good at nms. Does anyone know how to add a prefix to a player so that Minecraft doesn't complain about the length of the player's nickname? - https://paste.md-5.net/amaquduwol.java
how call a overridden method from children classes in parent class?
u mean super.method()?
or u mean if u have
animal and dog which extends animal and dog overrides makesound()
and in animal u want to call that makesound of the dog?
yes
but not "dog" specifically
it's like
that is not possible as far as i know
cuz how does animal know which one to use?
there might be 10 classed overriding it
i also cannot think of a use case where you would need this. maybe explain what you want to do?
I don't know how to explain this. can you join voice call and see my screen share?
sure
If I want to precreate config.yml I just add it to the same directory as plugin.yml and then in the onEnable method I do saveDafaultConfig()
But what if I want to have other configs premade? Is it possible? Or is it only for the config.yml? Because I do not really want to use addDefault method
There is saveResource method inside of JavaPlugin class
You can use it to "extract" from resources to plugin folder
didn't know about this
thanks
@sullen canyon you can use saveDefaultConfig();
calls saveResource on the config.yml
although it wouldn't work for others .yml files?
If I want to have config.yml and config2.yml it would load only config.yml Ig
Right?
lets say u have abstract class Animals with abstract method makeSound();
and with method
public void eat() {
makeSound();
}
And then you have
Dog extends Animal {
and implement here makeSound method
}
That will call the childs makesound in animal
🤦♂️
?:D oh now i get it:D
It is possile to get value of mined blocks from statistics in game menu? or i need to count it by BlockBreakEvent?
declaration: package: org.bukkit, interface: OfflinePlayer
thx
you didnt add mojang's repo
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
Which mysql api outside of the main thread do you recommend? java
Guys can you help me please? Using nms for respawning player in order to update his skin, but it doesn't work properly. It takes 30 seconds to load and loads only first layer of skin. ( if I respawn self(player) manually by nether portal, it loads without any problems)
My respawnPacket code:
CommonPlayerSpawnInfo spawnInfo = new CommonPlayerSpawnInfo(
nmsLevel.dimensionTypeId(), // dimensionType
nmsLevel.dimension(), // dimension
nmsLevel.getSeed(), // Seed
serverPlayer.gameMode.getGameModeForPlayer(), // playerGameType
serverPlayer.gameMode.getPreviousGameModeForPlayer(), // previousPlayerGameType
nmsLevel.isDebug(), // isDebug
nmsLevel.isFlat(), // isFlat
serverPlayer.getLastDeathLocation(), // lastDeathLocation
(byte) 1 // keepAllPlayerData
);
ClientboundRespawnPacket respawnPacket = new ClientboundRespawnPacket(spawnInfo, (byte) 0);```
What
I would just wrap it in CompletableFuture if ur asking that
why dont you respawn the player using the respawnPlayer() method
oh nvm that only works if they're dead
Can I somehow update skin using packets by fake killing + respawning player or fake reconnecting?
Guys, i have problem with my api.
public final class Plugin extends JavaPlugin {
private static Plugin instance;
private ColorfulGUI colorfulGUI;
@Override
public void onEnable() {
instance = this;
colorfulGUI = new ColorfulGUI(this);
}
public static Plugin getInstance() {
return instance;
}
public ColorfulGUI getColorfulGUI() {
return colorfulGUI;
}
}
public class ColorfulGUI {
private static JavaPlugin instance;
public ColorfulGUI(JavaPlugin plugin) {
instance = plugin;
registerListeners();
}
private void registerListeners() {
instance.getServer().getPluginManager().registerEvents(new GuiListener(), instance);
}
public StaticItemBuilder staticItem() {
return new StaticItemBuilder();
}
public DynamicItemBuilder dynamicItem() {
return new DynamicItemBuilder();
}
public StaticGuiBuilder gui() {
return new StaticGuiBuilder();
}
public DynamicGuiBuilder paginated() {
return new DynamicGuiBuilder();
}
public static JavaPlugin getInstance() {
return instance;
}
}
ColorfulGUI:14 is
public ColorfulGUI(JavaPlugin plugin) {
Plugin:10
colorfulGUI = new ColorfulGUI(this);
bungee Help!
Is there awau to change the /server command to something else?
Asking this because i want a custom gui to show when a user types /server or /servers
Just register a command called serber
i have but its not over righting it
would editing one of these jars chnage the command?
long temp = offlinePlayer.getStatistic(Statistic.MINE_BLOCK); ```
What is the most efficient way to count all types of blocks, because this give me error about missing parameter Material. If i need to loop all blocks?
Sure
oh, if this could lag server, when somebody have so much mined blocks?
Probably doesn’t matter how many they mined
okay, thx
Hey, idk if I remember it wrong but wasn't there an built in method to reload an custom yaml config? something like reloadConfig() but for custom config? I remember using something like this in older plugins of mine but now I cant find something like this.
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
No
@EventHandler
public static void blockPlace(BlockPlaceEvent bpe){
ItemStack itemInHand = bpe.getItemInHand();
if (skullItemIsMobHead(itemInHand)){
SkullBreakPlace.placeMobHeadSkull(bpe);
}else if (CreatureEvents.chestedItemIsContainer(itemInHand)){
CreatureEvents.chestedPlaceContainer(bpe.getPlayer(), bpe.getBlock());
}
}
public static void chestedPlaceContainer(Player chested, Block block){
ItemStack containerItem = chested.getInventory().getItemInMainHand();
if (!chestedWhitelist.contains(containerItem.getType()))return;
if (!chestedWhitelist.contains(block.getType()))return;
ItemMeta containerMeta = containerItem.getItemMeta();
if (containerMeta == null)return;
PersistentDataContainer data = containerMeta.getPersistentDataContainer();
if (!chestedItemIsContainer(containerItem))return;
Integer count = data.get(chestedKey, PersistentDataType.INTEGER);
if (count == null)return;
ItemStack[] items = new ItemStack[count];
for (int i = 0; i < count; i++) {
String itemString = data.get(new NamespacedKey(plugin, Key.chestedKeyString + i), PersistentDataType.STRING);
if (itemString == null || itemString.matches("null")){
items[i] = null;
}else items[i] = Serializer.deserializeItemStack(itemString);
}
Container container = (Container) block.getState();
Inventory inv = container.getInventory();
for (ItemStack item:items){
if (item == null) item = new ItemStack(Material.AIR);
inv.addItem(item);
}
container.update(true);
// containerItem.setAmount(containerItem.getAmount() - 1);
// chested.getInventory().setItemInMainHand(containerItem);
}
Not forcing the update doesn't work, and making a Bukkit.runnable() that delays it by a tick doesn't either.
@eternal oxide can you check it out please
Why did you ping them
I'm sorry if I can't. But Elgar is an author of the code, so I supposed that he knows the issue
An author of your code?
No, the part I have the problem with
There is nothign in teh code you posted which would take 30 seconds
You don;t send the entity data there so of course you have a single layer skin
You mean send entity data via respawn packet?
Or how can I do that
What exactly is taking 30 seconds?
Player respawn
All other players see skin change immediately
oh you just mean for yourself it takes 30 seconds to see the skin change?
what spigot version?
1.20.4
I doubt that code even runs on 1.20
oh yes it will. silly me 🙂
I haven't tested it since 1.18
only that it builds and runs
It worked perfectly on 1.18 but since I have not looked, other than protocol changes
but it does work
it changes skin perfectly, only can't refresh it for player who changes it
with dimension change it refreshes and 2nd layer shows up, so it's problem with respawning
But I have no idea how to fix that
i have another problem, my plugin building without dependencies
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.xflyiwnl</groupId>
<artifactId>ColorfulGUI</artifactId>
<version>3.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/ColorfulGUI-3.0-shaded.jar</systemPath>
</dependency>
</dependencies>
</project>
without colorfulgui
java.lang.NoClassDefFoundError: me/xflyiwnl/colorfulgui/ColorfulGUI
compiled with command
mvn clean package
Figured it out.
There's a distiction between .getInventory and .getSnapshotInventory that I didn't understand.
If I don't get the Snapshot Inventory and force a tilestate update it reverts to the previous state (???)
#7 on https://www.spigotmc.org/threads/set-chest-item.377989/#post-3437227
was the solution
imagine ```csharp
private Dictionary<Type, List<object>> eventMatrix = new();
public void AddEventListener<T>(EventListener<T> listener) where T : AbstractEvent
{
var type = typeof(T);
if (!eventMatrix.ContainsKey(type)) eventMatrix[type] = new List<object>();
eventMatrix[type].Add(listener);
}
public void RouteEvent<T> (T eventData) where T : AbstractEvent
{
var type = eventData.GetType();
foreach (var listener in eventMatrix[type])
{
((EventListener<T>)listener).OnEvent(eventData);
}
if (eventData is ICancellable c)
{
if (c.isCancelled())
{
c.CancelAction();
return;
}
}
eventData.Action();
}```
and the best part
public void RemoveEventListener<T>(EventListener<T> listener) where T : AbstractEvent
{
var type = typeof(T);
if (!eventMatrix.ContainsKey(type))
{
Logger.GetLogger().Log("EventSystemWarning: " + (listener.GetProvider() is GameListenerProvider ? "Game" : "Mod " + listener.GetProvider().GetName()) + " tried to remove listener to non-existing event");
return;
}
eventMatrix[type].Remove(listener);
}```
Since i don't really know how JavaPlugin.getProvidingPlugin(Class clazz) works and how to replicate it in c#, i stored provider as a field of every listener
Yes, I know it's with completablefuture but my API is having some problems, so I wanted an API that has already been tested in production and works well
How do yall backup your vps
greetings people
any advice on how to create worlds in code when your server is up
Got this code atm
WorldCreator worldCreator = new WorldCreator(worldName)
.generator(IridiumSkyblock.getInstance().getDefaultWorldGenerator(world.getName(), null))
.environment(world.getEnvironment())
.seed(world.getSeed());
worldCreator.createWorld();
but im wondering if this will cause lagg issues, since its creating a whole new world in a single tick
is there a way to create this async, or anything?
Async generation? good luck
all world creation will cause lag. No you can;t do it async
^
create it as teh server loads, before you need it
If you need multiple worlds you should like.. delay their generation n stuff
Any way to spread it out over multiple ticks though?
no
Nope
why is async generation not possible
because minecraft is gimmicky
probabbly same reason you cant set block states async
asscraft
idk mc is weird
For minigames and skyblock-like plugins I just use slimeworldmanager
but then again these are not public plugins
Ex javascript developer:
Thread safe minecraft when
If I need multiple worlds I create a template, then file copy and load as needed
as you can copy files async
Kopieren of files
basically we are trying to find a way to re-generate terrain in a minecraft world. the sollution we came up with is to create a new world with the same seed, and copy the blocks over
which is supper hacky, and from what I can tell will probabbly cause alot of lagg issues with creating the world
but idk any other methods which are less shit
why not just load a set number of chunks over a few ticks?
wdym?
allow the natural world gen to create teh chunks
oh you want to REgenerate terrain
yeah mb
regenerate the terrain while using a custom generator
in that case backup each chunk load if it's a new chunk
its my skyblock plugin, we are looking into adding ocean world types aswell as void types
but then deleting/regenerating the islands is causing issues since we dont know how to regenerate the origional ocean terrain
yeah, thats true I guess, but then we need to find a method to save the chunks
tbh, I guess we could just save the block states in json, serialize it to like base64 and shove that base64 in some db somewhere
i did look into just replicating the math for that portion of the world, and it does work, but we're also using the decorate method flag thingymahbob and you cant really replicate that with just math
mm not a good idea
If you are going to be storing chunk data you'd want to actually encode it in a nice way
not just toss it in a base64
proxmox
Remember, each chunk section has 4096 blocks
I mean it wouldnt be exact chunks
thats the worst part 😔
we would probabbly just get the two corners of an island, get the materials inside each island, and just create like a list<BlockState> or some object containing Location and Material
Even then you want to compress that further
since there shouldnt really be anything too fancy that we have to deal with specific orientation or any other data
Use some sort of pallette
how to override a bungee command with spigot command? I use /hub on bungee but I'd like to use different /hub on certain spigot server. It's possible?
or do I need to use commandpreprocess event?
The Bungeecord will always take priority
You'd have to make a Bungeecord plugin to get around that
what if I use commandpreprocess event?
bungee will still take priority?
yes
what
iirc its gradle 8.2.2 that has 21 support
ah right
yea
how do i even update gradle from within intellij?
easiest way is change the url in gradle/wrapper then the properties file
1.8 i think ;o
what should my POM file look like for latest version spigot plugins? how do i change the default pom file, i keep having to manually change it to 1.8 from 1.7
depends on how it currently looks. you can set the java version directly in the maven-compiler-plugin, or through properties
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
whats the link for hastebin? ill send mine
?paste
in properties, change maven.compiler.target and maven.compiler.source to 17
where is that?
in your pom?
im trying to change it before its generated so i dont have to manually change the pom file every time after creating new project
?
you can write your own archetype
ohhhh crap
here's an example of how it works https://github.com/mfnalex/spigot-plugin-archetype
it's much easier to just use IJ's new project wizard
just do New Project -> Maven and you can choose the JDK version
your spigot archtype seems like just what i needed lol
what about the spigot API version my my POM? thats correct for latest spigot delelopment? https://paste.md-5.net/olalinemow.xml
can someone help me with maven shade plugin?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
ask
Is this will be working?
int totalBlocks = 0;
for (Statistic statistic : Statistic.values()) {
if (statistic.getType().equals(Statistic.Type.BREAK_BLOCK)) {
totalBlocks += Bukkit.getServer().getOfflinePlayers().stream()
.mapToInt(player -> player.getStatistic(statistic))
.sum();
}
}
System.out.println("Total block count: " + totalBlocks);
}``` I want to count all mined blocks
List<Material> blocks = Arrays.stream(Material.values())
.filter(Material::isBlock)
.collect(Collectors.toList());
int allMinedBlocks = blocks.stream()
.mapToInt(block -> player.getStatistic(Statistic.MINE_BLOCK, block))
.sum();
sth like this should work. You wanna cache the list of blocks though. Also maybe you can also just directl use Statistic.MINE_BLOCK, i don't know
im making statistic plugin, and i dont want to count all block break events, because this is made ingame, so i want to summary all types of blocks, thank you i will check it
throws error: Must supply additional parameter for this statistic
then you have to do it for each block specifically, as I said
okay, thanks
temp = offlinePlayer.getStatistic(Statistic.MINE_BLOCK, Material.COBBLESTONE);``` in this case is the same error
so idk what is wrong with this
show the whole error message
what's BlockCountUpdateEvent line 26?
looks like you need to pass a material to it
yeah, it is a soultion, thank you much for help
(i was checking the wrong data sorry lmao)
If I want to store an area to mark it and deny certain permissions in it temporarily is it best to use hash map? Or is there other efficient ways of doing something like this?
NEW
What type of area?
DamageSource stuff got merged in, huh?
This is a fun breaking change
Hey,
does anyone know how I can create a explosion which is bigger than a tnt explosion and puts down fire, but where I can still change the block list so it only destroys certain block types in paper 1.8.8?
Vecause when using createExplosion() the EntityExplodeEvent doesn't get triggered.
Is there a reason you are using a 7+ year old version?
?whereami
I just found out there is a BlockExplodeEvent. Before then Typing ExplodeEvent it didn't show up
Hello,
I'm currently working on implementing deserialization from a Bson Document to ConfigurationSerializable. The entityClass is properly configured, and when I print the map entry, it contains the same entries as those for the Card POJO. However, despite this, the #deserializeObject method still returns null.
@Override // todo: add this in the service interface of mysql
public ConfigurationSerializable fromDocument(Document document) {
// Puts all the entries of the document into a new map
Map<String, Object> map = new HashMap<>(document);
map.remove("id"); // Remove the id from the map, otherwise, entityClass which doesn't contain id will throw an exception (?)
for(Map.Entry<String, Object> entry : map.entrySet()) {
System.out.println(entry.getKey() + " B: " + entry.getValue());
}
return ConfigurationSerialization.deserializeObject(map, this.entityClass);
}
Printed result from the for-cycle:
test B: 6
Where the entityClass gets set
this.cardRepository.setType(Card.class); // This is from the Main class
@Override
public void setType(Class<T> type) {
this.type = type;
this.service.setClass(type); // entityType == type
}
Card.class POJO:
@Data
@Builder
public class Card implements ConfigurationSerializable {
// Card type variables
@BsonProperty("test") // Mongodb impl related
private int test;
@BsonCreator
public Card(@BsonProperty("test") int test) {
this.test = test;
}
@Override
public Map<String, Object> serialize() {
return Map.of("test", test);
}
}
No worries, it's not that big 🤣
You mean because of the version bump?
Last night, DamageSource stuff got merged, but there was no version bump to go with it?
The Java version the api is compiled with was bumped is what I meant. What other “breaking” change are you talking about?
there never is
rerun buildtools for the server jar + the full spigot dep if you need it or refresh maven
Ah. Yeah. The Java version bump is another aspect of that for sure. It's breaking because I have a plugin that extends EntityDamageEvent. With the new DamageSource added to the constructor, the plugin can't run on the new build until I make adjustments, but then I lose backwards compatibility for any version before this last build.
Event constructors are not API
So changing them isn’t considered a breaking change
That is made clear in the javadocs
Extending/Implementing API types that aren’t explicitly made for extending/implementing also isn’t considered API, so any changes regarding that isn’t “breaking” either
One could argue that if it wasn't intended to be extended, it should have been made final then. Either way, it puts an interesting kink in things
package index
Thank you MD
What are you calling the event for anyway, is there not an API method that does what you want?
under that premise none of the API would exist as it is given that it's all interfaces you can technically implement, but you shouldn't
I'm utilizing the event (specifically extending EntityDamageByEntityEvent) as a "fake" event to see if any other plugins cancel the event. It's kind of a hacked way to determine if entities/players are damageable by the player before doing other things to the target entity
Maybe Damageable.damage should return a boolean
Let’s hope the enduser isn’t using smth like spartan or another event based anticheat
That was my other thought
Does that even listen to canceled events? As soon as the check comes back, if it wasn't externally canceled, I cancel it anyway
Open a feature request, it'd be pretty easy to change the new method at least
?jira
Hey,
anyone any idea, why I get false when checking for event.getInventory().getHolder() instanceof Chest in the InventoryOpenEvent and when logging the handler class, I get CraftChest, which doesn't exist?
Check you're using the right Chest import
Will do. I think that'll be better in the long run!
There's several, you want the block state one
I did
?paste
Share code
Full file
Hey md, would you be able to lend a hand with my issue?
Not chest and not doublechestie
and I don't have another InventoryOpenEvent in my project
Craft chest implements chest. make sure that's the code that's running
Does the event get cancelled
yes
Then it works fine
I have no idea about bson, but if you're serialising complex types you need to recursively handle configurationserialiszblr
I added sout s
when going into the Chest, it does not implement CraftChest:
package org.bukkit.block;
public interface Chest extends org.bukkit.block.BlockState, org.bukkit.block.ContainerBlock {
org.bukkit.inventory.Inventory getBlockInventory();
}
Well... The issue is not really about Bson:
@Override // todo: add this in the service interface of mysql
public ConfigurationSerializable fromDocument(Document document) {
// Puts all the entries of the document into a new map
Map<String, Object> map = new HashMap<>(document);
map.remove("id"); // Remove the id from the map, otherwise, entityClass which doesn't contain id will throw an exception
for(Map.Entry<String, Object> entry : map.entrySet()) {
System.out.println(entry.getKey() + " B: " + entry.getValue());
}
return ConfigurationSerialization.deserializeObject(map, this.entityClass);
}
CraftChest implements Chest
not Chest implements CraftChest
it's just a simple map, correctly converted from Bson Document
pkl?
Think they mean those programming language thingies that are specifically made for configuration
But like, it would be a real hassle to remove yaml all of a sudden
I don't think it would be that great for most plugins (if we talk Minecraft) to begin with
But yeah pkl is cool
What might be a great idea is to use validation when loading the configuration and generating a schema off of it, kinda like Zod (typescript world)
If it's like really complex, maybe
But I don't think it's that great of an idea to give a pkl config to an end user who might not be familiar with this
Lets say I have a manager, which has a method that is supposed to add something to a list. Is it okay to also have it send a message to the player (feedback to the player) , or should i do that in the implementation (when i use the manager's method). Im asking this because Im not sure if this breaks the principle of a single responsibility?
that’s hard, manager is a really high level abstraction pattern
Usually you’ll see managers being some sort of composition of other patterns
what does high or low level mean?
i heard this a lot
Again, I think it's the best idea for the end user and developer / zero error tolerance of a stable plugin to have a validation, ensuring constraints set on a configuration rather than defining those constraints publicly and putting them right into the configuration itself. Idk
and btw since when are message not highlighted that are responses to sent messages by the user (discord)?
Its a notion we talk about, it doesn’t really exist in the language itself, but you know how like a system usually has a bunch of classes, some classes will never call other classes, some classes do specific things, other classes become generalizations, after such analysis, its almost always possible to derive some tree based structure of how classes depend on each other
high level abstraction usually refers to the classes on top of everything else, those that could be api to other modules/projects, and low level abstraction refers to more concrete and implementation specific classes
Ofc its all relative, I mean if you code a sql connection pool project, that’s gonna define one abstraction hierarchy, whereas coding an entire minecraft server will have its own abstraction hierarchy
but the point of this is that you to some extent are able to isolate, moduralize and define clear types of relationships between components
okay, so in terms of my manager, it basically just adding or removing stuff from a list, and those methods are mainly called in commands, therefore im not sure whether i should send user feedback in the command itselfs or just implement that into the manager's methods. But that would break the principle of a single responsibility, right?
Single responsibility principle by definition says that a class must only be held one major reason for it to change
for instance, you wouldn’t wanna change the CommandParser class if you needed to migrate the database module
if the functionality of command parsing needs to be changed, improved or altered, then that’s the only reason you’d ideally wanna reason about in order to change CommandParser
This principle is vague, and there is no clear definition, but usually its good to only have one big reason why your command class should change
Its hard also, if you overdo it, there might be other design issues you face, such as defining one class per function, which also isn’t what you want (presumably in most cases)
okay, thank you :)
from what I know usually people have some sort of command manager, or some class that stores all the data of all commands, then you have one class that is responsible for the querying of commands (like a command map), one class that does the parsing, one class that does the dispatching (which can be good if you want to execute a command async etc)
i just made up this on the spot, but reasoning like this can get u relatively far I reckon ^^
I'm making a little whitelist plugin (just a private thing so I can customize it and stuff) and is there some way to identify who's sending a ping packet?
Why do most people store there Itemstacks in Base64 encoding and not directly in an File as an ByteArray has this any reson?
People just don't know how
Would you do know how?
Yeah
Then now my question is why use Base64 enconding?
Olivo knows everything Julix ;)
So it can be stored as a String
thats good 😉
Can't you convert between bytes and chars
you can store a byte Array also in a String
ok i am not realy sure if you can do that but it would make sence
Isn't it also as simple as new String(byte[])
i was away to show you the simplest and most efficient way i found to do it but ive deleted my source code :D
yeah i think so too
You can but again many people don't know that
oh shit that would be great
nvm i put it on github
They just copy paste the first thing they find online
public void saveInventory(Player p) throws IOException {
File f = new File(plugin.getDataFolder().getAbsolutePath(), p.getName() + ".yml");
if (!f.exists() && !f.createNewFile()) {
throw new IOException("Failed to create inventory file for player: " + p.getName());
}
FileConfiguration c = YamlConfiguration.loadConfiguration(f);
c.set("inventory.armor", p.getInventory().getArmorContents());
c.set("inventory.content", p.getInventory().getContents());
c.save(f);
}
@SuppressWarnings("unchecked")
public void restoreInventory(Player p) throws IOException {
File f = new File(plugin.getDataFolder().getAbsolutePath(), p.getName() + ".yml");
if (!f.exists()) {
throw new IOException("Inventory file not found for player: " + p.getName());
}
FileConfiguration c = YamlConfiguration.loadConfiguration(f);
ItemStack[] content = ((List<ItemStack>) c.get("inventory.armor")).toArray(new ItemStack[0]);
p.getInventory().setArmorContents(content);
content = ((List<ItemStack>) c.get("inventory.content")).toArray(new ItemStack[0]);
p.getInventory().setContents(content);
}
dk if thats of any help
but thats the way i did it
and it works perfectly
So, you are saying people are mostly dumbf'cks
i dont. chatgpt questions most of my code though :)
Some are just… ignorant
thanks for that code
i believe i made you a new profile picture a while back, didn't I? using chatgpt
No idea
Isn't that a nice way of saying dumbf'ck
omg i did
Can you send it two images? So it has both my skin and my pfp
uhm i stopped paying for it because i ran out of money lol
we a bit off topic now aren't we lol
well technically we are on the topic of your profile picture, we had this discussion last time aswell.
Well, this is help-dev
but yes, in regards to the channels purpose, it could be coonsidered off topic
anyways. i need help coding a super advanced AI model and help puting it in to minecraft. any suggestions
ask chatgpt 😂
"how i can create the chatgpt 2"
Which one is faster?
should be the same a single op
yea it should be negligible, the difference, if any
look at the jit compilation of if_icmpgt and if_icmpgte in the jvm if it interests you 😂
How to get the country of the player's ip?
you use an api for that
🤨
hm, do you know any api which could be useful for this?
first thing i see is country.is
ty
actually in that case the compiler would use if_icmple and if_icmplt
🤓
mye could be, i always take the wrong comparison in asm
you would think the compiler would do a gt or gte to then avoid a jump but no
Wanted to add unirest-java dependency, but got this error, do you know what could make this?
ok
?paste
Is there any way to disconnect player while he joining the server?
Or only player.kickPlayer?
what is the problem https://paste.md-5.net/yipupepaju.md i have the latest spigot jar on my server and set the API version to <version>1.20.4-R0.1-SNAPSHOT</version> in my POM
"Unsupported API version 1.20.4"
use 1.20 as api version
In the AsyncPreLoginEvent there is event.disallow
is event.setResult(PlayerLoginEvent.Result.KICK_OTHER); the same?
in LoginEvent
I used it cause I wanna get the player's ip first
That’s available in the async one
How can I detach a villager from its bed and workstation?
Also, is it possible to give certain villagers a different texture (using a resource pack, of course)
i changed it to <version>1.20-R0.1-SNAPSHOT</version> its still giving same error
change it in plugin.yml
That's NMS right?
has anyone ever seen such a tiny /give command?
I see
Not using the return value of addItem reee
ew
@eternal oxide is it possible to access net.minecraft.world.entity.npc.EntityVillager
meanwhile I found a flaw with advancedslimepaper today
