#help-development
1 messages · Page 2275 of 1
I'm pretty sure it's on ItemMeta
Look at the docs for Attribute and AttributeModifier
How can u make spigot plugins compatible for multiple versions? (1.18, 1.19, etc)
don;t use NMS
set teh api version in the plugin.yml to the lowest you want to support
build against the minimum version you are to run on.
If you want to use api on newer versions use reflection and proper logic
Cache fields on runtime if your using them a lot as well
Is there a way to add custom blocks with custom textures via spigot build tools?
I'm just trying to make a custom block like this
But I don't know how to go about doing it
Nothing that I saw on the internet really met my expectations/hopes
How do I completely freeze a player, I don't want them to be able to move, turn their camera (etc)
``
public class RedPanda extends Fox {
public RedPanda(Location loc) {
super(EntityType.FOX, ((CraftWorld) loc.getWorld()).getHandle());
this.setPos(loc.getX(), loc.getY(), loc.getZ());
this.setCanPickUpLoot(false); // Can Pick up Loot
this.setAggressive(false); // Aggressive
this.setBaby(false);
this.setCustomNameVisible(false); // Custom Name Visible
}
}
``
can sb explain to me how to add passengers on this fox
All you need for that is a resource pack

if (!itemStack.hasItemMeta() || (!itemStack.hasItemMeta())) return;
I think i meant to do if (itemStack.getItemMeta() == null || (!itemStack.hasItemMeta())) return; and just had an aneurism
Just try if(itemStack.getItemMeta() == null) return;
Lmao, ik. I was just sharing a weird thing i found in old code
ohhh.... sorry
np
Im not very familiar with gson
public DataManager(StartupClass plugin) {
configFile = new File(plugin.getPlugin().getDataFolder(), "data.json");
System.out.println("1");
try {
fileWriter = new FileWriter(configFile);
System.out.println("2");
}catch(IOException e){
e.printStackTrace();
System.out.println("err");
}
initializeConfig();
}
/**
* Should only be used by this class to grab/create the config
*/
private void initializeConfig() {
try {
if (!configFile.exists()) {
gson.toJson(new Data(), fileWriter);
System.out.println("4");
}
config = gson.fromJson(new FileReader(configFile), Data.class);
System.out.println("5");
} catch (IOException e) {
System.out.println("6");
e.printStackTrace();
}
}
/**
* Gets the Data object the config is held in.
* @return Returns the config object.
*/
public Data getConfig() {
return config;
}
yea its ok i dont feel like having a 14 year old accuse me of static abuse
GetConfig is returnning null
1,2,and 5 print
Wich is good
honestly i would just use an 8x8 pixel image of wings and just translate it into particles
for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
int rgb = image.getRGBAt(x, y);
if (rgb == 0)
continue;
Location loc = player.getLocation().clone();
double newY = image.getHeight() - y;
double newX = image.getWidth() / 2.0 - x;
newY *= (3.0 / image.getHeight());
newX *= (3.0 / image.getWidth());
//get position relative to player. += is to move it to the player's back
float deltaZ = (float)(newX * Math.sin(Math.toRadians(loc.getYaw())));
float deltaX = (float)(newX * Math.cos(Math.toRadians(loc.getYaw())));
loc.add(new Vector(deltaX, newY, deltaZ));
Color color = Color.fromRGB((rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff);
// spawn particle with color/loc
}
}
thats my code
"Ex8po48r5D8udJVq43HdjqJ3LSXx+mAAAAAAAAAAAA8nk4Nf2SJAAAAA10Uk5TAP///////////////y0EQa0AAABZSURBVBiVdUxJE" +
"sAgCIsUJhz8/3sLWPFSc8gGE+CK0Wa52WFINuOpnF40eerMrAKoJRckPKoxhtJWhhjNQz10/bIejsaN3vw1vukKGnqgssaAnsadcPB/" +
"5AXUbAHBZ7eW9wAAAABJRU5ErkJggg==");```
my image
that is what I personally did
Convert PNG to Base64 online and use it as a generator, which provides ready-made examples for data URI, img src, CSS background-url, and others
something like this
the Base64 I have is iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAACdQTFRFAAAA5j Ex8po48r5D8udJVq43HdjqJ3LSXx+mAAAAAAAAAAAA8nk4Nf2SJAAAAA10Uk5TAP///////////////y0EQa0AAABZSURBVBiVdUxJE sAgCIsUJhz8/3sLWPFSc8gGE+CK0Wa52WFINuOpnF40eerMrAKoJRckPKoxhtJWhhjNQz10/bIejsaN3vw1vukKGnqgssaAnsadcPB/ 5AXUbAHBZ7eW9wAAAABJRU5ErkJggg==
you can try to decode it to an image
for an example
It brokey
I also used org.bukkit.Color
oh oops
apparently its a custom class i wrote
hold on
?paste
ignore UtilError
just use e.printStackTrace or smt
yea something like that
just whatever you normally put in a catch block
how can I add an invisible item frame to the bukkit inventory? (in the game we usually type /minecraft:give @p item_frame{EntityTag:{Invisible:1b}} to get it)
I have this code right now, there I defined a display name tag, but I didn't found how to define the invisible tag for that
https://paste.md-5.net/hipesezate.http
can someone help with the brokey
are you using org.bukkit.util.Vector?
i actually checked
entity tag meta is not exposed in the Bukkit API
you would need to access NMS
thanks! I don't know what is that NMS, but I'll check what is that
is there easy way to do this?
it prevents your plugin from being used on multiple versions without modularizing
like just import net.minecraft.server;?
nah, it brokey
I'm new at this and I don't know what that means :/
new at spigot dev
should I change ItemMeta to CraftMetaEntityTag
it doesn't allow me to import net.minecraft.server;
is it so hard to spawn an item with custom tag?
not even custom, vanilla tag but custsom defined
nah, it worky!
you would just make an 8x8 image
or any size, i just use 8x8 cuz thats easiest
and you can draw anywhere on that image to create your shape
yes... just be aware the processing power is n^2 for whatever iamge you choose
so thats
Yes but it doesnt exist in that class
4096 iterations
hence why your getting the error calling this
you could probably optimize it by only storing necessary values
and looping over the pixelsy ou need
but i think my solution is pretty simple for smaller images
wym custom tag?
Like name tag?
no
usually we are typing this in game /minecraft:give @p item_frame{EntityTag:{Invisible:1b}}
to get it
You can get the block data of the ItemStack that is a ItemFrame
and then ItemFrame#setInvisible(true)
and then get the block data back to ItemStack
it entity
whatever tf its called
tile entity
that
how can I do this?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/ItemFrame.html#getItem()
This gets the ItemStack of the item frame
Im trying to find convert ItemStack to ItemFrame sec
declaration: package: org.bukkit.entity, interface: ItemFrame
or you could use NBT tags
i cant remember the exact process behind this, i know it for NoteBlocks but theyre a real tile entity
where as it seems ItemFrames are barebone entities
i know what you can do
here this is way easier
are you on 1.14?
add a pdc tag of whatever with a key of invisible and a value that will represent "true" to you
and when someone placed that ItemStack with the invisible pdt, get the block location, get the entity at location, cast to ItemFrame (Cast check i mean) and then setInvisible
@EventHandler
public void onInteract(PlayerInteractEvent e) {
if (!e.isRightClick()) return;
if (e.getItem().getType() != Material.ITEM_FRAME) return;
if (!e.getItem().doesntHasPdcTag()) return;
// do that stuff i said
}
psudo code
but what you can do ^
it says "cannot resolve pluginInstance symbol" here
because you didnt define your pluginInstane variable
You can use DI or a static getter
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
like
String pluginInstance = "";
or something?
what should I type for this variable
String PluginInstace? interesting one
not a String
You dont serialize your main class to a string and back again?
Thought this was standard by now smh
my main class is called BuildingHacks
learn some more java before you continue do yourself a favor
So you can create a static BuildingHacks variable in your main class, and set its value to this in onEnable
or dependency injection
which is way nicer
hmm error is gone
?learnjava btw for resources
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.
wth yall doing with all this 16x16 8x8 64x64 stuff
server icons?
okay i see the rocket scientists are in the channel
oh fr
thats actually interesting
like no vector and velocity math whatsoever?
if so that is quite literally rocket science
ggs (good jobs)
thats cool asf i hope to see this plugin around some day that sounds dope
You could let players draw theyre own wings
I would personally just have ymy wings be 2 penises, but thats me
Does SpigotMC have an API for updating resources?
Yes.
It has an API, just not sure if its publicly exposed/documented
you could 100% reverse enineer it using f12 console while pushing and update tho
just get the rest urls and bam
Hmm, okay. Thank you.
I looked it up and Xenforo itself requires Administrators to create an API key
But there is options to limit it to a certain users permissions
check your cookies for a user key
might be one there
will likely be encrypted tho
I would assume your can execute POST as long as you can find your user JWT token or something
I'll look into it, thanks Burchard
Im just not sure if this is encrypted or not which will be another issue, might not be though
I mean requests are executed client side anyways i beileve
so shouldnt be
posted client side**
not executed
that would be bad lol
Cloudflare sometimes checks browsers
FYI xf_user is $userId. ',' . $this->prepareRememberKeyForCookie($auth['remember_key']);
hmm
what does prepare do? Does it do any encrypting?
or just sets the cookie to the client
as long as the token isnt encrypted by spigot before it reaches xf this should all be doable
I doubt I can use this to access the actual REST api though
It will likely only give me access to the form
why not REST apis are mostly public
Idk how xenforo really works, but a REST server is a REST server
and anyone can contact a REST server
Anyone has an idea why when I save my default config this
Color: 222:31:18
turns into this
Color: 801078 ??
likely yaml parser
encapsulate it
"222:31:18"
tried that and than it works
but the funny thing is i have another one above it
and there it works like that
without " or '
show your yaml maybe the one above is valid yaml with it
I guess I'll find out. Thanks.
the Color from Join stays as it is when using saveDefaultConfig(), the one from Quit gets weird
also if I put " or ' in front of both colors, the one from join gets saved without those " or ' while the one from quit has them
found something interesting
for profile post endpoint
this is the data structure
youll have to figure out wtf those token are
theres multiple in the bottom one seperated by commas
its 100% just a basic rest server
you could send this exact request with a rest client in your browser
i dont have a resource to upload or else ide upload its schema
That one likely requires some type of stream though maybe
I'm more worried about the cookies imo
this is where ifound my rest info at
yeah cookies is gonna be a bitch bc they will refresh
idk the timer for a spigot token refresh
so this solution would only be temporary until cookies on your browser reset with new tokens
Also most of the forms have a _xfToken field
i know what the second and third one is
1st comma is your user id
2nd idk, it looks like some internal user id
and the 3rd is one of your cookies
Oh, it's reproducible
The second one looks like a timefield
okay even better
both xfToken fields in my sceenshot
are the same
so you just need, your user ID, the internal ID
annnd
this cookie here sec
xf_session
Yeah, that might be do-able then.
is the key you need
Would still be nice to have a proper api key, that would mean I wouldn't have to mess with cookies. If there is some way to get one looks at forums staff I'd love to know 🙂
dont think theyde do it sadly
just opens up security vulnerabilities that they have to worry about
It wouldn't be a permission issue. The api has built in restrictions.
For permissions
But yeah, I'll work on this method for now, thanks Burchard
I think I have everything I need now
As long as Cloudflare isn't too restrictive
there is CF cookies so you can maybe do something with those too if they arrise
i dont think youll have an issue with cf
On certain configurations cloudflare will detect non-standard clients
And changing the user agent won't do anything
oh this gonna suck
every single cookie
you need to pass into your physical rest request (Not the data of it)
Every one of them?
I mean if the data doesn't matter that won't be an issue
But I figured only some of them would be needed
that in the POST request headers
which is every cookie in your spigot.com browser
you might be able to make a java program to snag cookies from your browser, idk
They often don't check every single cookie
nah likely not like the certs and colornames
You can often copy it to a curl request
Not sure if that includes cookies..
It does
cant find the button on chrome sad
and i cant viewraw on headers
only for response
all in all why would you even wanna do this
sounds like more pain than its worth
even if there was a publicly documented api
If there was a publicly documented api it would make it a lot easier to publish updates when I make a release on github
Most of the cookies are unneeded by the way
I can't post images
anything special happen or nah
I got some binary content back
Yeah color ones just seem to be for colors of the website or some other bs
yeah its likely a buffer of some sort
might need to do it through a java program or nodejs
oh yeah true your only posting a file
nods
Not even a file
Just a link to the new release on github
So I don't have to worry about having to send a whole file in the POST
ohh even smarter
so
idea
to avoid ALL this shit
make a tag called LATEST on github
point your spigot url to that
when you update, make a tag for your old code and upload
delete old latest, reupload to new latest tag
url stays the same
code changes
It wouldn't send an update on the site.
ez
So users wouldn't know anything changed
oh shit
damnit spigot
i cant win man
yeah no easy way to do it unless optics lurking and laughing at us
or choco
"hehee dumbasses there is documentation all along"
Lol.
That would be nice.
I mean I got most of it figured out. As long as cloudflare isn't a d* it should work.
I can't test it until the next update of my plugin
your biggest thing is just gonna be the session tokens
cause those definatly change idk how often tho
True, but those should stay the same for quite a while hopefully
a lot of standard experations are ~4-8 hours
or 30 minutes
its either 4 or 8 hours, or 30 minutes lol
never see anythin different
JWT's default experation is 30 mins iirc
Shouldn't it be longer if you have remember me selected? o-o
oh no 24 hours
remember me is just so the website knows to store your session
typically thats a client sided button, nothing on the server ever happens
if its unchecked, the session just goes to a variable in the code
checked, saves session to from cookies
i worded the last one badly
cant fix it
you know what i mean lol
at that point i would just manually update it ngl
True..
Cause its useless if you gotta go to it every few hours updating a token
I'll contact forum staff and ask for an API key
maybe theyll give it, never know
Mhm, it's worth a shot.
i think getLocation returns the players feet location
so just go one block above
if != Air hes crawling or suffocating
and if getLocation if head location
same thing
cause his head will be where his feet are lol
i was about to say - 1 from the y but then realized it would be same location haha
caught myself
just use player location
yes that one
i just with javadocs said if it was feet or head, but for you it wont matter
ofc
oh no
not that
you need to get the block above
and check if its type == air or not
if its air, hes likely standing up
you may wanna check both feet and head locations
Any good idea for a mines plugin?
and see if both blocks above both are air
Because in some circumstances a player head can have air above, but the feet can still be under a block making the player crawl
Open source the new private mines prison servers are using now
with upgradable sizes and stuff
What?
They did it open source?
This is a git question, any reason why rebasing deletes newly added files?
Because you're rebasing
That doesnt make sense
Ok not really deletes newly added files, but some new commits are lost
😦
Fml
Use isAir() instead
isAir is 1.14+, might break backwards compatibility
Another benefit of using it
👀
People not on 1.17+ dont really deserve much support anyways
Do client borders that are created & set to a player persist?
declaration: package: org.bukkit, class: Bukkit
Logically i would say no. If the player joins then he gets the current world border send by vanilla.
Alright thank you
Tryitandsee kinda thing

im having a bit of trouble rn setting the type of a block. for some reason i can get the type but cant set it. would the fact that i am doing this in a timer be the issue? when i run the set type it does break the timer so thats what im assuming. if so what might be a workaround?
eh that's your opinion
some people don't want to run 1.13 and up servers because of the low performance, and some people want to have 1.8 combat. although, admitedly, there's plugins for that
i think it's fair to not want to support them but i personally like to
Quick question. So I am doing this to spawn a Ender Dragon to a player but it spawns a phantom. The ID of a Dragon in 63
PacketContainer packet = manager.createPacket(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
packet.getIntegers().
write(0, 343).
write(1, (63);
packet.getDoubles().write(0, p.getLocation().getX())
.write(1, p.getLocation().getY())
.write(2, p.getLocation().getZ());```
cross reference it with wiki.vg for the version you're running
Or you can just debug the entitytype iregistry
in 1.18.1 I know it's IRegistry.Z
@spare marsh
Getting a funky error
Exception while handling onBottomClick, slot=4 java.lang.UnsupportedOperationException: null
itemList.add(itemClone);
ItemList seems to be empty, but not null
how did you get that list
ANd thats the issue
Collections.emptyList ?
new ArrayList<>();
usually that issue only happens with Arrays.asList or Collections.emptylist
if (!playerListMap.containsKey(playerUUID) || playerListMap.get(playerUUID) == null || playerListMap.get(playerUUID).length() == 0) {
return new ArrayList<>();
}
Oh
wait
I might be using asList
return List.of(SerializationUtils.deserialize(playerListMap.get(playerUUID)).clone());
Leme see where the issue stands in this area of the code
leme debug rq
Can confirm
This is the issue
Deserialize returns a ItemStack[] that needs to be a list
How do i do it correctly then?
use an arraylist
I basically copy pasted this, ill have to figure out how to do that without fudging it up
Ok, i havent tested it
But it wont let me clone it now because its not an object
How do i clone a collection?
nvm
new ArrayList<>(ListToClone);
I want to make a system where players can put an item in a menu and can retrieve those items through a different means later and when they reopen the menu, the same items with the same nbt properties will be there. How should I go about storing this? I want it to be scalable to hundreds and thousands of players, not just a config file, system memory or something that can easily break
Back the inv in a collection and use it in both events
How can I import in that class? (I'm still learning)
That would store it in system mem, no?
Where are hashmaps stored
in memory
hashmaps op
I got a question
for (String arg : args) {
switch (arg) {
case "-all":
clearAll = true;
case "-force":
//This arg automatically confirms cluster deletion
toBeConfirmed.add(playerAsPlayer.getName());
case "-world":
world = Bukkit.getWorld(args[1]);
if (world == null) {
MessageUtil.sendMM(player, plugin.getLanguageManager().getString("commandGeneric.errorWorldNotFound", null));
return;
}
}
}```
for something like this
where I create a command that has -args
is it best doing it like this?
or is there another way that is easier to manage?
I tried experimenting with enums but it started to get confusing
A switch case is ok. There are better ways of parsing flags in a command. Usually you have something called the command stack of which you pop arguments.
Command:
/command -type nether -force -world super cool world
Resulting in this command stack:
world
cool
super
-world
-force
nether
-type
You pop until you get a processable command. Everything before that is an argument.
pop > world
pop > cool
pop > super
pop > -world = processable
# invoke '-world' with 'super cool world'
pop > -force = processable
# invoke '-force'
pop > nether
pop > -type = processable
# invoke '-type' with 'nether'
and are those flags stored in some sort of arraylist?
then a simple for loop to check for flags?
Are we speaking about the identifier (String representation) or the invoceable?
You create a Stack<String> from the String[] args
And then pop arguments from the top
Let me write an example
I wrote this up
Stack<String> argsStack = new Stack<>();
for (String arg : args) {
argsStack.push(arg);
}
while (!argsStack.isEmpty()) {
String arg = argsStack.pop();
if (arg.equalsIgnoreCase("-all")) {
clearAll = true;
} else if (arg.equalsIgnoreCase("-force")) {
clearAll = true;
world = playerAsPlayer.getWorld();
} else if (arg.equalsIgnoreCase("-world")) {
String worldName = argsStack.pop();
world = Bukkit.getWorld(worldName);
}```
is that what you were talking about?
this is better for me, I just kinda hate the if statements
Not really...
How can I know how to calculate the number of the Bit Mask? I got confused, all I know is If you want to enable all skin parts, you need to put 127 byte.
Just do a bitwise or
For example cape jacket and head is:
byte flags = 0x01 | 0x02 | 0x40;
Ah okay
And if you want to just set every bit to '1' you simply do
byte flags = 0xFF;
Wait thats unsigned
Can I like assign value outside the instantiation?
Like originally I had byte flags = 0x01; but I want to add another value let's say 0x02, is it possible?
So your question is: Can i do declaration without initialisation
And yes you can re-assign a value to a variable
At any point as long as its not final
Basically I want to have an option to enable/disable specific skin part on the config.
Ah i see what you mean. One moment
byte flags = 0x00;
if(isCapeEnabled) {
flags |= 0x01;
}
if(isJacketEnabled) {
flags |= 0x02;
}
...
if(isHatEnabled) {
flags |= 0x40;
}
May I see your example?
Oh yeah. Was afk
all g, no rush
public class WorldCreationCommand implements CommandExecutor {
static class WorldCreationAccumulator {
public void force() {
// Do stuff
}
public void world(String name) {
// Do stuff
}
public void type(String name) {
// Do stuff
}
public boolean complete() {
// Do stuff
}
}
private static final Map<String, BiConsumer<WorldCreationAccumulator, List<String>>> PROCESSORS =
new ImmutableMap.Builder<String, BiConsumer<WorldCreationAccumulator, List<String>>>()
.put("-force", WorldCreationCommand::force)
.put("-world", WorldCreationCommand::world)
.put("-type", WorldCreationCommand::type)
.build();
private static void force(WorldCreationAccumulator accumulator, List<String> arguments) {
accumulator.force();
}
private static void world(WorldCreationAccumulator accumulator, List<String> arguments) {
accumulator.world(String.join(" ", arguments));
}
private static void type(WorldCreationAccumulator accumulator, List<String> arguments) {
accumulator.type(String.join(" ", arguments));
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
Stack<String> commandStack = new Stack<>();
commandStack.addAll(Arrays.asList(args));
List<String> commandArgs = new ArrayList<>();
WorldCreationAccumulator accumulator = new WorldCreationAccumulator();
while (!commandStack.isEmpty()) {
String element = commandStack.pop();
if (PROCESSORS.containsKey(element)) {
PROCESSORS.get(element).andThen((acc, list) -> list.clear()).accept(accumulator, commandArgs);
} else {
commandArgs.add(element);
}
}
return accumulator.complete();
}
}
This is a bit crammed and should probably be split into several classes.
And some abstraction is also something to consider
Ah thats a lot better, just what I was looking for, thank you
is 17MB for a plugin normal
What's the difference between getPlayerListName and getName?
NO
what libraries you get in there?
That’s huge
uh jda
i got jda mongodb and log4j
public static void connectPlayers(Player player, String server) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(server);
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
}
Is it written correctly to change players server? It does not seem to work for me, when passing player and server name on bungee
api version is 1.17
ok - use the library loader
did you register the outgoing channel?
are shadowing your entire p stash?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
look at “libraries”
in main class right?
alright thank you
in 1.8 servers how can i get crop age?
NMS only
sadly
thankfully*
I dont think those methods were added till 1.12ish
somewhere around that time
?
Is it possible to keep player's chat box opened without the player need to do anything?
if i print this event.getBlock().getState().getData() i get POTATO(7) i can get only 7?
Packets maybe, but thats a client thing
should I make my plugin in 1.13.2, or 1.19?
No one here really knows about how to do the ages in 1.8, it wasnt really a popular thing to do
and its -
1.14+
i'd prefer maximum compatibility
not 1.13
1.14 for PDT
that way you never need to touch nbt
👌
1.13 has performance issues anyways, uses lots of ram
does any server even use 1.13-1.17 anymore
who has the graph
Do you know what packets by any chance?
lemme check bstats
bstats never works for me
no all members dont know only you dont know
does for me 🤷
Negative, since its a client thing it might not even be possible since normally it requires a key down input
its not possible
you would need to simulate keydown on the client somehow
likely only doable with mods
clearly, it is best to develop for 1.18-1.19
1.14 isnt too much different from 1.18-1.19
just use string values for your materials
and your mostly fine
eh
you would still likely wanna do the material thing as theres new materials between the two iirc
yeah
if you do that your plugin will likely support down to 1.14 automatically
my plugin uses A LOT of materials
unless theres some new event or method created your calling
yeah so your likely not even referancing materials anyways
yeah it's all config
do I just add it and remove the maven dependency? cause if I do it errors
is Material.valueOf not good?
yeah so you can develop for 1.18-1.19, and tell people if it works on 1.14 good for them
tbh
im not sure the difference
ive used both
what Java version is 1.14?
Java 8 right?
so 11
nah i think ive ran it with 16 before
in fact
lemme try with 16
update
ive never actually developed on 1.14

