#help-development
1 messages · Page 1897 of 1
well then parse that error to find out what it is 🙂
seems like something with your logging is wrong
If you were about to make an unbreakable block breakable, how would you do it?
modified client and server wombo combo
Probably packet jank
if player mining unbreakable block, send block break status packet
I've seen some people using "WorldServer" in their plugins, I can't seem to import that. What is the thing I can use for that? CraftWorld, World?
do you use remapped mojang ?
ServerWorld under mojmap iirc
plot twist its ServerWorld
yes
Okay, that's probably easier than messing with some values 🤔
Thanks for the help
plot twist it is ServerLevel
That is with the added remapped in pom.xml right?
ah fuck
haha thx
I fixed the logging after a dumb mistake
I find it hard to look for things in there, bcs I don't know where things should be
do people forget that buildtools literally clones the repository into your computer
thats why i coded the mapping translation to my own website ^^
Anyone have any good resources to learn how to store things like warps into a warps.yml file in the plugin dir?
Is that ur own website, or where can I find that?
https://timcloud.ddns.net/mapping/
just needs some time to load the data and then you can use top-left-searchbar for classnames
just, use the repo cloned by buildtools....
you can click on single class to get a static webpage of that data too
How can I view that, it's only a bit of jar files and some other random files. (quite new to plugin development)
new to plugin dev and first thing u do is nms? pop off shawty
Found it quite hard 😅
have you used buildtools with --remapped flag before?
Yes
in the same directory as BuildTools.jar do you see other generated files?
mhm
if you want the full remapped minecraft code, go to work > decompile-latest > net...
if you want to read nms with craftbukkit's patches open the CraftBukkit repo instead
sorry where to install the server spigot 1.16.5, the bukkit site does not work
use buildtools
what do I do?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
After that was fixed i got this error
https://pastebin.com/G5nXsjRa
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.
I have a small questionn
What is this?
java -jar BuildTools.jar --rev 1.16.5: how do I start this code? with the bat?
I know its build tools why should i use it
looks like jda exception ^^ not rly supported here
it is a url
because it is simply the best and the official way to obtain your server jar
how do I start this code? with the bat?
tools for build?
no one can refuse the official methods
Do i need it for plugin development i don't need it right?
You may
for what is Maps.newHashMap useful rather than being fancy?
for one thing, you kind of need a test server for your plugins. So yes, you need
or you can write perfect code
smh
flaws are for the weak /s
Would you please answer me?
for another you may need sth outside of spigot-api
how to run buildtools? everything you need to know is in that url
?
where do you see this Maps class
com.google.common.collect package
Error: Unable to access jarfile BuildTools.jar
why? @hardy swan
because, you do not have the jar in that directory
It's amazing to me how many people don't understand Java errors, I feel like it's so explanatory lol
Java: "File not found :("
"what does that mean"
Most don't read it in a Paste, so its confusing
They should make their terminals bigger so they can see it lol
Looks like a jumble of messages
ohh google commons
who uses that hahahah
jk i know people uses that for some weird reasons
which directory?
spigot does :C
@hardy swan which directory?
The one you're running BuildTools in
the one you are intending to run the buildtools in but currently does not have a buildtools.jar, in which you may want to download it from a website and put it into that directory or change directory to whichever directory that the buildtools.jar is downloaded to before running the command 😄
whatt???!?!?
ahahahhaha
Are you using a .bat file
no, git bash
I think newHashMap existed before Java 7, where the new HashMap(Map) constructor is introduced
it is written in the javadocs for google commons
You need to change the working directory of git bash to where the BuildTools.jar is
oik
does anyone know how I would go about making it so every time someone joins the game they start in a separate box?
store the result of one of the scheduler methods
i think they return task id -1 if it fails to schedule
what do you mean "separate box"
like a spawn point?
yeah basically just an area they spawn so they can't leave until the game is started
store a list of locations and remove used ones i guess
or a list of locations and a list of booleans indicating if they are occupied
Location[] boxSpawns = ...
boolean[] boxSpawnsOccupied = new boolean[boxSpawns.length];
/*
* Make methods like "setOccupied", "isOccupied" and
* "getLocation".
*/
public int findFirstNonOccupied() {
for (int i = 0; i < boxSpawns.length; i++)
if (!boxSpawnsOccupied[i]) return i;
return -1; // all spawns are occupied
}
How can I catch the result of a method before it throws an exception?
Does anyone use the Spigot WebAPI to read out the buyers? Does anyone know or has an example code.
what do you mean?
if it throws an exception you know it didnt get scheduled right
i dont think it throws any exceptions after scheduling it
int taskIdOrFailed;
try {
taskIdOrFailed = /* schedule */;
} catch (Exception e) { taskIdOrFailed = -1; }
boolean failed = taskIdOrFailed == -1;
can i do this more efficient?
computeIfAbsent instead of
if get is null then put
not sure why you have a boolean
they have extra behaviour
I guess if you want to get a result but like not really required
u can use it with computeIfAbsent
to return if it worked
although you could put that inside computeIfAbsent
yeah
i assume you run it on a command or something, so that is efficient enough
also from what i can see its O(1)
i dont know what happens in channel.join(...) tho
I feel like the return really isnt needed
maybe to send them a message if they already were in the channel
when they run the command
or something
yeah maybe
looks like it
liek this?
how is that not throwing an error im stupid
u dont need .put if u .computeIfAbsent @tardy delta
oh right
hmm
i'm rewriting a few weeks of code :C
works good, thx!
Does anyone else have problems with HikariCP
in which way?
[17:32:35 INFO]: [com.zaxxer.hikari.HikariDataSource] HikariPool-1 - Starting...
[17:32:37 ERROR]: [com.zaxxer.hikari.pool.HikariPool] HikariPool-1 - Exception during pool initialization.
java.sql.SQLException: Access denied for user 'adminbans'@'localhost' (using password: YES)
looks like you just have a password incorrect
Someone reported that HikariCP can't connect to the database.
or perms not granted
I have tested that on their system and mysql client with the same information works.
I have also downloaded MariaDB on my own computer using Fedora
database works and mysql client can also connect to it just normal
but again HikariCP has problems with connecting to the database
using localhost
i'd make a new user in mysql for spigot stuff and grant it all perms
User does have permissions to manage this database
fedora pog
interesting
Do you think it can be new MariaDB update?
like it suddenly stopped working
Last time I have updated this plugin was on Jul 4, 2021 and everything worked great until now.
The same HikariCP version and everything
I have also updated HikariCP to 5.0.1 (Latest version) and used Java 17 to compile the plugin.
Java 11+ is required for HikariCP 5.0.1.
and it doesn't work either.
Tried with root user and also creating new user and grand him all permission to this database
nothing worked.
@glossy scroll Ty!
how do i get the location of a placed water source in 1.8.8
Does anyone here even use HikariCP in their plugins?
yes
Is this plugin open source, so I can check your implementation?
its not the best implementation but yea
https://github.com/FourteenBrush/MagmaBuildNetwork/blob/main/src/main/java/io/github/FourteenBrush/MagmaBuildNetwork/database/Database.java#L18
i'm recoding my whole plugin
You have used setDataSourceClassName
Probably Jdbc doesn't work anymore with MariaDB
because jdbc url wasnt working
Yeah this is strage
as it was working few months ago
but I didn't tested that until now, that someone has reported that it isn't working
their github page says to use it but it isnt working
Exactly and it was working great until now.
how do i get the location of a placed water source in 1.8.8
hikari = new HikariDataSource();
hikari.setMaximumPoolSize(10);
hikari.setJdbcUrl("jdbc:mysql://" + getConf().getString("mysql_host") + ":" + getConf().getString("mysql_port") + "/" + getConf().getString("mysql_database"));
hikari.setUsername(getConf().getString("mysql_user"));
hikari.setPassword(getConf().getString("mysql_password"));
hikari.addDataSourceProperty("useSSL", getConf().getString("mysql_useSSL"));
hikari.addDataSourceProperty("cachePrepStmts", "true");
hikari.addDataSourceProperty("prepStmtCacheSize", "250");
hikari.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
This is how I'm currently using it.
hey anyway to cancel dismount passenger when player enters water ?
VehicleExitEvent?
armorstand
that event works only on boats and mine cart
I got passenger on top of player head
EntityDismountEvent then?
works like charm
MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
ServerLevel nmsWorld = ((CraftWorld) player.getWorld()).getHandle();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "CosmicPvP");
ServerPlayer npc = new ServerPlayer(nmsServer, nmsWorld, gameProfile);
Player npcPlayer = npc.getBukkitEntity().getPlayer();
ServerPlayerConnection connection = ((CraftPlayer)player).getHandle().connection;
connection.send();
Which packets would I need to send for this to work
I've seen some vids where the guy did "PacketPlayOutPlayerInfo" and "PacketPlayOutNamedEntitySpawn"
But I can't seem to import those
Everyone do be following that npc tutorial recently
Well yea
yea
But all of these functions and methods have a different name, even though he is using the same version
You're using mapped and they're using unmapped
And I am having such a hard time translating these functions
Just use citizens 🙃
^
Can they do custom mobs?
Is there good documentation out there?
They have some. Still better than undocumented nms
Mk, I'm going to try that
What is the best way to store persistent data?
pen & paper
i mean that will do
depends on the context
what kind of data, how frequently do you save and read, etc
i mean two strings
a player-name and another string
yes
I'd personally just throw it all in one file
also, don't use player names
use UUID's
The file is in a folder with the name of the uuid and inside is the name
if you have one file
for example
data.json
you can do
{
"player1-uuid": "Cool string",
"player2-uuid": "Cool string but longer",
}
and do
file.get(player.getUniqueId())
or something like that
instead of going into the folder, reading the file, getting the player name, and then the string
Yeah but I think when i read the file from multiple methods, i become an error, or am I wrong?
shouldn't be
ok
unless you really mess something up
why not use YML though?
it's built into spigot
for a simple key value pair it will be okay
Yeah but i already wrote like 1000 lines of code in which i'm using json-simple so
is it the position logger plugin
no I was looking at your github haha
no this is because of another project of mine. A guild-plugin
And i have to save/create guilds, move players to them and remove them and stuff like that
And so i have to update all the files everytime
yes
And a guild-file:
{"head":"b527a5ab-a21c-4afd-b647-12e42058c609","color":"&b","tagColor":"&b","players":["b527a5ab-a21c-4afd-b647-12e42058c609"],"name":"ÜÜ","tag":"ÜÜ"}
And i have to edit this file and the player-files several times
i'd consider using sqlite or something
or something related to databases
if you're planning to scale it up ofcourse
it will work, but it's cool if it's faster
I want to publish this. So not everyone sadly has a database like mysql or something
Yes
you can always use a caching layer
so you write changes to for example a hashmap
and the hashmap is saveable to the config
so you do like
guilds.addPlayer(uuid).save();
so everything works immediately, but gets saved later
true and i save it every 30 mins and when the server stops
That’s the point of saving frequently. Not just on disable like he said.
i mean both
yes or I say by default like 10 min and you can change it in the config
every tick :p
Could be, but if you are using files at large scale you are doing something wrong. The server owner ay least. If you are using files for smaller servers then 30 minutes isn’t so bad.
thats why i suggested sqlite
H2 is also pretty good, but it’s a little different.
can someone help me, i commited my project to github but i dont see code there?
Refresh the page.
Push?
Ok on first version of my plugin I just make it with files, but if the plugin becomes more popular, which is very unlikely, i add a database-intigration
i pushed
You can do both. It’s just that you should encourage end users to use databases and have files as a fallback.
Yeah in the moment it is just like hundrest of methods
for a simple guild plugin?
well i cant click it
Have you actually created a commit?
yea
Make sure to connect your project with a repo
how do i do that?
I mean, he could use files as the default, but if the server gets large enough, he should have a message or system in place to not only encourage upgrading to a database, but a data conversion method.
well i'd use a repository layer
Git (at the top at the navigation) -> clone..
then move your existing files into that folder and voila
so you can do like guild.addplayer
and depending on the data provider it either provides the database or local file
Definitely. I’m pretty sure a simple interface would suffice for that.
yep
what do i need to fill in the lowest box?
Ok i don't even work with interfaces at the moment
you need to add a directory for the project
like add a slash then add a directory
for whatever you want the folder name
to be
You'll create a new project that'll replace your current project. You can name it equally like your current one, but you'd have to firstly move your current one to an other directory
so that you can later move all changes back in
can that be the same directory as where i saved my files?
it says the directory already exists and isnt empty
Move your current project to an other directory, such as your Desktop
It's only temporary
and now?
Did you clone it?
Then move all the content (excluding the .git folder) of your old project into the new one
yes
With that, all differences from the repo should appear on the commits page
I'm afraid of ShadowMasterG23's message
That’s alright. Interfaces are pretty simple. Making an switchable database system is a great way to learn how they work.
Normally you create a method and call it to do things. Interfaces are similar, except the logic for the methods is in another class that implements the interface.
So if you have two classes, one for JSON files and one for SQLite, they will both implement your interface and the logic required for each system is handled within the respective class.
Then all you have to do is choose which one to use when your plugin loads.
Lmao, I’m on a phone.
ah it kinda worked
Oh😅
i think i need a gitiignore
The .gitignore file is for automatically excluding files for commits
it kinda sucks with intellij but it works most of the time
Ok I don't understand evrything, but a little. Can you give me an simple example?
never had any problems in intellij related to gitignore
It works when you add the files to .gitignore before actually creating them
well it looks different than with other people's project
if you do it the other way around you have to use some weird commands or the same trick like before with moving the files out adding it to the .gitignore and moving the files back in
You can download this file as a reference and drop it into your intellij project https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
The easiest way to get rid of them now is by doing it directly on github
or wherever your git repo is
so just add it in the root folder?
Yup
You can also right click on it and click on "add .gitignore"
this should be located somewhere
shouldnt this print a msg to console when a player has been hit?
Is this gitea?
If you registered it
uhmm fuck i dont think i know how to do that
lol
hmm
Google how to register listeners
So let’s say a server owner is using your plugin and you have options on what database they can use.
Let’s say you offer MariaDB, SQLite, and YAML.
You need your code to be the same when it comes to calling the methods like createGuild() or deleteGuild().
So what you need is an interface. It’s a class that has the methods, but that’s it. No logic is contained within. Because you can’t expect MySQL code to work with a YAML based file system.
This is where you would need to create your classes to handle the actual logic. You would end up with three. One for MariaDB, SQLite, and YAML.
They would all implement the interface that you created and would all share the same methods. (createGuild(), deleteGuild(), etc)
Then you would add the logic to the classes. Once that is done, you would head back to wherever you originally loaded your database and change it to one of the three classes depending on what’s in the config.
gitea?
Gitea is an open source and self-hosted alternative to GitHub. Your screenshot looks exactly like it was taken from that software
Ok thanks you don't even know how much that helped me man. Thanks!
uhh its just github
Oh, lol. I'm used just used to the dark theme then
Did you do that within github? Yes, you have to press on the green button to commit and directly push your changes
ok
um hi
i make my plugin for about my server
but i don't know how to get player name who light up tnt after tnt explode to another player using EntityDamageByEntityEvent?
i guess the event.getEntity() is the player who got damaged
for the lighter you'd need the playerinteract event i think
hmm?
plugin#getLogger?
hmm
its cause its in another class than the main, not sure why its not working
.
like that?
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>Bridges</finalName>
<relocations>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>me.mc2.internal.hikari</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
``` I get the error Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project Bridges: Error creating shaded jar: Index 12299 out of bounds for length 10193
what am i missing
🥺
i know its probably a really noob mistake xd
use dependency injection to get your plugin's instance and call getLogger() on the instance
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
dude
Just do
getPlugin(YourMain.class).getLogger()
replace YourMain with the name of your main class
do smtng like this```java
public Class MyPlugin extends JavaPlugin {
private final Logger logger = getLogger();
public Logger getLogger() { return logger; }
}
public class MyListener implements Listener {
private final MyPlugin plugin;
public MyListener(MyPlugin plugin) { this.plugin = plugin; }
@EventHandler
void blablabla (SomeEvent idk) {
plugin.getLogger().info("mooooooooo");
}```
}
just no.
no
Thats how I do it all the time
i am 100% sure this needs more performance then using dependency injection
how does Tab plugin make space between armor stands which are riding player
Yes, you are right, but that's still a valid solution for the problem
because every armor stand is a bit up
its negligible
and you can literally cache the instance
but it doesnt look like he does it ^^
i did private MyPlugin plugin = JavaPlugin.getPlugin(MyPlugin.class) before :D
well I mean maybe its not being invoked every millisecond
they are passengar and passengars always have a Y-dif
just use System.out.println(" error ");
in my case they are just one in each other
in the picture they a seperated ...
how do you set them to passengar ?
that is tab plugin
you will need to set Holo1 as the passengar from the player and Holo2 from Holo1 and Holo3 is passengar of Holo2
e.setPassenger(pa);
pa.setPassenger(pa1);
e is palyer entitity
pa is firstarmorstand
pa1 second armorstand
they are markers, iirc markers don't have hitbox, so they won't go up, they'll be in the same place
yep
uh ^^ markers suck
so how is this acomplished
you may try setBaby instead of setMarker
hmmm did you try the passengar tree ?
what do u mean by that
holo1 passengar of player
holo2 -::- of holo1
holo3 -::- of holo2
:kekw:
Prepared Statements
actually Tab Plugin uses Scoreboard Teams too
XD i prefer the paper patch for hide the IP
:D
I assume they use the team combined with a single armorstand
hmm guess team is just for tab and not name above players
You can be text below the name with scoreboard
But with armorstand nametags you can make unlimited lines
goodnight :(
I tested something similar before, teleporting armorstands with every tick works fine
goodnight!
Probably much better off using packets for that
uhmm that works somewhat, it compiles but ingame its totally freaks out
ahh well guess ill wait to tomorrow
why try cast a Cow to Player?
WAIIIIIIT
fuck
i think i see the problem lol
is there an equavalent of event.getBlock().getLocation() for 1.8.8?
"Caused by" its the best form to check mistakes xd
yes, then you can omit the nametag owner even when spawning armorstands
you are casting a CraftCow to a player
event.getentity() returns a entity not specifically a player you have to check first
if (event.getEntity() instanceof Player)
or in newer versions probably u can use hideEntity, but idk how it exactly works
Does armorstands not get in time with player movements?
hmm lets take a nap
cause i made it make a player class but it hit a cow lol
check first
if they are teleported to you, they will be delayed from your point of view, but for other players they will be perfectly over ur head. Strange but it works
but normally the player can't see their nametag, so I'm guessing it will be hidden
Hey uh for some reason I can save things in the config and save the config and read this from the config but if I restart the server I can't do these things andmore and I'm getting huge error messages. Only if I clear the config before the restart it's working. Has anyone an idea what my problem is?
?paste errors
but the important thing is also that when the player is driving on a vehicle (boat, horse, etc.), the nametag moves, you have to take it into account and correct t he displacement(which is also done in TAB plugin)
if they are teleported to you, they will be delayed from your point of view
any idea why this happens?
ping
pong
well, you can possibly use some really small hitbox to position the lines, but it will be difficult to manipulate the height
you understand it
doesnt \n work?
not on names O.o
whoops
Is there any real difference between
public class Outer {
public enum Inner {}
}
and
public class Outer {
public static enum Inner {}
}
? If no, what is usually preferable?
yes
Yes there is a difference
iirc enums become static by default
Wait enums are always static
^
yeah
I thought you meant the class structure in general
Nope, talking about enums, interfaces and records which are static by default according to the JLS, but it could be that there is some difference, so I wanted to ask
afaik they compile down to the exact same thing
only if your value is dependent on the static constructor you should use static enum
Can confirm
confirm = true;
No Idea why I asked this in the first place when I could've just used javap. AAAAH, I'm getting in the mindset of the spoonfed people
you're forgiven
i'm guilty of that very much
About to show just how little I touch basic java nowadays. I'm trying to do character incrementation, which while easy on its own doesn't exactly fit what I need to do.
I need to append to the end of a arbitrary string. The strings themselves will be a form of A.B.C.D where D is the incremented string. A, B, and C however are entirely unknown in terms of length.
So, assuming we were to loop through a list of 26 strings it would print out a list consisting of A.B.C.A - A.B.C.Z where as 27 would print out A.B.C.A - A.B.C.Z and A.B.C.AA, incrementing as much as needed i.e. 28 would print out the previous as well as A.B.C.AB, 29 printing previous as well as A.B.C.AC, etc, etc
So you have 3 constants 'C' and one incrementing variable 'V'?
C1.C2.C3.V
can someone help
They're not really constants given what I'm doing, hence me saying they're entirely unknown in terms of length given what I'm going to be using this.
The only constant thing would be the amount of .'s
so the full string could be AAA.BBBBBB.Z.<incremented_value> or A.B.EREJWIREWORE.<incremented_value>
For once you could try a version of the maven shade plugin from this century
Ok so the values are irrelevant. You just want to know how to increment a String with base 26 starting at A
Could grab the last .'s value and work with that now that I think about it more 👀
hmm
but yea, essentially.
The issue is the recursion & appending however
I hope that splitting the String at . is an obvious solution to getting the last value.,
Yea lol
It needs to recurse at Z and append to that pretty much
i.e. 26 prints a-z, 27 a-z & aa, 28 a-z & aa & aab etc, etc
26 prints a-z
27 prints a-z and aa
28 prints a-z, aa, ab
Wait.
26 is equal to Z and 27 is equal to AA
Right?
That would be correct
So a base 26 system starting at A
I wrote code like that not too long ago, though it was capped at two chars
My thing is it's completely arbitrary 😂
Was a bit of a pain to get it working right
What do you mean its arbitrary? You need to define your bounds...
The incremental amount
isnt that like incredibily easy to do
I do not touch basic java much lol
explains alot
if (counter > 25) {
int first = counter / 26;
int second = counter % 26;
return String.valueOf(new char[] {(char) ('`' + first), (char) ('a' + second)});
} else {
return String.valueOf((char) ('a' + counter));
}
was my version with two chars, I think you could expand it for more
I mean
add another variable called repeat
Are you really going to have 26^2 different variations
which is the Math.min of the length / 26
Actually. You'd be surprised
Likely, minecraft has over 26^2 classes
This is pulling info for my Anti-Malware.
i.e. in this case strings, hence the incremental string at the end
builder = new StringBuilder();
while (c > 26) {
int a = c % 26;
c /= 26;
builder.append((char) ('`' + a);
}
something like that would work I think
haven't tested it
The one jar I'm testing with has 158 strings
fuck doing the incrementing manually lol
do you write unit tests?
yea
cool
Fun part is the amount of times the program needs to increment are completely arbitrary lol
It could just be
String.A - String.Z or it could be String.A - String.Z +String.AA -String.AZ
How do you create custom entities in 1.18?
public class Test {
static void toString(int c) {
StringBuilder builder = new StringBuilder();
while (c > 26) {
builder.append((char) ('a' + (c % 26)));
c /= 26;
}
builder.append((char) ('`' + c));
System.out.println(builder.toString());
}
public static void main(String[] args) {
for (int i = 0; i < Integer.MAX_VALUE; i++) {
toString(i);
}
}
}
works, though it outputs the characters in the inverted order
how do you know when to stop incrementing?
In my case, when the program stops finding strings lol
o.O
hence the completely arbitrary-ness
well so far, you have . to look at, and do you have a way of knowing how many strings are in there?
afaik, unless objectweb asm has a way. No.
Unless I were to count them all first & then re-go through the list
well I know there is bytecode for strings
🙃
Google your question before asking it:
https://www.google.com/
I'm aware of this too.
Bytecode for strings is ldc, however ldc I believe isn't always a string
no but Z is
I'm aware lol
Gimme a sec, I'll just ?paste the code I'm using to pull the strings
?paste
Just enumerate the constant pool \s
well just trying to see if its completely unknown when creating a loop for how large a string may be, or if there is a way to know before we get to a loop how many strings there are. This way, we don't need an arbitrary length loop with unknown time to complete.
Both of those depend purely on the jar
hey, quick question: how do i change a player's tablist name, p.setPlayerListName(); isn't working..
Just realised after some testing that this cant be done by just converting your number to a different base system as you dont have
an equivalent to 0
Usually
after Z there would be A0 but in your case its AA
The test jar I'm using has strings with a length of 2 all the way up to 58.
The length of the string however does not matter.
As for how many strings are in this specific jar, its 158. This is also arbitrary too due to the string size being different per jar. It could be 0, it could be 1000
base 9 goes to 27
The actual string looping through is done via https://paste.md-5.net/wujabuniqu.cs
That however, can easily be dealt with via a variable & list lol
pain
could gen it outside the entire loop by saving each string to a list and looping that instead, but we'd still be in the original issue though possibly more easier to solve lol
base 10 -> 9:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22
I dont see how this invalidates my statement.
I think i didnt even understand what "base 9 goes to 27" means to be honest....
do you know your base systems? o.O
I hope so...
Again. Not sure what this means. Was that sarcasm? Is my conversion wrong?
Base 9 is basically Ternary but can be use compacted form. Or we could just Ternary only and just keep it at that.
Base 9 is also known as nonary
does anyone know how i can do this without disabling movement?
isnt AI the movement?
?paste
well it freezes the entity in place
AI also disables gravity
isn't AI for path finding and walk
i simply want the entity to exist but with physics still
Use setAware(false)
ssays it doesnt have that method
I think there is a method where you can still tick the entities but basically disable their awareness
Might be a paper method...
mob.setAware(false);
im using paper
its not a paper method
What spigot version?
which api version are you using?
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
let me try
remove paper api
and spigot-api
why do u use it lol
if you are depending on spigot already
i just added the spigot api to make surer that wasnt the problem
i can confirm it was not the problem lol
papermc has that method in 1.18
https://papermc.io/javadocs/paper/1.18/org/bukkit/entity/Mob.html#setAware(boolean)
declaration: package: org.bukkit.entity, interface: Mob
maybe send us your code
A zombie will always be a mob, so the cast should be safe
@wet breach
This should fix some of your concerns, gave it documentation as well
its a part of spigot api
Mob has that method not livingEntity so ive casted it lemme test
i thought tooo @onyx fjord
noticed a flaw in your code as far as empty characters go. Instead of checking for a blank character you should specifically check for space character. There is control characters that are considered blank characters as well.
empty means no characters at all so that is fine. But up to you if you care about them other blank characters lol
I have to take into account "" too
Quick someone get the zero width space
indeed, but " " to most would mean there is a space in the string, when in reality that could just be a control character being shown as a space since control characters don't have a character to display them.
true 🤔
that however still does not solve my original question, however putting each string into an list first simplifies it though :p
just treat it like octals for strings. I mean IP addresses are arbitrary for the most part if you wanted to create or check random ones, the only reason we know ipv4 limits is based on the rules it was created on. You can do the same with your strings. We have . to separate or know where to append, and then we know at most you only need to loop 26 times. And if you wanted you could map the letters to numbers to simplify the process.
or you could just pre-generate strings as well and do an arbitrary check lmao
We'd have to of course, take into the fact that it could and is probably gonna be way more than 26 loops
if we are only looking at the ASCII alphabet, its 26 A-Z
we'd still have to recurse and append though 😉
appending isn't hard, you just know that on the 26th run of the loop it has reached the end
but its always good to know what the rules are so you know where the boundaries are at. But because of the things I said is what is already known you can easily create worker threads for this with little problems to speed up the process
Optic is scared of parallel processing :p
well the threads don't necessarily need to check anything, just spit out strings
Why do we need threads for this
because if you are going to just keep adding characters until something matches
it takes a long time for arbitrary lengths to do this
it is for id's?
In this case there's few bounds.
There's a constant, in this case String. which would be the start of every string. This constant in the real project would be completely arbitrary, so we'd have to pull everything from the last ..
A valid string in the real program would most likely be String.Spigot.<arbitrary_string>.<incremented_value>.
We know there's 26 characters in the alphabet, however we also know the amount of strings we're going to loop through are completely arbitrary. It could be 0 or it could be Integer.MAX_VALUE
if that is the case then I really don't see the issue then 🤔
I’m pretty sure this is just for id
^
then I don't see the problem? If we are creating the id's then you are the creator of the rules of it
This sounds amazing for identifying strings XD
The program it self would pull every string, assign it an id e.g. String.Spigot.PluginName.IncrementedValue.
The fun part is making sure it increments properly
String.Spigot.PluginName.A
...
String.Spigot.PluginName.Z
String.Spigot.PluginName.AA
...
String.Spigot.PluginName.AZ
String.Spigot.PluginName.AAA
...
That would be nearly 12 million iterations to cover the word “hello”
Not really
If you can’t do it character by character it would be
lets say there's 27 strings, yea? 26 for A-Z and 27 for the recurse
String 1 -> String.Spigot.PluginName.A
String 2 -> String.Spigot.PluginName.B
String 3 -> String.Spigot.PluginName.C
String 4 -> String.Spigot.PluginName.D
String 5 -> String.Spigot.PluginName.E
String 6 -> String.Spigot.PluginName.F
String 27 -> String.Spigot.PluginName.AA
Ah nah I was talking about using it to find strings
Finding the strings themselves is taken care of, so is putting them into a list to make said found strings easier to work with
Yeah
The issue is creating the above output with said list of strings
Now I want to make a stupid program that just keeps incrementing letters until it matches a provided word
10/10 efficiency
Hey uh for some reason I can save things in the config and save the config and read this from the config but if I restart the server I can't do these things anymore and I'm getting huge error messages. Only if I clear the config before the restart it's working. Has anyone an idea what my problem is?
The main issue with the above though, is the amount of strings is completely arbitrary which means one can't just loop A-Z and call it done. It would have to recurse to A and continue until every string as a proper output
It's also working if I clear the config after the restart
We need the errors
If there's no strings, it doesn't loop. If there's one it just does String.Spigot.PluginName.A, 2 String.Spigot.PluginName.A and String.Spigot.PluginName.B
wait a sec
This gives three rules.
- The constant is a constant and always has to be at the beginning
- The appended letter is at the end and appends only after reaching Z. i.e.
AA,AAA,ABZ, etc - The amount of times it must loop is unknown, it could be none, one, two, 10, 1000, Integer.MAX_VALUE, completely unknown
sorry for some reason I couldn't screenshot the console @vagrant stratus
It is on its own. But harder once a constant is involved since that needs to be taken into account properly
What are you talking about I didnt understand your system
How are you saving values?
What about it don't you understand exactly?
Isn’t the constant just something you prepend on at the end
What its the idea of that you are talking
Beginning
Any player#sendTitle alternatives? (Deprecated) Or can i just use it?
Yeah but like, at the end of the calculation
BufferedReader returning empty array in spigot server, but not in maven test (junit)
true, but either way each string would have to be correct
IE calculate AAG -> stick constant on the beginning
ofc, however if you had lets say 4 strings the output would have to be
String.A
String.B
String.C
String.D
Use the other sendTitle method
Which takes 3 ints
27th in this case would be String.AA, and it increments as as much as needed whether it's switching a character to A-Z or appending a brand new character to the end starting at A
public void setOwner(UUID id, Chunk chunk) {
FileConfiguration cfg = main.getConfig();
String chunkID = chunk.getX() + ";" + chunk.getZ() + ".";
cfg.set("Chunks." + chunkID + "Owner", id);
main.saveConfig();
}
I'm not sure if i'm right about it?
but is it some how possible to edit Chat Messages
i believe i have seen it somewhere
Ah, thanks (i didn't even complete the line but my ide already said it was deprecated)
And it's working perfectly:
@young knoll
Here's a proper example on what I'm needing in this case
https://paste.md-5.net/elerocemoy.js
Ah
hence the ...
The program should be able to output String.AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZ on its own, if there's enough strings for it anyways
this is just called a brute force program
Yes
or AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZZ or any variation as long as it's properly incrementing, which means no AAAAAAAAAAAAAAAZAAAAAAAAAAAAAAAAAAAZ bullshit lol
No
ChatControl?
Nah, years old
You would probably just resend the chat history minus the message you want to remove
idek how that would work. Send the whole chat log to the player again with the message removed?
i believe it have seen it too some plugin do that
Yeah lol
This is why I'm looking for the plugin lol
That'd be the only way to do it as far as I'm concerned
I just have to hope its not deleted 😂
and it's ugly 
TIL people still post updates on bukkitdev
i use the bukkit forums for plugin ideas
since they have a dedicated section for it and people still post there kek
question:
is there some kind of base plugin without any features to it I can use as a template for a plugin? I'm new to plugin development but I've coded mods and some other stuff before. Thanks in advance, and ping when reply please.
if you are the one creating the id's why we using letters?
This is for the Anti-Malware, specifically notification
I'm however, trying to create a tool to pull the strings and create said strings automatically cause goddamn there's so many
What’s wrong with numbers
be much faster if you just put numbers instead, then later after its done, do some formatting use base 3 to do it.
That however, becomes an issue if I were to document things properly
sending chat cach agein?
how so?
A full entry in the DB is as follows
69ccf32eeef6030442f28b4651fe79ee493463ae:String.Spigot.HidePl.A
The first half is the string hash, and the second half is what's logged to console when found
Is MaliciousCommand.Spigot.HidePl.1 not acceptable?
learning to do packet Chat edit / remove
I could, however I'm also sticking to a specific standard
Boooo
Yea there are definitely chat edit plugins
They are just hacky
I think the issue is that you are trying to do the gathering and assignment in one go o.O
when it should be split into two processes
Yeah probably using packets I assume
That's why I made it easier with the more recent code, which is throwing found strings into a list first, and then looping said list of found strings
Packets might be the more efficient way than clearing up the chat
You just gotta record all outgoing packets into a list so you can resend them later
With whatever you want removed
personally I would just use numbers
because you can just use the loop number to easily plug that in, not entirely sure why it matters that every string get a letter lol
https://www.spigotmc.org/resources/messageremover.1400/ does the whole message removing thing
So basically each chat message has its own packet?
there is API methods in regards to chat related things, why is that not sufficient?
Honestly wasn’t aware you could edit chat messages using the API
Can’t capture outgoing messages with the API
same reason it would get a number.
Each one denotes a specific variant.
Each file for example would have a specific malware family and variant.
Qlutch for example is currently on variant AA
Oh
because the server controls it to begin with
unless you trying to capture messages from other plugins
Mhm
This should do what you want message wise, just gotta decompile it lol
but if you are trying to capture messages the plugins broadcast or what not, yeah might need to use packet capturing or reflection, but I mean also not hard to edit plugins themselves since most are open source anyways.
so if we are doing just chat related things from players, then API is sufficient
True, you can just use the chat event
I could simplify it even more by having the variant be the same as the file, however that would get messy in terms of documentation and such, or logging really since it would be hard to tell what goes to what
Dang that plugin is an old boy
with base 3 this process would be more efficient I will have to better explain later I suppose as I have some things that I need to do XD
Yeah, I think the only case where you would actually need packets is for editing messages after they’ve been sent. Not many cases where this is useful but I’ve been thinking maybe it could be useful if you had a discord bridge plugin, so when a message gets edited on discord it does on Minecraft as well
once the mc clients get a message, there is no way for you to edit at that point lol
The method of “editing” them is just resending the entire chat history
Of course, but besides sticking with the CARO convention most people using an anti-virus software of some form would most likely be used to lettering as the variant. Even popular AV software follow the lettering specification :p
well, some anyways lol
However in my case, I'm not dealing with just the jar, but everything in the jar too
and of course, many different variants of the same malware
Having a button to edit your own chat messages actually sounds really cool
But very exploitable
so in my case, the variant is very important, even more so if I need to go and verify a jar for one reason or another
DDoSing people with chat message editing
Thank you! btw 
👍
I mean, ig if I really wanted to I could do numbers as an intermediate step lol
could then use the num length to generate the correct char sequence
How do i add a method inside another method?
You don’t
what are you trying to do exactly?
Hacky, but it works and sticks to the specs lol
https://gist.github.com/thelooter/402f206d974dacac818d727e3e8b3a83 Is there an easier way to perfectly center text, this seams kinda clunky
I have a runnable for spawning mobs every 5 seconds in a 5x5 but i want to make it so if you move one block they stop spawning.
using playermoveevent plus runnable
so what cant you do?
do you need a runnable in a event?
yes
well no i already have that
i need the playermove event inside the runnable for it to work
doesnt like that and spawns 500 sheep in the 5x5 every second instead
ok so put the runnable in the thing?
Events are just that, event driven. They do not belong in tasks
And cancel it when it’s inside the event
edit buttons just ruin the natural history of chats and makes logging that much more difficult.
I mean you COULD have an API for the plugin and warn people that it messes up natural logging
How would I determine if getOfflinePlayer(String name) actually exists? In the JavaDocs, it says that "This will return an object even if the player does not exist."
It will always 'exist' as you create it if the file is not present.
But you can check if the user has joined the server by checking hasPlayedBefore()
thanks!
Small question, how can I allow other plugins to change my plugin’s variable or config data?
What will be in the object if they don’t exist lol?
Allow it to? Just have it be public
Anything public will be accessible
You should provide an API for that
Yea and if you don’t want them to have to make an instance you could make it static
Well, I mean... be smart about where to use that lol
There is also the services manager
You mean the Vault manager?
Yes, the Vault manager
The underused API that really, really should be used more often
Bukkit's got lots of underused APIs. Conversation APIs, chat pagination APIs, services manager, (proper use of) metadata API
There is a chat pagination API?
TIL
Super handy for splitting up text in lore
gonna member that
wtf
WTF is this and where has it been this entire time? I've been looking for a way to do this with just regular java, this looks waaaaay simpler.
Can someone help me with why my gradle project isn't showing up in package/project explorer in eclipse
Wait, can this be used for in-game chat as well? Or is it console only?
are there any data types in java like hashmaps that can contain multiple value types
Type parameters technically
i wanna shove the entire playerdata config of a player into a hashmap, but some values are ints, others are strings, etc.
Use a class
Yeah you can use it for chat. There are some constants in there that represent average chat width and height
so if i was just theoretically grabbing a player's level (int) from that, what would it return
a class?
Yooo, I've gotta look into it then. Been looking for a way to split up my command help page. This might just be it. Thank you for just casually dropping that this exists.
public class YourDataClass {
private int yourInt;
private String yourString;
public int getYourInt() { } // implement this
public String getYourString() { } // implement this
}```
Then yeah, if the value is YourDataClass, just operate on it as you normally would
The value can be any type you want
^ no idea how choco writes code so fast but ^^^^
~magic~
From some reason removePassenger method is not working
if you loop again thru all passengers they are still in list
are you sure it is not working? maybe they weren't a passenger and instead the driver 🤔
When i do /msg (MESSAGE HERE) it adds the prefix (Console -> {username}) how can i take this away or change it
same UUIDs
yes, been there for like forever
just fyi, half my comment was a joke. Not entirely sure why it isn't working.
probably does
If a line ends with a certain color/formatting, will the next line start with it
Well if the ending of a line is “&6This is red”
I would want that next line to start red
you can dictate desired width etc of lines as well as decide where the breaks are to happen
For example “&6This is red, this is also red.” Should be split into
“&6This is red,”
“&6this is also red.”
Meh, I already have my own solution anyway
Yeah mine returns a list
whats the best way to do type conversions without making an individual method to return every type from a config?
That’s what spigot does iirc
like in my old config system, i had an individual method to grab data from a config like getString(), getInt(), etc. this is very painful and i want to evolve
Yeah
I mean arguably create an interface for the configuration (not to be confused with java interface)
and then have a method for every property
im using redlib's config manager
yeah thats kinda their main thing
Let’s just have an example
interface BlahConfigurationInterface{
void load() throws Exception;
int getLevels(); //instead of config.getInt("levels");
}```
Then just implement that
And so you could ofc encapsulate a normal FileConfiguration
Or do sth completely else
Pog is, this interface will serve as a nice facade to reduce the complexity and details of things
Hey @worldly ingot, do you have some examples of how to use the ChatPaginator properly?
Is there a way to access keys/values of a YML configuration file by its index?
How do you post code in a format like this? are you just using the tripple `?
yes
yeah ```java
woah I didnt know you could do that
you can do it for almost every language
```java
[code here]
```
even weird ones like xml and gradle
really?
no gradle is rad
its not weird
thats wicked
<hi>
Says you
lol
wTTF
Scala
bois what are you talking about? Maven is rad
ive only learned maven, gradle seems less understandable ot me
Poms are so big
yeah but poms arent hard to read
^
plus lets you auto-download libs (dunno if you can on gradle)
??
idk its pretty simple to read
you can do everything maven on gradle
ok its not THAT hard to read
yeah i dont use gradle so i didnt know
I just like how organized it is
no but im more used to maven
you are telling me you dont prefer
shadowJar {
relocate("org.someshit", "com.someshit")
}
over
<relocations>
<relocation>
<pattern>org.someshit</pattern>
<shadedPattern>com.someshit</shadedPattern>
</relocation>
</relocations>
ok lemme say it again since you dont understand
I have only ever really used maven
so I know how to use it
I dont use gradle
So yes I prefer the latter because I dont have experience with the first
meh the maven one looks nicer for me lol
meh I like the pom.xml over the gradle one
id rather spend the extra 10 seconds typing verbose stuff then spending an extra 3 minutes waiting for it to run
lol
true but at the end of the day you cant use experience to argue lol
you are going to have to use it at some point
tru
gradle runs slower in my experience !
yea same for me
what do i put in a method's parameter type if i want to pass an instance of a class?
or I just have crappy laptop
The class name then the name you want to give it
bruh
no
I think Class
Yeah no, gradle is definitely faster and its proven lmao
?
OHHHH
put ?
generics
mhm
Pass a type
a name you want give
Yeah either pass a type of do Class<?>
Real pros do Class<? extends Object>
what does the ? do?
<T> void epicMethod(Class<T> epic);
why would i need to pass a type?
? extends ? extends Object
oh god
Is that valid
because you’re using a parameterized type?