#help-development
1 messages ¡ Page 848 of 1
That is what translateAlternateColorCodes is used for
And save it in config with & char, that way it won't look ugly
Oh okay, so i just need to do i manual
What
well I thought the real reason it existed is because most keyboards don't have that symbol xD
I mean you'd have to be sweedish I suppose, but that's a small demographic
I mean reason it's saving like this is probably wrong encoding
But whatever, no one is really using that symbol for configuration
Or I hope so đ¨
Not only sweedish...
10 block radius from the placed block?
Why do you need a BukkitTask then?
Just save the location on each block place
Ah okay
Then on block break make sure to cancel and remove the task
nordic or whatever
đ¤ˇââď¸
sweedish keyboard is the only one I've ever seen with the symbol
even taking that away its not as common as having &
Don't do player.getNearbyEntitities
Save the location and do Location#getWorld#getNearbyEntities
Player#getNearbyEntities is a perfectly fine method unless you want to dip into NMS for that for some reason
Save them into a map
Look at his goal
Uhh
Yeah I guess
Should work
It'll work.
Hey, I'm having some troubles to set custom names for certain of my players.
I successfully set global names by changing name field of GameProfile but I struggle making per-player display, for example :
(Player1 sees Player2 as "Martin" but Player3 sees Player2 as "Kevin")
What I did is : I change name field of Player1 gameprofile, send ClientboundPlayerInfoRemovePacket to Player2, send ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER to Player2, reset the old name of Player1 gameprofile (to let the server know the real name); then do the same for Player3 with different name etc...
How can I achieve that?
Just save em into a file if you wanna have it take effect on server restart
My god
Modifying GameProfile's name var
For a nickname change is too overused
And it introducess some issues
But let's ignore that for now
You also need to send UPDATE_LIST
There is no real way to do it otherwise, so...
For the name to update
UPDATE_LIST only update display name
Ye
Ah, you want on top?
Yes on top and on the tab
Then you also need to send the respawn packets
Easiest is to teleport the players into another world and back
Or you could spoof em
Do I need to send the respawn packet to the affected player only or all the other players
(not sure if other need to be sent as well)
No idea
Try both
Men.
What did I tell you?
.
Well it's probably the same
An instance invocation
Not a static one
So lile
new World().sup(); is
World#sup
(not necessarily a new instance each time)
Well it seems that you're using an old bukkit ver
you need to add the location, 10
There's an explanation below that
Yes
Np đ
How can you read the keys
Or how can you convert them to materials
getConfigurationSection(âitemsâ).getKeys(false)
The Boolean controls if you want to get subkeys as well
getKeys will return a set that you can use contains on
Youâll have to toString the material
Cant you just do: Material#getMaterial("type")
That wil return the material object for type
what you want to do?I want to begin from there
you want to do something when a player obtain an item from the floot which is in a list right?
yeah what i said before he already has the material
Yoo
How to make tnt explosion with packet?
Notch: âIt needs a bigger explosionâ
you mean just the particle effect?
No actual explosion
why do you want to do this with packets?
player.getWorld().createExplosion()
no need for packets
Does somebody know how i can stop maven from creating to versions of a plugin? (how can i tell him to either only create the original jar or only the shaded one?)
Im only showing to one player, its a cosmetic feature. And im on 1.8.8 that method doesnt exisit im pretty sure
so you want an explosion that destroys blocks, but it should only be able to be seen by one player?
correct.
that's not gonna be fun
how it that gonna work
imagine a player walking in the air
because the other one doesnt see the blocks anymore
Its for the end of a match why do u care just help me lol
does not sound very easy to do
Replace the blocks with barriers client side and manually spawn the particles
Lol, nvm i already have code for it that i wrote i just wanted to see what u would do, clearly u just beating around the bush cuz u aint got nothing better to do
Dont waste my time.
Then the server wonât freak out when they start going inside blocks
I despise gate keepers like you @inner mulch
and you are asking for help so please have some patience
Tell me you didnt read but wanna be involved without tellin me
LOL
sorry what do you mean?
Exactly
I read everything so far so im confused why you would say that
anyways im not dying on this hill and neither should you
Spark report looks fine to me
server is basically spending half its time waiting
Are you experience lag spikes?
Anyone know what event(s) trigger when a player puts an item into a decorated pot? Just PlayerInteractEvent?
I'm just weirded out why its using so much ram?
are you generating a lot of terrain?
No terrain is being generated.
You give it ram
Its all been pre generated
Itâll use it
Yes I understand but usually its using far less that what its allocated compared to now
so what changed? xD
Nothing which is whats weird
Probably nothing, you may just not notice it going up
Its weird this time though usually when it goes up it causes lag spikes
Then capture a spark report of the spikes
There a flag to only capture ticks over a certain length
Donât quite remember what it is tho
Any plugin/api to run code in runtime? (eval)
hmm, i will look at skript
No
Itâs client side
Best you can do is predict it with the block damage event and time
@blissful crow if you really want this, try get the delay to break the block(block durabillity + tool(or hand)) then when player start breaking it you can do the progressbar
Thereâs a method to get the progress the player should be doing each tick
I think itâs getBreakSpeed or something
Hey
when there's an explosion and i get the affected blocks, with #getBlocks(), that should include the bedrock?
It will only return destroyed blocks
So no, bedrock is never included (in vanilla)
How would i get bedrock affected by the tnt?
i know theres getRadius()
and if i loop on every block in that radius it will be a square
not a normal explosion
You could loop it and use math to only get a sphere
But thatâs still not how explosions work
yea
it will be just a circle
They use rays
how do i disable /help, do i just override them or is there a setting?
okay
hmm
damn I wrote a whole leaderboard plugin in half an hour
is this what it's like to be a good dev
yes
Or the api is just that good now
I think I used bukkit once in this project
well more like twice
there's a general scheduler that fetches a snapshot from the database and a listener that ensures that player names are up to date on teh db
How is it displayed
placeholders n citizens npcs
Fair
Hey, how can I spawn fake players using nms, I looked in the internet, but all these tutorials didn`t work
You need to create a player entity and then send the appropriate packets to clients
But I would advise using an existing api like citizens
can I make the player lay down there?
Is it possible to make player lay down in 1.8.8?
Yes and Yes
For 1.8 you prob have to make a fake bed
Look at how corpse plugins work
I think you can send the âis in bedâ packet with any location
Is it possible to make a text file a player can download in chat?
I have a massive amount of text and I don't think they want to be reading through it in minecraft chat
open a webserver from within the plugin on some random port and send a link to that?
Will it be local? (sorry I have no web experience)
that depends on whether you listen on 0.0.0.0 (public) or 127.0.0.1 (only local)
Well I guess 127 is better here, since I only want them to see it
HttpServer server = HttpServer.create(new InetSocketAddress("localhost", 8001), 0);
```that'd eg start a webserver on localhost 8001
but that'd mean the player has to be on the same machine as the server
Great, should I use 8001 each time?
Oh yes of course, hmmmm
I'd either make the port configurable, or at least check if the port you wanna use is free
That's tricky, but 0.0.0.0, surely they can't just click on 0.0.0.0, on some random port, without any config, and be taken to my webserver
you could ofc alternatively just send them a pastebin link or sth
Yea but how do you even auto generate that
well you start the server on 0.0.0.0 but the link sent ofc has to be http://<server-ip>:<port>
pastebin API
Could work
Seems great! But can you get the server ip from inside a plugin?
you'd have to rely on a "what's my IP"-api like ifconfig.me
e.g. make a request to ifconfig.me/ip and it'll return just the IP address
there is no reliable way to determine the server IP without making a request to an outside service
Honestly pastebin api seems the best here, but do you know if it posts the bin as an account or just a guest?
tbh pastebin api would be the easiest. you need an API key for that
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.
here's a java lib for pastebin https://github.com/caseyscarborough/pastebin-api-java
hastebin allows for annonymous downloads plus you can self host so you dont get any people upeset about a load of data
I ran into a problem when creating custom craft. Is it possible to create a craft using itemStack instead of Material?
Has anyone ever had an issue when using mojang mappings for NMS where only the remapped-obf.jar file is being generated but not the remapped.jar file?
I am not even getting any errors which really confuses me
by buildtools or when you're building your jar?
when building my jar
I did use buildtools and it generated all the files correctly
the normal one?
yes
That's always been the case
huh
Same goes for the shade plugin
it's always generated a -remapped.jar file for me
I just moved the project to a new PC and rerun build tools and now it changed
It can do that, but you shouldn't use it
alr
Jars with prefixes and suffixes are intermediary steps
the final jar will be named like normal
Hey, maven noobie here, how can I add this to my pom.xml file? (That is the equivalent to the build.gradle right?)
I need to add this to my project, but I'm not sure how to convert gradle to maven
repositories {
maven { url 'https://maven.pkg.github.com/caseyscarborough/pastebin-api-java' }
}
dependencies {
implementation 'com.pastebin.api:pastebin-api:0.1.3'
}
I already have
<dependency>
<groupId>com.pastebin.api</groupId>
<artifactId>pastebin-api</artifactId>
<version>0.1.3</version>
</dependency>
But it says:
Could not resolve dependencies for project com.user:AdminStop 1.0-SNAPSHOT: com.pastebin.api:pastebin-api 0.1.3
And I'm guessing it's because I don't have that maybe?
add the repository too
Oh ok, I did:
<repository>
<id>pastebin-repo</id>
<url>https://maven.pkg.github.com/caseyscarborough/pastebin-api-java</url>
</repository>
But I get:
authentication failed for https://maven.pkg.github.com/caseyscarborough/pastebin-api-java/com/pastebin/api/pastebin-api/0.1.3/pastebin-api-0.1.3.pom, status: 401 Unauthorized
Use jitpack or add your github auth information to your settings.xml
Jitpack didn't do anything
You mean:
<repository>
<id>pastebin-repo</id>
<url>https://jitpack.io</url>
</repository>
yeah
That just gives Unresolved dependency: 'com.pastebin.api:pastebin-api:jar:0.1.3'
Jitpack uses different dependecy information
yeah I'm using that^
So where would I put com.github.caseyscarborough:pastebin-api-java:0.1.3 in my dependency?
using jitpack
Oh ok
<dependency>
<groupId>com.github.caseyscarborough</groupId>
<artifactId>pastebin-api-java</artifactId>
<version>0.1.3</version>
</dependency>
?
Seems to be loading longer... Maybe it's working
Yay it works
Thanks so much!
But it somehow broke the @NotNull annotation
Tho everything still seems to work
broke how?
then the items are not exact, keep in mind if you used exactchoice on that axe also even a slight deviation on that axe would cause the recipe to not work
so on tools its often recommended to use materialchoice
Cannot resolve symbol "NotNull"
JetBrains @NotNull,
import org.jetbrains.annotations.NotNull;
try AnvilInventory#getResult() instead
I can't cast inventory in Anvil Inventory
why not
ClassCastException
so inventory instanceof AnvilInventory returns false?
I thought I could check it using instanceOf, but it always returns false
check inventory.getClass().getSimpleName()
ye ye
its a custom anvil inventory?
Inventory inventory = Bukkit.createInventory(null, InventoryType.ANVIL, Component.text("sosi penis")); thats how i show it
I found a post on the forum from Choco, he wrote about it
so I abandoned it and started doing it as usual
like this
Where can I save text online to prevent tampering?
?
You can just use pastebin
or if you want a directly writable socket you can host your own
Yea but I just realised, i don't think there is a way to edit them in java once pasted, and even so, i still have to store the pastebin locally right?
You can edit them if you have an account
save string in mysql?
and it will be on your server locally
and easy to manage
in java?
Might have to make your own wrapper for it
but yes ofc if you can in the browser you can in Java
Oh ok, but do you know what this is?
Caused by: java.lang.NoClassDefFoundError: com/pastebin/api/PastebinClient
at com.sindn.adminstop.Commands.pastebinLog(Commands.java:33) ~[AdminStop.jar:?]
at com.sindn.adminstop.Commands.onCommand(Commands.java:127) ~[AdminStop.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
... 29 more
Caused by: java.lang.ClassNotFoundException: com.pastebin.api.PastebinClient
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:197) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:164) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
at com.sindn.adminstop.Commands.pastebinLog(Commands.java:33) ~[AdminStop.jar:?]
at com.sindn.adminstop.Commands.onCommand(Commands.java:127) ~[AdminStop.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
... 29 more
I only have
public static String pastebinLog(String str){ //Returns url (disabled for testing)
final PastebinClient client = PastebinClient
.builder()
.developerKey("my-developer-key")
.userKey("my-user-key")
.build();
client.login("Sindn", "Sindenmil#123");
return ("Some text");
}
You mean share?
shade
shade?
basically bundle it with your jar
you imported it as a dependency, you need to build your jar to include the dependency as well so the jre knows what to run
Hm, maven says version 3.5.1 is not found
But anyway I have the entire plugin thing in my pom.xml, can I just build?
Is there some other stuff I need to do?
Do maven reload
Thanks, I figured it out, it seems to be working, but I need a dev api key? Does anyone know how to get one from pastebin?
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.
Damn I really appreciate your help, thanks once again
btw I already told you how to get an API key 5 hours ago @boreal sparrow
Oh yea sorry đ
Goldfish memory kicks in
However I'm getting:
invalid api_user_key
The key the login returns is just my-user-key, which can't be correct can it?
I'm 100% sure both my username and password are correct
final PastebinClient client = PastebinClient
.builder()
.developerKey("9jnYvqHwIzcScrSX0Q0eABPdIPMHjDA3")
.userKey("my-user-key")
.build();
final String userKey = client.login();
print(ChatColor.YELLOW + "----------------------------------- " + userKey);
final PasteRequest request = PasteRequest
//Requesting stuff
return client.paste(request);
I'm pretty sure that's what the documentation on the library said to do^?
isn't it required for login?
yes but do you need that? i thought you just wanted to paste something
logging in is to connect the paste to your pastebin account (e.g. so you can edit it later)
Yea I need to edit the bin later
if you want to login, you need to get the user key through client.login
and then throw that into the builder's userKey(...)
ofc then everyone with the source code can see the credentials though
What? I just removed that entirely and it works?
yea but it's only me
well ok
This will automatically assign the user key to the client for reuse in later calls.
oh yea
Is there some event I can use for tracking a conduit and whenever it tries (like in the game's code), to give nearby players an event? Like when it does the 'check for nearby players' thing to give effects to them? I want to make it have an effect on players on land and that would probably be the best option
but still, why can't I use a default value?
i don't understand what you mean with default value
oh sorry, well I though the .userKey("my-user-key") just sets a default value, and client.login(); would override it
but anyway, that doesn't really matter
Whats the best way to make a mob go to a specific direction/change its AI?
clear the pathfinder goals, and add a custom one, or simply get their MoveController and set the wanted position
(NMS)
hover over it and you'll see
@fierce cave hold over it
you don't need to pass a plugin instance into createHologram
it only takes in a Location or Position
no that will not work
I can see why I have you blocked
probably someone who ignored learnjava too many times
^
either pass in one location, or pass in one position
.
why are you using outdated plugins/api in the first place
decentholograms is the proper replacement for holographicdisplays right
I am back again đ, I now need to actually edit the paste. I have the paste key, but I don't see any way to get the paste data (not the text, but the full data itself), other than the list() function that just returns every paste you have ever made, so how can I edit a paste then???
i guess, though I'd just use TextDisplays without any dependencies
that's 1.20+ stuff though right
hi , uhh anyone used ormlite before?
?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!
i have 2 tables :
- players (uuid,name,nickanme,maybe other data in the feature)
- players_stats (kills .. wins .. etc..)
you actually cant for once, the pastebin api has zero way to edit an existing paste, so I guess I'll just delete it and make a new one
in players table , the playersStats_id will always be null how i can fix that?
my setup is simple for now ..
well the website uses some kind of api to edit
might just not be documented
its one to one relationship
User entity -> UserStats entity
like any other entity too
world.spawn(someLocation, TextDisplay.class, display -> {
display.setText("asd");
display.setWhatEver(...);
});
an example
Hey, paste_client.paste(request); returns a url, but I need the id https://pastebin.com/identifier, it seems a bit weird to just strip away the pastebin.com/, is it correct? I see no other way to get the key
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
why don't you just join both tables by player uuid?
You're not verified anymore
the player uuid could also be the primary key in both tables
by setting it back to the default value
like you remove any other entity too
?conventions
is it possible with ormlite?
i think id=true on the field would set it as primary key
in player_stats table it works just fine
my problem is acctully here in players table
how do you create the tables
@DatabaseTable(tableName = "player_stats")
public class SWUserStats {
@DatabaseField(generatedId = true)
private int id;
@DatabaseField(foreign = true,unique = true)
private SkuUser player;
}
it create them without any problem
@DatabaseTable(tableName = "players")
public class SkuUser {
@DatabaseField(id = true)
private String uuid;
@DatabaseField(canBeNull = false)
private String name;
@DatabaseField(canBeNull = true)
private String nickname;
@DatabaseField(foreign = true, foreignColumnName = "player_id")
private SWUserStats playerStats;
}
is that wrong?
why do you even create an ID field? just remove it and set id=true on the UUID field for both tables
ye
I think you have to define your column name for player tho in your first screenshot, since you reference it as a foreign column im the second
is that a new table?
Well the ID is not auto generated
You have to set it manually and then push it to the DB
You can have an ID auto generated with "autoGenerated = true"
it's pretty pointless to auto generate an ID if one could just use the UUID though
yeah
what's the way to handle it ?
Only reason could be speed, since a unique index is created for ID, but since you reference it "foreignly" it's fine
If I understood it correctly
players table :
- uuid
- name
- nickname
players_stats table:
- uuid
- kills ..
etc
yeah that's fine
I'm not @ home rn so I don't have to capacity to write the solution down. What you can do tho is reference your player in player_stats and omit the uuid and replace it with an int autogenrated Identifier so you can reference and delete it quickly in the future
so basically
players table stays the same
player stats table has
- int (id, autoGenerated)
- player (foreign lookup)
- and then your stats
my problem now is it set the entire class thinggy into the player_id
org.skywars.skyimpldata.entites.SkuUser@64286e1e
weird hah
no not doing that ..
this is how iam creating the user :
Has nothing to do with how u create it
where are you persisting it to the database?
this is the DataBase class i have :
what tableUtils
its from ormlite
where does it save the data to the database
could be possible that the database saves a toString version of the object
in which case just try overriding it
should be on the database documentation though
now its not setting anything :L
do i need to set the player id myself? i set it to auto generate
Why do you have a player id of there already exists a uuid?
that?
is it possible that for the same player, different sessions sometimes generate different uuids ?
these uuids are both me, i used this.playerUUID = String.valueOf(player.getUniqueId());
they are mongodb collections
also, when i join the server console says :
UUID of player Rxlism is d06c48d0-4145-36f0-8dfc-deebbf195684
wdym "it starts going up"?
well you add 1 to the y location everytime
also why do you remove the display and create a new one everytime?!
why don't you just change the text?
By any chance, was the server once in offline mode?
yep, my coworker set it to offline mode and also disabled enforce secure profile
offline mode generates a random UUID from the name
so in offline mode you have a different uuid than in online mode
well paper acc has a method to get the offline mode uuid even if u're online mode
in a recent code review someone had swapped to that method accidentally
so just a heads up ^^
the plugin wont probably ever run on an offline mode servers so thats fine
yes but the offline mode uuid still differs (using it will be an issue if u just want online mode)
why are you still creating a new entity instead of reusing the existing one?
it isn't random, what?
Do mobs not count as HumanEntity? How could I check if an Entity is an instanceof any mob?
So I dont get things like area effect cloud or arrows minecarts etc
by checking if your entity is instanceof Mob?
i dont get it
no, mobs are not HumanEntities
you are still creating a new entity everytime
no, you spawn a new one
by calling setText on the existing entity
ChatColor?
depracated
Not in Spigot
if it'd be random, then how would it keep track of who is who?
interesting
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
i got it semi working now , but i have a duplicate in 2 values :
guys
The essence of the problem:
I have a world, when a player enters, this world is copied, and a folder with a new world is created for the player.
The copied world is placed there. The bottom line is that when a player logs on to the server, he must be teleported into the world. As long as I don't stop the server, everything is fine. The player can enter, etc. and the world is located.
After I turn off the server and then turn it back on, I get a message that the world has not been found... ... What could be the problem?
the players table :
wouldnt it be easier to just use regular sql lol
Emily responded to this statement alex
after i use ormlite, yes!
Offlineuuids are made via the string âOfflinePlayer:â +name
not a need for help just wanna say Thank to all of you, this channel helped me a lot and i made the complex thing that i wanted to make thx to you.
Iâll take all the credit
help pls
Credit credited.
My bank wonât do that
get a credit credit card then
I have one not from my bank tho
yeah it's random with the name as seed, basically
obviously it's not random-random, otherwise it'd be different everytime
but I literally said it generates it FROM the username
I read it as it was random random
same username = same generated uuid
Think emily did too
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Donât even wanna know what u did
yeah maybe I phrased it wrong lol. I just wanted to say that the offline ID is generated from the name and has nothing to do with the "real" uid
"random" as in "no connection between offline and online uuid"
đđť
Probably the encoding on your source file
This is why translateAlternateColorCodes exists
Yeah we told you not to use section signs
why don't you just use the proper way
ChatColor class
the point is that minecraft itself doesnt even use § anymore
you should either use translateAlternateColorCodes or directly use the ChatColor constants
it's cringe to still use §
both of the methods above still create §
that's fine though because if it'd change, the methods would also change
a hardcoded § however wouldn't
yeah probably. still there is literally no reason to keep using § especially if one has issues with them
I mean if it'd work, ok. but he literally has problems with those chars and still doesn't want to switch to the encouraged way lol
just to be clear I'm not saying maco should keep the §
why would one use anything but UTF-8?
Learn to set up your OS, IDE, Compiler and whatnot correctly.
UTF-8 is the norm and everything else is heresy
Use UTF8, not all code pages are supported in all areas
no it doesn;t
UTF8 is also teh same as ASCII when in teh lower pages
lol
The UTF8 miracle is that for all codepoints below 128, a single byte is used. The entire ASCII table fits in there.
printable is 128
i found a fix for my problem but it didn't really suit me ..
it will be duplicate uuid bettwen :
players_stats:
id -> it will add the uuid of the player
player_id -> it will also add the uuid of the player .
but iwant a better fix :p
how often does bungeecord automatically ping the spigot servers
d
Hi, someone know how to generate a void world. Mine keep void on the first start of my plugin but on restart my world generate normal chunk ?
any idea how i can not use the player_id?
in players table?
i mean remove it completlty?
iam using ormlite [to make things easier, but endded up make it harder..]
i dont need the id , in players_Stats too cuz i have the uuid , but again i can't remove the id , or generateId from the player_stats ..
been trying for more than 2 hours now ..
idk - perhaps that id is required as the primary key?
i guess so too , but its been set to 0 everytime i join , or create new user
in players table
What is the best way to store an authentication token for an android app so that it would persist between restarts? Surely I can't just save it to a file?
But if this is a 1:1 mapping, then why don't you merge the two tables?
you mean both data in 1 table?
i did that , and i saw it not very tidy .. or nice looking
that's why i decided to split it
Idk about in Java, but when I use Node.js, I save it in the .env file. Maybe there is a way to save it as an environment variable?
he first table will contain :
- uuid
- player name
- nickname
the second table will contain :
- uuid
- kills
- deaths ..
etc
My concern is that if I store the token in a file, a third party can access it with ease
why not save it in a file ?
Is that fine?
You don't want your jwt tokens to be accessible to others do you
nothing wrong with saving it in file, that is how its usually done
if someone have access to your device, you are already bricked
saving it in a .env file makes it pretty safe, which is why I recommend saving it as an environment variable
Ok, that's fair
isn't a jwt token encoded?
true
Yeah but if you get someone's token you can act as them
Ty đ
oh yea forgot about that
why does my event not get called?
my listener is registered as other events do get called
What MOTD format can I use with serverListPingEvent's set MOTD
oh I just fucked my handlerlists up
Did you double-escape the u by accident?
Like did you use \\u00A7 instead of \u00A7
ij auto-adds backslashes when you paste something with quotation marks or backslashes into it afaik
show your event class
did you remember to add the static handler list
private static HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList() {
return handlers;
}
@Override
public HandlerList getHandlers() {
return handlers;
}```
should look like this I believe
oh lol
yeah, I forgot to make it static đ
well
I thought integer ids were gone since 1.13
Material.values[id]?
Why are you using integers when string ids exist
time to do a serializer for base64
What ._.
that returns a whole enum list for Material
ids are gone
but i'll just write my own base64 serializator
goodluck with that
Btw that'd be Material.values()[id] iirc
anyone off the top of their head, does dispatchCommand throw exceptions thrown by command handlers?
I don't see why it wouldn't
is their an "upsert" type query in SQL. I want to only insert if the row doesn't exist otherwise update. Would I just be best off running 2 queries?
run a "contains" query to see if the given result exists if it does run an update query otherwise run the insertion query
isnt insert xyz on conflict update
if you are using postgres they have nicer support for that too
sqlite has upsert too
i just found that
wow that is literally a thing
i run on speed yeah
y2k are you telling me you didnt try it first
does upsert exist in other SQL dialects ideally would wanna support more DB's down the line
well I googled stuff I just didn't see SQLite did have UPSERT
please abstract your DB interactions into specific dialect specific implementations xD

guh I didn't feel like that, but whatever I'll do that later
abstract DN
oh it looks like this doesnt do what you want
read this https://www.sqlite.org/lang_upsert.html
Deez nuts?
no comment
I wish Raven wasn't so big đĽ˛
I would totally use it for this
granted Raven won't work as well for this since its not relational
also isn't the whole point of SQL is being a standardized language
that'd be wild if their are a ton of incompatabilities in the eco system
INSERT OR REPLACE into "pending_contracts" (contract_uuid, player_uuid, current_kills, contract_id, reward_id) VALUES (?, ?, ?, ?, ?) hopefully this works đŞ
also my plugin doesn't even launch yet
does anyone know how I can install sources for a local dependencty
im using maven and intellij
can i make it so that player sees a potion effect on other player without the other player actually having it?
either with the api or packets?
invisibility to be specific
Hide the player
Easiest
Without nms
May i get helped with fndind the best and more appropiated structure for my plugin. Because my idea is to make it fully moduled but there wil be some utilities / features which will be just for Spigot and another for Bungee. But my goal is to each spigot and/or bungee feature be alone. So if i want to use a specific Bungee feature can just use it without loading the whole plugin
naa i need it to be a potion effect
so player is not visible
but can be interactedw ith
and has particles
You can clear and give without particles
You can run it with maven command:
mvn install:install-file -Dfile=/path/to/your/source-jar.jar -DgroupId=your.group.id -DartifactId=your-artifact-id -Dversion=your-version -Dpackaging=jar -DgeneratePom=true
Taken from ChatGPT 4
just potion effect without second party knowing
alr ty
bruh
tell me @quaint mantle ?
well its a lot of arguments i gotta fill so chill for a sec
oh haha, i haven runt commands with more than 20 arguments
So its not so much hhhaha
intellij has built in functionality
lol
yeah im looking for it rn
usually its at the top when i open a class
but it doesn't work
so i mustve installed it incorrectly
Have you installed for spigot with Built tools?
right, but you have installed it into your local maven repo?
yeah idk why I had to manually set the sources
At least when I build something the sources are not generated automatically if I don't use the maven sources plugin. Which is used to build the sources dynamically when the project is compiled.
if I setAmount to 0, will it automatically remove the itemstack?
Im trying to make a chat command, and if you have a permission you can use /chat reload for reloading the config, but im trying to do so if you dont have that permission you can still write "reload" as a arg in the chat command but right now it dosent send anything
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (label.equals("chat")) {
if (sender.hasPermission(Chat.plugin.getConfig().getString("Permission"))) {
if (args.length >= 1) {
if (args[0].equalsIgnoreCase("reload")) {
if (sender.hasPermission(Chat.plugin.getConfig().getString("Reload-premission"))) {
if (Chat.plugin.configFile.exists()) {
try {
Chat.plugin.reloadConfig();
} catch (Exception e) {
e.printStackTrace();
}
}else{
Chat.plugin.saveConfig();
Chat.plugin.getConfig().options().copyDefaults(true);
}
}else{
//HERE IS THE PROBLEM
String coloredChatPrefix = Chat.getStringColored("Chat prefix");
String message = String.join("", args).substring(args[0].length()).trim();
sendChatMessage(coloredChatPrefix, sender, message);
}
}
}
}
}
return false;
}
Maybe the sender does not have the first permission
Chat.plugin.getConfig().getString("Permission")
It has, i have check many times and i cant still see what the error could be
does the plugin actually get the permission from the config
did you print it?
what is this for if (label.equals("chat")) {
I would test each if one by one
Hey, I can't seem to figure out how to do this...
If I have 2 arrays like String[] one = new String[] { "one", "two", "three", "four" and Integer[] two = new Integer[] { 1, 1, 1 ,1 } and I want to loop through and change value of two based on position of value in one, how can I do that? I know that this seems simple but I'm a spoon.
Tried to, trust me, can you just please point me in the right direction?
I just alwayd have used that, but i can just remove that line right?
if you assign the command executor to be your command class, then you shouldn't need it
as it will only execute your code when /chat is ran
Oh okay, ill just remove that then
Do you have any idea how to fix my problem?
I would start with printing some stuff out
since some if statement isn't happening
Did you set executor to command?
yup, the command is working but if you dont have the chat reload permission you can type "reload" in a arg while using /chat
I think permission should be in codebase
Yeah but i just want so i can change it in a config insted of updating the plugin for updating the permission
i cam modificate the position on the healt? (using NMS)
how can i make an action from a spigot server send a message to the bungeecord
What's a healt?
hearts
Hello, how can I set a block hardness?
Nah its more like client side thing
ok
I wouldn't be surprised if you could using texture pack fuckery
idk exaclty how mojang displays those internally but you might beable to edit the height and width of the image to do shifting
otherwise maybe looking into shaders etc and looking at your options their may be helpful;
Any easy way for me to allow placing of signs but without allowing them to set the sign text on place?
I want to allow them to place the sign, but when they place it, I want to disable the edit menu that automatically pops up, and additionally set the sign text on place
By "client side", what do you mean, (I know what client side generally means, i.e. not server side), but what do you mean in this context?
Not in your control as a plugin dev
Can do this with a packet
Look on protocol lib wiki, definitely possible.
Do you actually want the sign placed though? (for everyone)
I'd cancel the place event/click and manually place it
Is there any way to ensure that a message sent fits in one line, on all chat sizes that the player can choose?
no
you can limit it to ensure its under
but fonts are a bitch
you can;t account for resource packs
okay
Is there a way, without packets, to display a change to an entity to a single player?
In this case, I want to change the scale and glow color of an ItemDisplay for a single player
y without packets
Just wondering if there's API support for that before I dive into packets
ah alright
packet api? Thats not Spigot
đ¤Ż
hello, the "connected" i assumed is a boolean. It always returns true whether the server is online or not
and all this code always gets executed
and i dont know how to stop it đ
im guessing the error might contain something
its just a throwable
I'm generating a payment qr code, but the image is size 200, and I use the spigot method MapPallete.resize, it distorts the qr code to some weird pixels, does anyone know a better way to do this?
200 PIXELS
I just started doing maps yesterday for qr cides
yo
i just scammed it
scanned it
and i thik i see an email
nah this not a problem
well i donated 5$
I think centre the QR code
i want like this
They have to have certain dimensions I think
photoshop
?
yeah bu t the size is not the same
i want centered uyk
like that
private static final int QR_CODE_SIZE = 100;
private static final int QR_CODE_MARGIN = 1;
private static final String QR_CODE_CHARACTER_SET = "UTF-8";
public static BufferedImage generateQR(String data) throws UnsupportedEncodingException, WriterException {
final Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.MARGIN, QR_CODE_MARGIN );
hints.put(EncodeHintType.CHARACTER_SET, QR_CODE_CHARACTER_SET);
final BitMatrix matrix = new QRCodeWriter().encode(data, BarcodeFormat.QR_CODE, QR_CODE_SIZE, QR_CODE_SIZE, hints);
BufferedImage image = MatrixToImageWriter.toBufferedImage(matrix);
image = MapPalette.resizeImage(image);
return image;
}```
nah
Why nah
the default size of the map is 256, the qr code is becoming 200
Isnât a map 128 pixels
mistake
Set size to 128 rather than 100?
i dont think it will work for some reason
Try it
Reduce margin?
actually it works, however it also is "true" if the sevrer is loading and not ready to receive players
đ¤
That callback is only for the connection. Seems like you should be using an event instead
both ServerConnect & ServerConnected am i right?
You only need 76x76pixels for a qr code
This gives the minimum optimal size to distance ratio of 10:1
Which is approximately 3 ft for that size i gave
why not just use a google chart link
I have a command which starts a taskTimer:
VRTask task = new VRTask();
task.runTaskTimer(plugin, delay, delay);
}```
I am trying to add a command like this to stop the timer:
```if (args[0] == "stop") {
//stop taskTimer
}```
However, I don't know how to stop it. How can I do this?
.equals when comparing strings
i swear this didn't exist before
it's been there at least for a month or so
what is it? I clicked it and it became a tick
copy
probably copy
lol
oh no I have poor code on my clipboard, I've been tainted
If the FBI come for me, it wasn;t mine.
How?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Bukkittask task = task code here
Now task is a variable with the value of the task and can be stored or whatever or just grab the task id it generates when you schedule the task
Either or works
hope he can differentiate between instance and local
what's the best way of making chances?
rn i have this:
https://pastes.dev/5xkBF4Wkxu
which seems meh
I mean Big O or JMH
i sometimes label my code with Big O xD
than JMH
yeah that's fair
i don't usually
if dont lag => gud 
yeah if you're not loading chunks or something or doing IO on the main thread, you must really fuck up to cause performance issues
how that lol
anyway, if I indeed have to measure performance, I don't worry about any big o notation or stuff, I just use JMH and throw a bunch of data in that's reasonable
alex, got a question for ya. How would you do chances? I've also decided to try pairs instead: https://pastes.dev/90tKj394li
it looks alright but i feel like there's a better way imo
here's an example of JMH:
Benchmark loader: https://github.com/mfnalex/PAPI-Replace/blob/master/core/src/jmh/java/com/jeff_media/papi_replace_expansion/BenchmarkLoader.java
build.gradle: https://github.com/mfnalex/PAPI-Replace/blob/master/buildSrc/src/main/groovy/papi-replace-benchmark.gradle
you shouldn't worry about number of allocations, only thing you really need to worry about are memory leaks
which are imo easy to detect, you just see you never have gc spikes
i usually use spark for that
yeah really any monitoring software/thingy
how can i make a gui in bungeecord only for let the player move from a sever to another
or how can i do within a spigot plugin a gui for move in server of a bungeecord
like a sever selector
Hello, is "internal use" okay for a librairy to create a custom NamespacedKey without using the plugin in argument?
NamespacedKey.fromString("papi:customblock")
is it better?
it's not marked as deprecated or internal
np
it's for block PDC đ
was added in 1.16.5 btw
hummmm, I'll need to think of it
Idk if I'll make my librairy usable for 1.8-1.20+
It's for custom blocks, and a lot of other things
I use this to create NamespacedKeys, it uses fromString if available, otherwise the deprecated / internal-only constructor https://github.com/mfnalex/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/PDCUtils.java#L124
I think it will be the best
interesting, thanks!
whaaaat ?
ArmorStand isn't really a LivingEntity?
it doesn't really have an AI or something like that
Yeah because it has equipment and stuff
he also can pose xd
Yeah Fancy armor stands
how from the interaction in a gui (spigot plugin) i can send a utf to the bungee?
utf?
ye the data send by plugin messagging
Just register a custom channel https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ye i know how register the channel but i didn't undertand the part on how read and how to write / send a message for let make to the bungeecord an action
amd like that i do the check and if It's the message x it will do an action automaticly in the bungeecord/spigot ?
Hey I am currently using the latest spigot version 1.20.4/3 but I have no idea how I can now register my own enchantments because the methods are gone. Can anyone help me?
Yes
You shoudlnt register custom enchantments but use PDC to identify them
Bukkit classes are not meant to be extended by plugins
okay thank you
Hah, enchantmentsplus remains unaffected
At least I think so, but I am not doing anything egregious in that plugin besides overwriting the bukkit unsafe (and even then the relevant code is safely wrapped around a try-catch catching everything)
You did what to the unsafe
I basically just replaced the value. Nothing too exotic
The implementation class is generated via ASM, so new methods won't brick anything either
Spooky
https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/src/main/java/de/geolykt/enchantments_plus/compatibility/hackloader/Hackloader.java you've probably seen that class once already though
By using a profiler
Dont go by big o notation either
Because sometimes the one that is least performant is more performant by that standard
I am far too accustomed to writing raw ASM transformers
Iâve written raw asm transformers
Still had to use bytebuddy to run them tho
Sadge
Spark is decent but it wont show you everything
you should know that biggie O is not performance measure, it is just a distinct way of saying how much your performance will scale with the amount of inputs, using a profiler is pro ably the best way to measure
Exactly
Most of the time you wont encounter issues with your code or notice anything unless its blocking
If I was to ever rewrite the class I'd use cafedude instead of ASM but given that ASM is bundled with bukkit it might make more sense to not use cafedude
Or you really are hitting some upper limit lol
But you need a really large server to do that
Just use offline mode and log more accounts in
This is one of the purposes of offline mode
As long as you apply best practices for code efficiency and keep your data closely related in memory, not doing heavy blocking it should be fine most of the time. To test with multiple players you can use mineflawyer (or something) with which you can create bots using JS
I hated when back in the days where I made plugins large server owners would say "timing report says your plugin is not optimized, plz fix". Thank God timing reports are soon to be a thing of the past
Lol
That sounds, stupid
quite frankly
I mean I worked with larger server networks before a couple years back and it wasn't a thing there whatsoever
Timings report was alright. It was more ideal to see if entities were causing problems and not so much plugings
Well I was still given the timings report so I knew which chain of events to optimize. But whyyy
I mean that's fine I guess as long as they don't force anything and reject your project
A Spark report would have shown a lot quicker that my getItemMeta calls were the bottleneck
Or at least that is what I think it was because after that I never ever received a complaint
Truth be told I was optimizing blindly which is quite the sin to do
yeah
Hello, I have a question, namely how can I use such a custom blockbench entity on Spigot? So that I can open something via it, for example?
Do you perhaps have a tutorial on how I do something like that?
it's basically just modelengine
Yes, my problem is, I don't know how to implement something like that because I can't find anything on how exactly to do something like that.
you can go the simple route and just hook into modelengine
or look at magmaguy's opensource plugin that does it
There's also AquaticModelEngine by larkyy
Okay, I'll take a look, I wanted to do something of my own
theres plugins that accept chat responses like cancel or stuff, how can i do that?
like it says you "to cancel this action type cancel"
and the plugin recognize it
how do i do that?
Conversation api
Anybody know why the latest dev build of ProtocolLib isn't triggering on KEEP_ALIVE packets with Spigot 1.20.4? It works with 1.20.1.
I created a ProtocolLib issue 4 days ago, but there's been no reply.
What are you trying to do
Measure ping time. The code has been working for 5 years, going back to 1.12.
Player#getPing
That returned a cursed value. It's not mathematically correct.
Hmm? I thought it essentially returned the same as the packet, maybe averaged slightly
Averaged poorly.
In any case, it's not what I want.
So I assume Spigot didn't do anything to break ProtocolLib?
I mean its NMS, who knows
Has anything changed for the scoreboards from 1.20.2 to 1.20.3?
In 1.20.2 I see the normal scoreboard, in 1.20.3 I see it in reverse
this.latency = (this.latency * 3 + i) / 4; looks like a simple average of the last 4 keep alives
is there any reason that's not suitable?
wdym reverse
how come 1.20.2 doesnt have numbers
mojang did update scoreboards a good bit iirc
- try 1.20.4
i believe lunar client