#help-development
1 messages · Page 136 of 1
anyone knows how to obfuscate aa forge mod
Have you ever done any coding before?
is it? let me see
give!
not a single one
if i publish it will be really easy to reverse my plugins.
what the hell its true
thats gonna take atleast a year, i have no clue dude, i just wanted a simple bot
i see, nice to know thank
I learned nodejs while coding along with codelyon
but to code a bot, it takes more, and with almost 0 english skills, i cant
i tried already
I
yes
Hello, how do you get At to have what he writes in color in the chat?
i dont even know what to start with, or even how
I'd say learn python or html + css + javascript
💀
just learn like basic html so you can do js
mluví tady někdo česky?
lol
which one
i just look at a video on how to program python, and i dont understand anything from it, literally 0, idk why, idk how he does this, im just confused
I would say C++ is a lot harder than java. lol
But for just I/O can't say.
on a basic level 2hex
Does anyone here speak Czech?
idk how the fook do i use it
me neither, not in union with forge
it doesnt understand references to string/objects or forge
nvm, im just gonna do my server without that bot
ty for trying to help
take care yall
bye
Interesting. Though using daemon threads on an Executor doesn't look very useful. As it would bring the insecure "Spigot behavior" to vanilla java.
And on Spigot itself executors are handled as daemon already anyway.
yes
a lot of stuff is
because practice differs from theory
but as the stackoverflow thing said (I just read through it lightly) (for beginners mostly) you do wanna avoid it
because it is another layer of complexity, especially when debugging and testing
but yeah blood eko in case of bukkit
Yeah, it should rather avoided when not really needed. Simplicity wins most times.
think about it,
all plugins are gonna disabled
and the craftbukkitscheduler + simplepluginmanager ensures it
so shutting it down and awaiting termination could be seen as a superfluous layer of termination
having it daemon is just for convenience id say (in this case)
ya
Well it depends. When doing file appendings it would be crucial for them to be awaited.
tho insistingly, one should not as in is strongly discouraged, use bukkit scheduler with IO related stuff
as IO is arbitrary and resource intensive
Whether other plugins would be still available at the moment of shutdown might be another aspect. Indeed.
for most IO stuff you wanna ensure a safe model regardless of how the IO tasks are dispatched into whatever executor you may use, (which I did hint at a lil bit earlier)
Hey Zorro, do you know if IO even works off-main thread? Im unsure if it was that only the main thread can change the world, or only the main thread that can write stuff to files in general
Yeah. That's why for I/O an Executor would be used. Not the bukkit scheduler. Hence my research.
yeah
for now FJP is the way to go almost
or cached thread pool with a semaphore
but in j20 or so you will want to use the user threads
That would be then performance aspects whether to use a semaphore, what kind of thread pool, etc.
For me it was mostly here to prevent liveness failures.
no like you almost always want to restrict IO bound tasks
sounds like ur better off writing an api plugin of sorts. what r u tryina do anyways
either through some semaphore impl or fixed thread pool
this is why its extremely dangerous to use the bukkit scheduler with IO bound tasks
especially if you are gonna scale horizontally
but yeah additionally
for most given IO tasks they do have a beginning and end shorter than the runtime
well an api is basically just a plugin that has some public methods and classes u can use
thus structured cpncurrency is gonna be ❤️
which in turn means you can use that class in another pluign if you set the api as dependency
keep in mind i have no idea what ur trying to do. I told you what i think is the best solution for this is based on what u said
ah
yea api it is
write the database stuff in ur api pllugin and make it either a dependency or an inclusion
i recommend dependency cuz some services impose file size limits of 5 and 8 mb
oh also
the actual benefit of dependency is that you do NOT need to rebuild all your plugins if u find a bug
just the api with the bug
Yeah true. Without knowing the configuration of a pool it would be risky to use for I/O bound tasks.