java 16 doesnt work with <1.16 iirc
ah so the last numbers do match
explains why i have jre 14 with 1.15
if you develop with jre 14 you can suport 1.15 lach
idk if 16 has new features you need or not
14 has new switch thingie mahoozers iirc
are there even breaking changes to jdk?
well paper is weird
i would develop for spigot
if you develop for paper you cant put your plugin on spigots site
jdk 8 is 52
oh is it
Java 1.0 45.0
Java 1.1 45.3
Java 1.2 46.0
Java 1.3 47.0
Java 1.4 48.0
Java 5 49.0
Java 6 50.0
Java 7 51.0
Java 8 52.0
Java 9 53.0
Java 10 54.0
Java 11 55.0
Java 12 56.0
Java 13 57.0
Java 14 58.0
Java 15 59.0
Java 16 60.0
Java 17 61.0
Java 18 62.0
Java 19 63.0
Java 20 64.0
idk the numbers i know i see class error 52 a lot when im messing with reflection lol
even though im using jdk 16
so 1.14 was Java 8
nope
i run my server explicitly with 1.14
oh sorry
thought you meant 1.15
my bad
1.15 might support 15 jre
idk why java verisoning has 3 formats
fucking annoying
@Override
public void onEnable() {
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
public class SendPlayerServer{
public static void connectPlayers(Player player, String server) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(server);
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
}
}
I'm getting annoyed, why it does not work...
so what exactly isnt working
yea lol
Are you calling connectPlayers somewhere?
did you solve your java problem
ya
seemed like you were getting mad so I thought you did is all
burchard
player.sendMessage("Zostałeś przeniesiony na serwer " + args[0]);
SendPlayerServer.connectPlayers(player, args[0]);
It does fire so idk
my donation got processed but I can't change my username
because the username is already taken by me
oh
on my alt
i don't know why I made an account called quared (I logged in to make sure it was mine, and yes, it was)
is plugin freelance an ez way to make side cash
and idk what to do
ehhhh
if you have a really good lib
i've contacted support to delete the other account
yes, good lib allows you to shit out lots of plugins
So each project you make you slowly build your library and become more powerful
i would of just switched accounts hahaha
thats what i do with BurchAPI
but i can post premium resources o nthis one
depends on whats the plugin
or if you just take commissions
ahhh
and how good you are
like a dev team for example
commissions arent bad especially if you sign up for senior team
i worked for a commission team once, made a few hundred for some simple plugins
one was a chest shop plugin
another was just a simple /help gui with a bunch of weird config options i dont remember
but i did all that before i made any type of lib so i was constantly rewriting the same code
i mean i made a lot with it, but taxes are annoying
the cuts
germany
ohh
yeah cuts are annoying but
minimum for dev projects was like 50$
so you made 30-40 min at all times for the lowest project
I'm trying to figure out a way to use my plugin skills to make money
if "cuts" is "steuern" in german
first
make free plugins
that too
lol
then make some free plugins
all my stuff is private rn so I'd have to make free plugins...
does anyone know what to do in my situation though
or just sit around and help people in here, get your name out there
You need to be very very good in order to make some decent money.
brand yourself
no ones gonna wanna hire you if you just come up and say "Ima a devloper"
have some past projects, some public github projects
etc
my private repos are godly guys trust me
Smile, can I do this with the code you showed me, will the affect the commands in any way?
take my money
public class WorldCreationCommand implements CommandExecutor {
private static Player playerAsPlayer = null;
static class WorldCreationAccumulator {
public void force() {
toBeConfirmed.add(playerAsPlayer);
}
public void world(String name) {
// Do stuff
}
public void type(String name) {
// Do stuff
}
public boolean complete() {
// Do stuff
}
}
sell courses 💀
coaching for $3k/month
my plugin is going great so far
No. This is a dirty way
ayy hell yeah
do I need to make insane 100k line long free plugins
ngl ide do some cheap classes
however, i did abandon it mid last year
Whats a clean way?
nah. less code runs better
Because passing it makes all take player
libs are essential in this
and thats annoying
most developers create some type of libs for all theyre plugins
static class WorldCreationAccumulator {
private final Player sender; + constructor
public void force() {
toBeConfirmed.add(playerAsPlayer);
}
public void world(String name) {
// Do stuff
}
public void type(String name) {
// Do stuff
}
public boolean complete() {
// Do stuff
}
}
make them independent
true, libs make your life easier
wym by that
little confused, im prolly just tarded
but then ppl can just snatch your libs are the competition goes up
if someone goes through the process of ribbing your lib from decompiles class files they deserve it
i have no idea
that you should make your plugins independent. i dont like plugins where you have to download 10 libs to get it to work
aerodactyl?
lol
noo
Think of it as a template
lib is shaded in
Never make your plugin depend protocol lib
oh i thought of something like "XCore"
ProtocolLib
i wont use plugins that do that
can i just post videos of private plugins and call it a day
except
lmao
lmao
for protocol lib
is it too big or smth
plugin size goes brrrrr

because only weaklings use protocol lib
Not to flex or anything
Because its a standalone plugin and not just a library
but BurchAPI is like 30kb compiled
Protocolize 
Whats the alternative?
duplex
Protocolize

inject your own duplex handlers into the network thread
Yeah for listening. But you have no abstraction for handling/sending the packets still.
you have the duplex handler context
you rn
spelling scuffed
you can send packets like that
but you know what i mean
public final class QuaredLib {
private static JavaPlugin instance;
public static void setInstance(JavaPlugin instance) {
QuaredLib.instance = instance;
}
public static JavaPlugin instance() {
return instance;
}
}
is this the correct way to make libs
idk i'm too dumb
i setup a external rest server, that from there i make users of my plugin download a client, that allows connection to that external rest server, from there i manually send strings like "OpenASign" to the rerst server, where the client is constantly sending a refresh rest request ever 5 milliseconds to listen for actions like this, from there the client i developed will execute the action from the rest server
works so well
idk why more ppl dont do this
like cmon guys lets start making real code now
nodebleed ensues
why the setter and getter
most libs shouldn't need to be java plugins anyway
it's not an independent plugin
why not make your lib wrap around JavaPlugin
sac
i love the naming btw
ill show an example
how pathetic
it does
you shade it in
and in onEnable
do QuaredLib.setInstance(this)
i dont need to do that
usage is like this:
and my lib has entire access to the using plugin
do note you will wanna relocate your lib to a new package
with the maven plugin
if 2 plugins use the lib its gonna go catwhoncus
i wouldnt expect a lib to represent the main class which i can just extend to make another main class out of it
stream exist
Its for ease of access to the using developer
:((
still not a good design imo
there's never a good design dammit...
then i would rather initialize the lib with the main class
So you would rather users to enable the api by doing everything here?: https://github.com/Burchard36/BurchAPI/blob/8d99e93be12eef8e26f1f102245f1f2e2316028b/src/main/java/com/burchard36/api/BurchAPI.java#L38
or just...
no
Api.enable()
never
handsfree evrything
why even call methods?
its redundant
your lib should remain a lib. there have to be some sort of abstraction
PacketEvents
it is a lib?
It handles instance based things
like MySQL
inventories
Why should i force api users to enable all this themself
when you auto enable it by default
and then if users dont want it they can call methods to disable it
that sounds counterintuitive
sounds like a standalone plugin the user can hook into
No its not standalone
it requires a plugin to run
It provides DI for auto registration
api should only enable features once a user actually calls a method related to said feature
Well testing for instance
I registered the "BungeeCord" channel in the main class, why nothing is happening when i sendPluginMessage 😵💫?
testing is fine since they can just disable the module
or disable specific commands from auto registering
No I’m talking about unit tests
Because then you can mock the entire lifetime
But if your plugin automates it that part of the lifetime becomes in principle unmockable
mocking in unit tests
pshhh unit tests
way to ruin the fun conclure
I mean not only unit tests, if you have higher level tests it’d still be highly appropriate
Well you do, but your api consumers might actually be unit testing
In which you create unnecessary hassle for them 
Test on production 😎
never test 

yeah but tbf i dont really think for unit tests especially in mc plugins
this is the only real way to test
like conclure said, you dont. but if someone else wants to use the lib, they might
Just advise them not to while using it

*every 1 star lib on github
i dont see any reason for unit tests its like just test it
how does one unit test bukkit runnables
Does someone here unit tests their mc plugin?
plus im sure theres way to go around it
Well depends
like said i have no idea how unit testing works
Is the runnable gonna be executed async or on the server thread, is the runnable dependent on the server life cycle
for minecraft agree, if you dont have some important model logic which has to be tested everytime
WTF it does connect but it does not redirect, when i disabled one server it returned "Cant connect to the server", player stays on the same server ;/
all my plugin does for auto registration is read the jar file at runtime for classes
Yes
is the other server empty?
sync repeating dependent on server life cycle
On server thread and yes it depends on server lifecycle
Professionally I have to unit test and work with design driven development
only things async are database calls and IO calls
DDD sucks
It's empty yes
and similar
I would love to see it
Then you need to emulate an entire server and mock everything in principle
thats the problem. there have to be a player on that server to receive the message
Idk I mean I mainly just need to test the api
i'm out
Wouldnt you have to do that for mc plugin unit testing already then?
Yes
soo then theres no issue then
But let’s say you’re able to isolate some of the business rules
Then you don’t need to emulate
at work we follow the DDD principle which kinda restrict us from doing certain things
Yeah, tho I do prefer ddd over simply tdd
your not gonna be able to use the inventory system in tests
Yes
TDD is aids as well
but database, file system, other things will be fine
That requires mocking burchard
So to make "Connect" work i need to have at least one player?
wdym
that doesnt need a server instance
Exactly
exactly or use alternatives
Can’t deny that
So then, theres no real worry here for unit testing with this style of auto registration?
wrong reply
was meant for conclure
Could you provide me the alternatives
Well seems like you’re testing modules rather than units then but that’d require some mocking and then it should be pretty straightforward I believe?
I mean Idk haven’t looked at the code
But probably not
?paste
We can use mockito and powermocks in case the library really sucks
Suggestions? Even if its just formatting or naming. https://paste.md-5.net/upavoqifal.java
if you wanna unit test packet stuff do you need a mock client
again, why would you mock in unit tests? arent they supposed to actually test a real case scenario with real logic?
Yes
You’d mock that, if you use netty you might mock the channel, if you use the send(Packet<?>) you probably wanna mock the invocation object simply
Isnt calling Class.forName taxing?
i would assume it might be, not sure
Yes, thats why its statically done once
Well I mock to isolate error sources, "assume everything else works, does this unit also work?" (Becomes important when you deal with external parties such as libraries or perhaps database connections etc)
well you could provide a not null semantic
Its private, called from inside to initialize teh static Fields
once at startup
oh damn im tarded i missed that okay nvm then
Yep good idea. Just to be helpfull
Hmmm
Stilll nothing
other client is on the server
Was it you that told me about the work stealing pools?
if you were, Would this style of executor be viable on mobile decives as well?
I guess
But yes I did tell you about it
FJP - work stealing pool is good because it is actually capable of structuring its tasks to a parent child relationship but also the implementation is optimal to the other implementations
But on mobile devices idk
Kk sounds good, was working on my front and and needed to use futures for loading stuff bc the front end will freeze otherwise
Was considering yoinking my socket code over and that was the main concern
Depends on how many cores they have
Yeah most the time its not a lot
its for android, and lots of snapdragon cpus have 2-4 cores
Hmm
lemme see what my cpu is
Either that, sadly we don’t have the structured concurrency api with virtual threads in any stable java version
Else I’d have pointed you towards that
oh wow, 8 cores for galaxy s9
Hmm yeah you could go for a fjp
Yeah just sucks with mobile device support
Or a fixed one with a min max size
cause a lot of cheaper androids have shitty cpus
How to do 1.19 spigot server? server.jar i mean
maybe i could go for a fixed pool with where the size is half of the os.threadCount method result, forgot the exact object that called it
Is this a coding question?
Or are you asking how to start a 1.19 server
i can't find a jar file
1.19 spigot
I tried to do it myself