this doesnt work aa
maybe just do this, keep track of how many parenthesis have been opened
then just make an 'inner' statement between the last and the closing parenthesis
u also could do regex or smth similar
so that u edit the string as u solve it
Yeah true. There are a lot of things to consider for a "good" configuration.
how do the seamless lines in scoreboards work?
and the biggest problem is that latency can be dynamic
thus we must also dynamically manage throughput
any chance you know which one it is?
so it is a complex problem all on of its own
look up dos lines
*dos line characters
Yes. It even differs from drive to drive, workload, etc.
Haven't yet had the time to completely read it. Do you think it will become good?
well, lets say managing error handling with the current executor api can be disastrous
I've seen something about an rough idea to group concurrent tasks together.
yeah, its gonna be awesome since most concurrent tasks usually can be represented in a tree-fashion manner
I have seen an example of it with using the try/autoclose syntax for it.
Though can't say yet how it would turn out in practice.
And there are even more other changes I haven't seen yet.
In general I like the idea of making concurrency easier. Though not sure to which degree it is actually possible. lol
yeah, I mean since java 9 we got the explicit memory order effect api (varhandle)
a lot of things gives us power to do things more efficiently and robustly
but it probably has some set of cons
varwhat now
VarHandle (x
Oh well. Yeah I haven't read yet about VarHandles too.
i somehow feel like all java9+ stuff is qol u can ignore
Basically AtomicReference but one implementation layer lower
Yeah
Seems like something I should catch up upon.
But yeah, I have a bit the same feeling as Moterius.
Its mostly for apps that are scaling stuff to the moon
Mostly just puttin volatile (or synchronized) works
Though are also some pretty nice featues in the newer java versions. (beside concurrency)
Yeah def
is there a way of updating a objective's name without recreating the entire scoreboard?
Records and sealed being two big hits
Even if VarHandle is a lower-level features it might make it's way then up into our APIs.
Are Records already implemented?
lol
up to date af
I hope not
He is talking more about record pattern matching
Oh well. Java 14/16... lol
Yeah I meant the "data classes" they seem to come with java 19 then?
Did records actually improve memory usage? If we think about record-arrays?
Hmmm
Not sure
Good question
hashCode, equals and toString are generated using invokedynamic
iirc
Which is like fast :3
So that the object-header would be saved only once, instead of per instance.
Which could make a huge difference. Especially if we think of blocks in Minecraft.
Same memory usage with records?
Well
Id argue that immutability sometimes increase reusability
But it depends on design and stuff
Any good tutorial about implementing in maven multiple spigot dependencies to use for NMS ?
Yeah. Not sure if the JVM can handle them like primitives, to spare memory.
Or whether it was a pure "design" update.
valhalla wen
🙏
code wise
i cant do shit with records
they can only be 'mutated' by creating a new one and changing the one thign you have to change
Code wise?
And "value types" from Valhalla are a different thing than records again, right?
... some things have been renamed a few times in the experimental phase. lol
i have a weird problemo yall
if ("withdraw".equals(args[0])) {
integerList.add(1);
integerList.add(5);
integerList.add(10);
integerList.add(20);
integerList.add(50);
if (!args[2].isEmpty()) {
Integer closest = findClosest(integerList, Integer.parseInt(args[2]));
if (closest != null) {
integerList.add(0, closest);
}
}
for (Integer integer : integerList) {
System.out.println(integer.toString() + autoCompletes);
autoCompletes.add(integer.toString());
}
return autoCompletes;
}
this is my code
on the sysout 50[5, 1, 5, 10, 20] gets printed
but in game i see
incorrectly
5 should be on top
why does PlayerInteractEvent trigger twice when i right click?
It fires for both hands
kacper, suggestions are sorted by best match, then alphabetically
You can't change that
does anyone know how to obfuscate forge mods
jfc
im trying to use proguard, but its not really working
sadly not rly "best"
when i type 2 it gives me 20 lol
What even is that
well kacper
Jesus fucking Christ
Just stop
Stop obfuscating. Holy shit
You don't have to obfuscate everything
you cloud make own list
what i told you about obfuscate
No, because that's how the client orders suggestions
you want your resources banned?
Im not uploading it anywhere
And yes, it is best match, because you put a 2 in your arg
20 is the best match for 2
then dont
God
then why obfuscate in the first place lmao
sorry for the ping but do you have any idea how to know from what hand the event came from?
SO YOU'RE NOT PUBLISHING IT, BUT YOU'RE OBFUSCATING IT FOR WHAT REASON!?!?!?!
he is an "java dev"
holy fuck
I'm so fucking fed up with people wanting to obfuscate shit for no fucking reason
lmao
Choco please dont ban me.
wait can i umm add suggestions later perhaps?
Your shit is not that important
PlayerInteractEvent#getHand()
My bad, people bought it for 300$
2Hex your shit is dogshit
Choco's right
sure sure
lol
if you can code something that advanced
So it is worth something
💀 obfuscation
Nah, it's sold for 50$ each
it totalled to 300$
2Hex you are not part of spigot
tyty
isnt money burning illegal in US tho?
Choco i suggest to ban that person
i would consider that as one
he is from MCM...
MCM?
he should ask it on MCM instead
I don't use it
sure
is your mod rly that big?
It isn't big
27 days of exprience
then obfuscation makes -1 sense
sure
Btw. when you have no 3 arguments, you get a an IndexOutOfBoundsException there.
it matters for android apps that are maybe 200 megs
i like people who lie to be someone who they are not
to save some
nah im just realistic
I'm grabbing the popcorn, hold on a sec
he wanted to use ProGuard
There you go.
ill reverse is plugin and do an opensource on it
check again
🤣
yep you generally can do it
kacper is just a nice person
do you have black friends?
he can be friends with anyone
he said hes not
xd
Lmao
my resources arent public
The guy working in the project with me wanted to obfuscate it, that's all
those on spigot where removed by choco
you surely know how to make a clown of yourself
due obfuscation..
What?
2Hex i honestly understand why you want to do it
popcorn tastes good
then why are you crying your eyeballs out if you obfuscate projects as well
well i either create backdoors and infect them with botnet malware
I never obfuscated anything, I'm doing this for the first times since my friend told me to
in case some smart ass thinks he can use my resources
well i dont reccomend ProGuard
maybe try ZS
i personally once used bozo, just because for the funs and i wanted to see how good it was. it was suprisingly good
Bozar?
nah its not about security
ye
well i only use it for normal java applications and only when 100% needed
which is
never
Didn't work for forge, I would need to add it as a library and I have no clue how to
👽
i dont use obfuscation cuz i dont want to insult people
Hello, can someone help me with this bug?
I have "save-user-cache-on-stop-only" set to true, and the plugins have not been touched
Why though
If you leave and enter the server, the items go away
Honestly, I like certain people on this channel just come to embarass themselves then proceed to not help at all
prob for the minimal performance boost
well you are the one
who embarass him self
the whole day
asking the same question
that's perfectly fine
perhaps
since this channel is indeed to ask questions, not to do whatever you're doing
usually it degrades it
when you get to stuff like string encryption
imagine encrypting and putting key in the same place
not those questions
questions about development dummy
It is about development
And I'm doubting how much you know about this channel, considering you only sent 3.1k messages lol
Thanks but that's for when I discover on how to actually obfuscate jars with dependencies
Simple
u cant really
U dont
with dependecies
You do, I've seen it a lot
bruh what kind of dev using dependecies
reinvent the wheel
only if they are shaded into the jar
it would be possible
It is possible though as far as I've seen
well everything that works with forge
should stay natural
u can just not break your head
drop some trash code into it
alot
Refactor classes names
Well proguard works on spigot and Shit, so u Just have to configure IT right
i would suggest you just change method names
so It should work
I would prefer a machine doing it for me
machine wont do it better
Absolute Chad
how to get the 1.8.8-R3 ??
i did actually code some plugins manually and throwed alot of shit into it
?1.8
Too old! (Click the link to get the exact time)
i use 1.8
And its right that He send that
No
but no support for it
1.8 should die in peace
I dont wanna have people asking for 20 more years
Aight so I take it that none of you know how to obfuscate forge mods (or don't want to explain)
I prefer the second
i dont know man you keep asking the same
but like honestly
spigot is not the right place to ask it
if u want u can do it manually
this server is always the right place to ask in
Or Just configure proguard right
its not
you want Choco to tell you it
if software is able to read it
human will be able
easily to read it
and reversing it backwards wont be an easy
its java
u dont like
dont use
Limited instructionset -> Bad obfuscation
Simplified AS shit
But
The Point still stands
No
It's quite funny actually
so what should be obsf
It's a helper mod that edits another mod, to make it better
i dont think you should obsf it
Something redicolusly overpriced
better be opensource
Though it doesnt depend on it
Are you mad
I will Sure hope
i dont know man honestly i dont believe what he says
ofcourse he want to obsf after stealing someone else resource
he dont want other to do same to his
They both are brainded, i see
not gonna help this person
Is the original Mod opensource?
Yeah?
Flexing with 300$ lol
Just in case, where are you from
Germany
Hmm ig
So 299,54€
would've straight up not believed you if you said you were from an english country
what a thief
Lol
too bad
It actually isnt me who gets the sales
It's my friend
?
and he gets 20% off it
k k enough enough man this is plugin development
he's also a tester
They will Love him lol
@worldly ingot
Answer me @grim ice
unless choco is extremely biased
he wont do anything about it
and it seems to be the case judging from his overreaction about obfuscation
Are U ignoring me because u are blind or because u dont wanna admit the Mod Is opensource
No, I'm ignoring you because im infact talking about another topic
and your english is 40% incomprehensible
Surely you do, since you've been pinging me for quite a bit now even though I supposedly "ignored you"
obfuscation is pointless. It has never stopped anything. Not sure why people keep thinking this
Look at Forge, before the official mappings existed
In the community I'm involved in, it does stop things, rarely
Prime example
its never stopped anything
It did, trust me, just on certain communities
point me to a source where it states that obfuscation in java has actually stopped anything
because so far it has never stopped me from reading the code, and has never stopped me from magically understanding bytecode
Surely I won't find a huge project that was never touched because it was obfuscated, but as I said, this mod is nowhere close to any significant size
don't care about the size
I have yet to come across any obfuscator that has made me stop understanding bytecode
For the purpose, it will stop at least a few people from trying
The instruction Set Is Just to small for it
Aha, keyword "you" not "them"
To Not make people Inderstand it
I am not the only person in the world that can do this
Yes
Never denied that
that's exactly why I've been using "this community"
while you're using "the world"
even in this community there is plenty of others who can understand bytecode just as well as I can
Bruh, you Just have to fucking learn Java Byte Code which is Not hard
Not this community ahaha
I have even helped plenty of people understand it as well
you don't know the community im talking about
Documentation exists for a reason
german detected
Just stop talking at this point
don't need to, obfuscation simply doesn't work for java because java was never built for such things in mind
and it never will be
you are just wasting time on it
Well if you say so
but if that is how you like to spend your time then go for it
Honestly I was about to give up soon
obviously your time isn't worth that much it seems
Autocorrection is still on German, wrongly correcting my words. Shit.
As for the person complaining about people who buy mods or plugins
I sell plugins myself, just not to the public
He's just plain salty lmao
And yes it is worth it in most cases to pay someone to make something
then it is to grab something that is free
free does not mean it is better
how much something is worth is dependent on the person buying it
I have sold plugins well more or less my service and have made easily $1k-$2k off a single plugin
but such plugins are not like one day projects either
Can also be broken lol
give me the part where i said its not
please stop speaking
Bruh why should I, just telling a fact
I can't believe im actually about to block someone in a social media platform in this day and age lmao
I have two ways I charge. How large of a project it is, that is if its going take multiple days to create and then I break it down to how many hours in that time frame
also it matters on the person or group I am dealing with
Go ahead
the larger the organization, the higher I can bid at
OH I just remembered
frostalf I've been meaning to ask you this
ElgarL told me earlier that replacing the first 2 or 3 bytes of a file
will stop certain tools from seeing its code, as its BOM is corrupted
something like that
don't think code is the correct word to use here
generally the first nth bytes of any given file describes what kind of file it is. Removing those can break some tools, however there are some tools that don't care about the first nth bytes and determine the file type by its content. So he isn't exactly wrong but not completely correct either.
it is more difficult to know what kind of file something is, without the headers or first few bytes being there unless you already know the file type
this is how some archives work in games
like mpq for instance
mpq's give up nothing in regards to how they are constructed and you just simply have to know its structure.
I'm making an elytra minigame plugin, heres my listeners https://paste.md-5.net/amevecitov.java
but the enterPortal
nor onWalk work, no idea why.
however while mpq's are like that, it doesn't prevent trial and error and tampering with to reveal some of its data etc 😛
and yes, i did register it as the onJoin event DOES work
Once you are finished, I wanna try to deobfuscate your mod lol
you don't need to deobfuscate
I don't need, but I want to lol
Sorry that I dont meet your childish expectations but I'm not on a competition here
almost all the obfuscators work on the principle to make it hard to visibly read it
it wont be hard to read
only 2 digit iq like 2hex
that C+V is mod
Ahah
however, instead of trying to read it like you see it in an IDE, you only need to understand bytecode and can read what it does from there
his
the 11th assumption you've made
there is no obfuscator that can change how bytecode is interpreted
brilliant
unless you use a custom JVM that is
its alright spigot citizens have 3 digit
but it is somewhat average
and they dont ask to obsf forge mod in spigot help-dev chat
since 85, is still normal
bro 💀
it's sad that you're actually serious
I've wondered how childish you can be like 3 times but god is sending me answers
How old are u
Definitely older than your mental age
Choco ban him already
none is using the channel as of now
best to re-ask it since it is now like way up the queue of old chats
Nah, you already answered it haha
your plugin whether it is an api, has to be specifically designed for bungeecord
just because it is on bungeecord doesn't mean that plugins on the mc servers can automatically use it from there either
even if you included it as a dependency
unless you shaded it in
dependency needs to be in the same place said plugin is going to run, whether it is on bungeecord or spigot mc server. Unless your API provides end points for plugins to communicate with it
Is there any api
how to track amount of ram used per each plugin
or plugin which does that
you would need a wrapper similar to like warmroast or whatever that need one is now
then you would need this api plugin on every server where a plugin will use it
Ayo is this the right way to do this?
public BaseComponent[] createClickableLink(String clickableLinkText, String URL, String hoverDescription) {
BaseComponent[] front = TextComponent.fromLegacyText("§f§kX §r");
TextComponent link = new TextComponent(clickableLinkText);
link.setItalic(true);
link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, URL));
link.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§3☀ §f" + hoverDescription + " §r§3☀")));
BaseComponent[] endText = TextComponent.fromLegacyText(" §f§kX");
front[0].addExtra(link);
front[0].addExtra(endText[0]);
return front;
}```
yes because that is how plugins work
I mean, I like to use the ComponentBuilder.
this is doable
you are just thinking about it wrong is all
plugins can access whatever tables you want them too because MySQL is independent of everything
you can make your API accept arbitrary queries if you want it to
if all you want your API to do is be the proxy between the MySQL server and the plugins, that is what you would do
your API would just hold the connection and allow queries through it
So, would it look like this then?
public BaseComponent[] createClickableLink(String clickableLinkText, String URL, String hoverDescription) {
return new ComponentBuilder("X").color(ChatColor.WHITE).obfuscated(true)
.append("").reset()
.append(clickableLinkText).italic(true).event(new ClickEvent(ClickEvent.Action.OPEN_URL, URL))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§3☀ §f" + hoverDescription + " §r§3☀")))
.append(" X").color(ChatColor.WHITE).obfuscated(true).create();
}```
alternatively you could make use of redis
and this might solve your issue
why store the names?
you can access column names from resultsets already
you don't need to store them to do so
ItemStack i1 = new ItemStack(Material.DIAMOND);
i1.setAmount(16);
Hello everyone. How do I get the data above from another class without writing them there again? I know that somehow it is possible through getters, but I don't know 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.
if it doesn't exist nothing is returned
Just do className.i1...
(className being the name of the class i1 is defined in)
Avoid legacy text entirely if you're using components
you may not be able to
What
due to type erasure
Well pass a Class<T>
there is no way to instantiate generics directly
yeah they are basically fake
you can use supplier that has been around since java 8
class SomeContainer<E> {
private Supplier<E> supplier;
SomeContainer(Supplier<E> supplier) {
this.supplier = supplier;
}
E createContents() {
return supplier.get();
}
}
resulting code to use would be this
SomeContainer<String> stringContainer = new SomeContainer<>(String::new);
here is another way of doing it
public class Test {
public static void main(String[] args) throws IllegalAccessException,
InstantiationException {
Generic<Bar> x = new Generic<>(Bar.class);
Bar y = x.buildOne();
}
}
public class Generic<T> {
private Class<T> clazz;
public Generic(Class<T> clazz) {
this.clazz = clazz;
}
public T buildOne() throws InstantiationException, IllegalAccessException {
return clazz.newInstance();
}
}
public class Bar {
public Bar() {
System.out.println("Constructing");
}
}
can i get itemstack used in ExpBottleEvent?
Is using function like this is good practice? I found this somewhere but I wonder if I should use it. public Object getFieldValue(String field, UUID uuid) { try { PreparedStatement preparedStatement = connection.prepareStatement("SELECT " + field + " FROM players_data WHERE uuid = ?"); preparedStatement.setString(1, uuid.toString()); ResultSet resultSet = preparedStatement.executeQuery(); if (resultSet.next()) return resultSet.getObject(field); } catch (SQLException exception) { exception.printStackTrace(); } return "?"; }
here is a factory pattern for such things
interface Factory<T> {
T factory();
}
class Araba {
//static inner class for Factory<T> implementation
public static class ArabaFactory implements Factory<Araba> {
public Araba factory() {
return new Araba();
}
}
public String toString() { return "Abubeee"; }
}
class Generic<T> {
private T var;
Generic(Factory<T> fact) {
System.out.println("Constructor with Factory<T> parameter");
var = fact.factory();
}
Generic(T var) {
System.out.println("Constructor with T parameter");
this.var = var;
}
T get() { return var; }
}
public class Main {
public static void main(String[] string) {
Generic<Araba> gen = new Generic<Araba>(new Araba.ArabaFactory());
System.out.print(gen.get());
}
}
this last way is actually more flexible then the previous two
because you don't have to worry about the reflection exceptions
bump
you gave limited information
idk what else i need to givee
what are you trying to accomplish?
we have no idea why those events are important for you, or how you are attempting to use them. It could be just that you are using incorrect events for what you are trying to accomplish
a checkpoint system where if you go in end portal and you are in a course it gives you level, and if you touch any block you fail and restart
as an elytra course
since you said the portal event isn't working
might instead want to try using this instead
declaration: package: org.bukkit.event.player, class: PlayerTeleportEvent
nor movement event
it doesnt even teleport without the plugin
so idk
portalevent will only work if an exit portal will be generated
im using myworlds btw
don't know what that is
anyways, the other thing you could probably do is just see if they are touching a portal frame
probably easier to build and cache a bounding box around the portals
then you can detect from the moveevent if they touched one
then you can do the teleporting yourself
any ideas? ProjectileLaunchEvent can also do
you want the itemstack of the expbottle? or something else?
i have a special experience bottle thats supossed to have PDC in it with some info
i want to get that info on throw
ExpBottleEvent is called when the entity hits the ground, not when released from the hand. There is no associated item stack
declaration: package: org.bukkit.entity, interface: ThrowableProjectile
That's the display item, not the actual item used when thrown
declaration: package: org.bukkit.entity, interface: ThrownExpBottle
You'll have to make use of a Map to keep track of which exp bottle was spawned to the item that was used in a ProjectileLaunchEvent afaik
is event.getEntity().getShooter() item in main hand still available on ProjectileHitEvent ?
or throw*
im assuming no
yeah
but the movement event doesnt work
Don't think so. It's past that point afaik
are you sure the event isn't working, and not just your code being executed?
code not being executed
idk why or where tried debugging its not even getting past the block check
then look at your condition then
see why it isn't being placed in the list you are expecting
i have i dont know whats wrong with it
you probably haven't
are you sure the instance you are grabbing is the same one that you are putting information into?
however regardless you haven't shown the relevant code though for your problem, only showed code for your listener, and not all of your listener which isn't the issue anyways it seems
debug your collection
when you put something in there, output a debug message
then output what the collection is holding
and then do this from your listener class
see if it matches up
Well you're using &m
Which adds a line over all characters
including spaces
i always like wonder
if its possible to make a machine, that scans ur surroundings and show u where a football is gonna end up
over ur eyes
lmao
or if theres a suit that can somehow know what ur thinking about and if ur wanting to see smth behind u, then it shows u a screen of whaats behind
so u technically have 360 degrees vision
im stupid thanks
can i force XP orbs not to merge?
I just realized how annoying the spigot built-in component stuff is
adventure doing that way better imo
In the spigot.yml iirc
merge-radius:
exp: distanceToMerge
i wanna only do it for specific orb
maybe a different question, will unique orbs (for example with different PDC) still merge?
Try it and see kinda thing
Then when your specific orb spawns, look for nearby orbs and if it's mergeable, remove the one that spawn and change the value of the other one
How can i block a player from moving but with out blocking the head rotation to?
Listen to the move event and cancel it if the x,y or z has changed
does setCancelled work on the BlockPlaceEvent?
as in so it actually doesnt place the block
ok then im defo doing smth wrong bc it isnt working ofrm e
(it places the block)
thing is it places the block and then cancelles any event after that
Don't compare Strings with ==
Use .equals()
.equals
yes i know im just tired af rn
or in my case a even better idea would be to put the item names that i want to ignore in a table and do a for loop that just loops through it
¯_(ツ)_/¯
Can you give me an code example because i don' t know how to do it
Making an elytra minigame plugin and this code detects when they touch blocks so override blocks they CAN step on and finish blocks, for some reason at the finish it resets them and doesnt remove the player from the inCourse hashmap, no idea why
@EventHandler
public void onWalk(PlayerMoveEvent e) {
Bukkit.getLogger().severe("debugging, event calls");
Bukkit.getLogger().severe(a.inCourse.toString());
if (a.inCourse.containsKey(e.getPlayer())) {
Bukkit.getLogger().severe("debugging, passes check");
String s = a.inCourse.get(e.getPlayer());
Block block = e.getPlayer().getLocation().subtract(0, 1, 0).getBlock();
Bukkit.getLogger().warning(block.getType().toString());
if (block.getType() == Material.BEDROCK) return;
if (block.getType() == Material.GREEN_CONCRETE_POWDER) {
Player p = e.getPlayer();
Bukkit.getLogger().severe("debugging, passes check");
e.setCancelled(true);
String course = a.inCourse.get(p);
Location w = Bukkit.getWorld("world").getSpawnLocation();
p.teleport(w);
p.sendMessage(ChatColor.GREEN + "You completed this course!");
Boolean aD = (Boolean) a.getData().getConfigurationSection("cd." + p.getUniqueId()).get(course);
if (aD == null) {
p.sendMessage(ChatColor.GREEN + "You leveled up!");
int currentLevel = a.getData().getInt(p.getUniqueId() + ".level");
a.getData().set(p.getUniqueId() + ".level", currentLevel + 1);
}
a.getData().getConfigurationSection("cd." + p.getUniqueId()).set(course, true);
a.inCourse.remove(p);
p.getInventory().remove(Material.ELYTRA);
p.getInventory().remove(Material.FIREWORK_ROCKET);
return;
}
if (!(block.getType() == Material.AIR)) {
e.getPlayer().sendMessage(ChatColor.RED + "You failed!");
e.getPlayer().teleport(a.getData().getLocation("course." + s));
}
}
}```
info at top ^-^
what
no.. thats not that long ago
you can't instanciate a generic
thats not how they work
I mean you could but I feel like you are kinda just abusing them at that point then
also don't understand why you'd even need to do a generic like this for a resource query
It works, thanks
how can i check what entity just spawned
i have my events set up i just need to figure out what to put after the == in my if statement
still does not really help because I do not know how to compare it
like idk if i do Entity. or what
Entity. does not give me anything
Hey, is there any good tutorial for auto building bukkit/spigot plugins in jenkins from GitHub? I have found one on bukkit forums but it is too old
alright thank you!
bumps
will do
im sorry wdym by entityclass
ohhh
just type zombie
alright
yeah
alright i just wanted to make zombies have top hats just purely to mess with my friends
what mobs have helmet slots?
is it just like humanoids or can others too
thats a shame
can i use pig saddles slots for stuff or no
wait
nvm
i just figured villagers
do you know of any way to detect when a player clicks on an item slot with shift click
alright
How to generate with BuildTools spigot 1.8.1 and 1.8.2?
Probably by not using those versions
Please, don't simp
I don’t think BT existed when 1.8.1 or 1.8.2 were latest
Afaik the oldest version BT can build is 1.8.8 I think
It can, I have now runned it to build 1.8, 1.8.3 and 1.8.8
I want to summon a mob and store values about it such as speed and maxSpeed, whats the best way to do this and store this value? The mobs will be despawned after the server shuts down
hashmap
I have 7 different values though
ok ty! imma go look into it on some random forum
create an object class and store the oject in the hashmap
Oh, probably those versions didn’t have any server changes
net.minecraft.server.v1_8_R1
I need to call this, that's why
net.minecraft.server.v1_8_R2
and this
mmm, Didn't think about that, I will try and tell you, thanks mate
What color is your bugatti?
and what color is your hair?
Is there any way to hide the score on a scoreboard? (the red number on the side)
ok ty
public static <T extends OtherClass> T yourMethod(Class<T> subClass) {
return subClass.newInstance();
}
if i understood it right
Any good place to pretty much learn Java again? I can do most things in spigot but I struggle when ever it comes to java project, hell I didn’t even know what the new keyboard was up until 5 minutes ago
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.
Ty
@raw sky ( saving for when I get home so I can search by mentions )
check my bio
heyyy guys so when i teleport player to a world it only teleports them if they have operator perms, i have no other world management plugins and i dont know wtf is going on
Can you tell us a little more about what plugins you are using for teleporting, and world manager plugins you have?
Personally multiverse is my go-to and it works wonderfully
i have no world manager plugins
Well that’s weird I’ve never had that happen, are you teleporting them to one of the default 3 worlds (world nether end) or a custom one?
custom
i load it on enable tohugh
tho
How are you teleporting the player rn? Is it just in your own plugin
yeah minejava Location locUn = a.getData().getLocation("courses." + args[1]); Location loc = new Location(a.courses, locUn.getX(), locUn.getY(), locUn.getX()); player.teleport(loc);
and a is the main plugin
courses is the world
Can you try and do it a tick later? I’ve had a issue with teleporting and I made it run a tick later and it worked well
When do you run that code? Looks all correct to me
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (args.length == 0) return true;
switch (args[0]) {
case "start":
if (a.getData().contains("courses." + args[1])) {
Location locUn = a.getData().getLocation("courses." + args[1]);
Location loc = new Location(a.courses, locUn.getX(), locUn.getY(), locUn.getX());
player.teleport(loc);
player.getInventory().setChestplate(a.elytra);
player.getInventory().setItemInOffHand(a.rockets);
player.sendMessage(Artifact.construct("&aStarted course &f" + a.getData().get("courses." + args[1])));
a.inCourse.put(player, args[1]);
}
player.sendMessage(Artifact.construct("&cThat's not a course"));
break;
case "create":
if (player.hasPermission("course.create")) {
a.getData().set("courses." + args[1], player.getLocation());
player.sendMessage(ChatColor.GREEN + "Created new course " + args[1]);
}
}
}
return false;
}```
it teleports though
just not to the world
so if i am in the courses world
is teleports to that cords
but not if im in "world"
So the issue is when you teleport to the other world, not the actual cords? Is there anything in logs
I will be on my computer soon so I can actually help a little more
not at all
nothin in logs
but yes that is the issue
looking online and it says something along the lines of a world loader, I havent used this in the past but that might be the issue
any event for pickup that isnt depricated
EntityPickupItemEvent
If your plugin is running on the proxy, only proxy plugins can use it. You can only use proxy API. Not Bukkit API
Same goes for server plugins using Bukkit API
is running Thread.Sleep inside of a runnable viable?
I saw something about it on the forums
how can i modify a seeds age
Sure but you should probably avoid it at all costs
Inside of runnable doesn't change anything
if it's async, sure
oh awesome
yeah nah
it's not in the same jvm
i mean
you could cache player data on the proxy and use something like redis or channel messaging to send it to the instances
but a db query really isn't that taxing as long as you're doing them efficiently
How would I go about asking if a player can break blocks at a given location?
For example, to allow a player to do a skill, i need to know if they can break blocks in that area.
For instance, there are WG flags, or a claim, and i need to be able to check that. How would i go about doing that?
I Tried:
BlockCanBuildEvent can = new BlockCanBuildEvent(e.getBlock(), p, e.getBlock().getBlockData(), true);
Bukkit.getServer().getPluginManager().callEvent(can);
if (!can.isBuildable()) {
return;
}
But it does not seem to be working
Any ideas?
Im stumped
call a fake BlockBreakEvent
if its cancelled, then you cant break
Mmm thats not going to work because theu might not actually be breaking a block
How would that event system be like? I presume like the BlockCanBuildEvent
Or is it something different
Lemme try it and ill let you know!
The item is WHEAT_SEEDS, the block seeds is WHEAT
What im trying is not really working
show your code
Sure one sec
J.s(() -> {
if (p.breakBlock(p.getLocation().getBlock())) {
p.sendMessage("You cannot");
} else {
p.sendMessage("You can");
}
});
returns true when in an area i cant break anything.
BlockBreakEvent e = new BlockBreakEvent(p.getLocation().getBlock().getBlock(), p);
if (e.isCancelled()) {
p.sendMessage("You cannot adapt right now.");
return false;
} else {
p.sendMessage("You can adapt right now.");
}
in an area where i cant also returns true
The J.s
is a Bukkit Sync Runnable
Ignore the shorthand
Oh wait
DO i need to Bukkit.getPluginManager().callEvent(event);
yes
Mmm im exhausted and just realized that ok lemme give that a try
lmao
Yep that worked, god im tired, thanks for dealing with me
nws lol
How do I break out of a repeating task?
Asking nicely
Got it
You have a few ways. How are you invoking your task?
oop
() -> {}?
yup
You can pass a task -> argument and call task.cancel()
😦
o/
Ive come back, if I put code after the Runnable will it get run once its complete or will I have to handle that in the runnable?
Awh, thanks again
I'm trying to embed a web server via the HttpServer class in a plugin and when I call my /test endpoint, call an event from the HttpHandler class handle method. when I call the endpoint without the event call, it works fine and delivers a response. when I add the event call, the response is empty. Has anyone worked with something like this before?
public void handle(HttpExchange t) throws IOException {
logRequest(t);
MyEvent event = new MyEvent();
Bukkit.getPluginManager().callEvent(event);
String response = "{}";
t.sendResponseHeaders(200, response.length());
OutputStream os = t.getResponseBody();
os.write(response.getBytes());
os.close();
}
Well with this code the response will always be "{}" for obvious reasons.
Can i set blocks on a different thread? (I'm on phone so cant test atm)
No. You cant do anything with the spigot api from another thread.
I c
trying to make a serialize-deserialize for my object, am I doing it correctly? a line is showing unchecked cast, but I'm pretty sure I checked everything, is it just an ide error?
@NotNull
@Override
public Map<String, Object> serialize() {
return Map.of(
"statistics", statistics,
"runeTier", runeTier,
"headItem", headItem
);
}
public static Rune deserialize(Map<String, Object> map) {
Object objectifiedStatistics = map.get("statistics");
if (!(objectifiedStatistics instanceof List<?> statisticsList)) return null;
if (statisticsList.stream().anyMatch(o -> !(o instanceof RuneStatistic))) return null;
List<RuneStatistic> statistics = (List<RuneStatistic>) statisticsList; // Unchecked cast
return Rune.builder()
.statistics(statistics)
.runeTier((int) map.get("runeTier"))
.headItem((ItemStack) map.get("headItem"))
.build();
}
Are the objects in your List also serializable?
yeah
You would have to check for instance of List<RuneStatistic> in order to make this cast checked.
Which makes the stream useless btw
oh, i could do directly that?
alright
thx
by the way, do i need to make enums configurationserializable?
I didnt use the spigot serialisation system for quite some time because there are much better alternatives
but i would assume that enums are serializable on default. But ill check the implementation.
Nope looks like there is no default serializer for enums
well, i have this enum:
public enum Bonus {
DAMAGE(double.class, 0.2, 1.5),
EXP(int.class, 1, 2),
...
@Getter private final Class<?> type;
@Getter private final Number min;
@Getter private final Number max;
Bonus(Class<?> type, Number min, Number max) {
this.type = type;
this.min = min;
this.max = max;
}
}
i don't see how it would be serialized, shouldn't i just put a name and then fetch it with valueOf?
public static RuneStatistic deserialize(Map<String, Object> map) {
return new RuneStatistic(
Bonus.valueOf((String) map.get("bonus")),
(Number) map.get("boost")
);
}
You should add tighter constraints to your class field Class<? extends Number>
i probably should yeah
is this sufficient
Yes thats what i would do
cool, thanks, will try that now
You can also make the enum ConfigurationSerializable
yeah, but isn't that just too much hassle
I mean it saves you the String conversion every time you need to serialize it anywhere.
i guess so, if i will need to serialize it somewhere else, i'll make it configurationserializable
thanks for your help 😄
have you ever used MorePersistentDataTypes by @tender shard ? (https://github.com/JEFF-Media-GbR/MorePersistentDataTypes) i'm trying to figure out how to create my own datatype from a configurationserializable object, but so far i'm really confused
Nope i implemented my own data types
oh, that could also work
i'm just trying to make it so i can use it with PDC
so, should Rune implement PersistentDataType?
PersistentDataType is an external serializer
It converts from Object to primitive and back
*primitive including String
So its completely disjunct from ConfigurationSerializable
i'll try to follow along but i may ask for tips
i understand, i was just trying to use it with morePDT before, now i guess i'll do it by hand
why so?
What?
PDT seems more in-place
Do you want to store the objects inside of a PersistentDataHolder? (Player, Entity, Chunk, World etc)
yep, Player
Well then pdt is a good approach
@NotNull
@Override
public String[] toPrimitive(@NotNull Rune complex, @NotNull PersistentDataAdapterContext context) {
return new String[0];
}
@NotNull
@Override
public Rune fromPrimitive(@NotNull String[] primitive, @NotNull PersistentDataAdapterContext context) {
return null;
}
this is just serialize-deserialize but with a String, right?
And fiddling with external serialisations would only make sense if you had multiple servers and need shared data
Yes. But String[] doesnt make too much sense.
oh yeah, meant to use String
https://gist.github.com/yannicklamprecht/954034de30a1f4427239f2dc5ccd49c5 is this legal lmao? using PersistentDataContainer as primitive
Yeah looks like you can use them as primitives
I think I figured out how to setup the morePDT solution:
public static PersistentDataType<byte[], Rune> runeType = new ConfigurationSerializableDataType<>(Rune.class);