#help-development
1 messages · Page 662 of 1
But i have match
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
wait
public static void saveDataToDatabase(String tableName, Map<String, Object> data) {
try (Connection connection = MainDataHandler.getConnection()) {
String query = "SELECT * FROM " + tableName + " WHERE uuid = ?";
try (PreparedStatement statement = connection.prepareStatement(query)) {
try (ResultSet resultSet = statement.executeQuery()) {
if (resultSet.next()) {
String updateQuery = generateUpdateQuery(tableName, data);
logger.log(Level.SEVERE, updateQuery);
try (PreparedStatement updateStatement = connection.prepareStatement(updateQuery)) {
setUpdateStatementObjects(updateStatement, data);
updateStatement.executeUpdate();
}
} else {
String insertQuery = generateInsertQuery(tableName, data);
logger.log(Level.SEVERE, insertQuery);
try (PreparedStatement insertStatement = connection.prepareStatement(insertQuery)) {
setInsertStatementObjects(insertStatement, data);
insertStatement.executeUpdate();
}
}
}
}
} catch (SQLException e) {
e.printStackTrace();
}
}```
cant really understand what u mean
Hello. I'm coming back to pluginsmessages because I still don't understand :.
If I send a message plugin from my proxy to the lobyy server which has 2 players (toto and zozo).
In my spigot plugin, in the onpluginmessagereceiver function which has player as parameter, who will player be equal to? A chosen player or random? (I've been told it's not).
Or will the message be sent to each player on the server, so the event will be called 2 times (because there are 2 players)?
what language best to learn to develop
it just does

kotlin >>
idk every industry/enterprise developer I’ve talked to likes Kotlin. this server is just a massive hive mind of haters
Someone started hate and they just continue with it
No one actually tried writing in kt
yeah 
For me its the opposite. Enterprise devs hate kotlin. Its such a hipster language without any standards.
There are 20 ways to achieve the same thing and there is no standardized way of approaching designs.
Its a mess in enterprise.
Wdym without standards?
Can someone please help, it isnt sending anything in the console and i am not getting blindness
boolean attackerPermission = attackerPlayer.hasPermission("vagt");
boolean victimPermission = victimPlayer.hasPermission("vagt");
ItemStack attackerWeapon = attackerPlayer.getItemInHand();
Material weaponType = attackerWeapon.getType();
if (attackerPermission && !victimPermission) {
attackerPlayer.sendMessage("You hit " + victimPlayer.getName());
System.out.println("1");
if (weaponType != Material.STICK) return;
System.out.println("2");
if (attackerPlayer.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("§aSTICK")) {
System.out.println("3");
if (attackerPlayer.getWorld().getName().equalsIgnoreCase("A")) {
System.out.println("4");
victimPlayer.addPotionEffect(PotionEffectType.BLINDNESS.createEffect(100, 1));
}
That means some if is not passing, debug it
Like jcache or JakartaEE. Or even general design patterns.
Nothing is standardized.
Thats what i have tried to but nothing is happening not even if i just hit anyone it dosent send you hit..
“hipster language” developed by the same company that makes your IDE. Though, I will admit that’s not a valid counter.
Yes, there are a lot of ways to achieve things. Same in Java, you can DI, static singleton, or you can factory pattern, a giant fucking switch statement, whatever. It’s up to your company to create valid systems to keep the code consistent
I might be stupid or don't understand what are you trying to say, but how are patterns dependant on language
not to mention, Java is quite quickly adding features that coincide with Kotlin
you can write dumb kotlin just like you can write dumb java
Only thing I know you can do different in kotlin is having actual functions (not tied to object), but that will be implemented in java too
Maybe I'm just not that deep into it
The patterns themselves not, but the implementation of those patterns.
Take extension methods for example. Its such a pattern breaking feature
that i dont see any justification for it being in a jvm language at all.
Only cool thing about Kotlin is its null safety
Well ext methods are just synthetical sugar
I used to hate null, now I love it
You can also argue that statics are breaking whole oop concept
They have implicit compilation details that are practically hidden from the dev.
I wouldnt use them in enterprise projects like i wouldnt use lombok there.
That's true
No, you probably shouldn’t use them in an enterprise project
Once again, the team create a code style to make well designed code
You don’t need to use every feature in Kotlin, just like you don’t need to use every feature in Java
just made this, idk maybe it's useful for someone https://github.com/JEFF-Media-GbR/JsonConfigurationSerialization
im more of a Scala person
Like, for example, in Kotlin you can == on a string (or any object) and it replaces with #equals. That’s a good feature that probably should be used, and yet can be overridden with triple equals. As for operator overloading += on a registry manager, while you can, you probably shouldn’t because it’s bad design.
in Java you can pass a Map<String, Object> as parameters instead of a builder pattern, doesn’t mean you should
And here standards break. If you use an external lib then you wont immediately know if they overloaded anything.
In Java .equals() is an implementation detail and == checks for identity.
you as the developer know if you need to call === or == rofl
You never use == in Java unless you’re checking reference, same with === in Kotlin
it’s just turning a method into an operator, as it should’ve been in Java
There is just too much stuff with implications in kotlin for me. Infix functions. Or overloading invoke operators.
All of those generate quite a bit of code which is not appearent immediately when reading code.
hi, im trying to setup an nio socket communication ! (because i need to communicate without players online and i cant have redis because of vps ) , i did send a message to a other server but when i try to make each other send and receive messages , this doesnt work , it is impossible with sockets ?
Hi, i have the problem, when i'm trying to change lore of mainhand item or event.getCurrentItem() it isn't working in InventoryClickEvent if i'm trying to get the item in cursor
@EventHandler
public void onClick(InventoryClickEvent event) {
if(event.getWhoClicked() instanceof Player){
Player player = (Player) event.getWhoClicked();
ItemStack currentItem = event.getCurrentItem();
int chosedSlot = event.getSlot();
int mainHandSlot = player.getInventory().getHeldItemSlot();
if(!currentItem.getType().isAir() && chosedSlot == mainHandSlot) {
ItemMeta a = currentItem.getItemMeta();
a.setLore(Arrays.asList("ABC", "DEF"));
currentItem.setItemMeta(a);
event.setCurrentItem(currentItem);
System.out.println("READY");
}
}
}
This is example
?jd-s
oh ok i got it sorry
i mean that was really just for me to look at

but if i had to guess, id guess ur point of failure is at chosedSlot == mainHandSlot
that isnt angry enough
I stupidly added this to my plugin😂
https://paste.md-5.net/coworawiwu.java
if mainHandSlot is what i think it is
i like that this method only ever returns false
Condition is triggered
Dont get me wrong, its a very cool language. Just not enterprise ready imo.
Ok i'll try something else, i'll try to use BukkitScheduler.runTask(Plugin, Runnable) in inventory click event but then i have another problem, i couldn't change meta of event.getCursor() and event.getCurrentItem() using arguments
yea but every time a player joins doesn't that use too much processing power? or is it normal to do it like that?
"i cant have redis because of vps" huh wdym? apt install redis-server and done
does anyone know how gson's type adapters work?
you can use redit without the app ?
app?
its not like rabbitmq ?
no clue what rabbitmq is. but installing redis is basically just one apt / yum command
It’s another messaging thingy
i am still confused what's meant with "without the app" and why it should not be possible to install redis on a VPS
isn't the whole point of a VPS that you can install whatever you want
the Serializer interfaces? or TypeAdapter class?
because i dont have vps
i only have minecraft hosting multi server service , i can use redis using only this ?
I got this: https://github.com/JEFF-Media-GbR/JsonConfigurationSerialization/tree/master
Now I also wanna have a public static final TypeAdapter<ConfigurationSerializable> but I have no clue how, it only allows me to use those weird JsonWriters and JsonReaders instead of just giving me a string and/or letting me return a string lol
if you are just using some shared MC hosting you won't be able to use sockets
that way is gross I'd use the JsonSerializer and JsonDeserializer unless you care about speed at all costs
^^
what do you mean by shared
oh also you need to register your type adapter with gson
Gson gson = new GsonBuilder()
.registerTypeAdapter(this, this.getClass());
yeah well others will have to register it
why? how?
use the code i sent earlier
why is it gross because using streams for formatting code is hard to visualize and annoying to format
implement JsonSerializer<ConfigurationSerializable>, JsonDeserializer<ConfigurationSerializable>
you can then work with JsonElements instead of streams which imho is nicer way. If you absolutely need the speed figuring out how to make the Streams nice is annoying as fuck
public class ConfigurationSerializableAdapter implements JsonSerializer<ConfigurationSerializable>, JsonDeserializer<ConfigurationSerializable> {
final Type objectStringMapType = new TypeToken<Map<String, Object>>() {}.getType();
@Override
public ConfigurationSerializable deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException {
final Map<String, Object> map = new LinkedHashMap<>();
for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()) {
final JsonElement value = entry.getValue();
final String name = entry.getKey();
if (value.isJsonObject() && value.getAsJsonObject().has(ConfigurationSerialization.SERIALIZED_TYPE_KEY)) {
map.put(name, this.deserialize(value, value.getClass(), context));
} else {
map.put(name, context.deserialize(value, Object.class));
}
}
return ConfigurationSerialization.deserializeObject(map);
}
@Override
public JsonElement serialize(ConfigurationSerializable src,Type typeOfSrc,JsonSerializationContext context){
final Map<String, Object> map = new LinkedHashMap<>();
map.put(ConfigurationSerialization.SERIALIZED_TYPE_KEY, ConfigurationSerialization.getAlias(src.getClass()));
map.putAll(src.serialize());
return context.serialize(map, objectStringMapType);
}
}
thats what i do
what is a JsonElement? I'd much rather just get a string as input and output
JsonElement is an abstract base for all JsonElements e.g. JsonObject, JsonArray, JsonPrimitive
what's the "Type" parameter supposed to be?
that's just the type you're converting from iirc
is there really no way to just get the input and output as string?
but the type is always COnfigurationSerializable?
why even use GSON then? use a BufferedReader
not really
could be a child class I suppose
mostly just never use it
I need gson to turn the Map<String,Object> into json and vice versa
what the hell is this syntax noooo
final Type objectStringMapType = new TypeToken<Map<String, Object>>() {}.getType();```
my eyes
here I'll show you how to do it quick then its not hard.
JsonObject parent = new JsonObject();
dataMap.forEach((String key, Object value) -> {
parent.addProperty(key, value.toString); // assumes all objects can be easily converted to string otherwise you'll need instanceof checks
});
return parent;
Map<String, Object> stuffs = new HashMap<>();
JsonObject parentObject = element.asJsonObject(); // assumes lead is object which should be consistent unless you use this adapter for something it shouldn't be used for
parentObject.entrySet().forEach((Entry<String, JsonElement> element) -> {
stuffs.put(element.getKey(), element.getValue().getAsString()); // assumes all elements are string you may need some extra filtering
});
@tender shard is this still "bad"?
Why do you manually dismantle JsonObjects?
yeah I don't get any of that
wdym by this
why can't I just get the JsonElement as Map<String,Object>
this is for a JsonDeserializer from json
and how would I even use the Serializer in Gson?
though I suppose you could just loop over the leemnt itself
register it the same as a type adapter
use is exactly the same
SomeObj obj = ...;
String json = gson.toJson(obj);
// Later on
String json = ...;
SomeObj obj = gson.fromJson(json, SomeObj.class);
Thats all you should have to use gson for. If you have to manually
tinker with JsonObjects then you didnt configure your Gson instance properly.
the snippet I provided was for going inside of a TypeAdapter / Deserializer
I'm not talking about manually doing that every time
this feels so stupid, I'd literally have to create a new map with the same contents
if you just want a Map Map<?, ?> map = gson.fromJson(reader, Map.class);
^ I suppose that would work to though I'd say the output is less nice to deal with
ig thinking in that facet you could run a context cal
I mean that's what context is for
alex try adjusting it like this
Map<String, Object> contents = jsonDeserializationContext.deserialize(jsonElement, new TypeToken<String, Object>(){}.getType());
return deserializeFromMap(contents);
you could also use a type token instead of a Map.class and get the exact (String, Object) map
then you have no weird errors and unchecked casting to deal with on your end
private static final Gson gson = new GsonBuilder().registerTypeAdapter(ConfigurationSerializable.class, JsonConfigurationSerialization.ADAPTER).create();
@Subcommand("itemToJson")
public static void itemToJson(Player player) {
ItemStack item = player.getInventory().getItemInMainHand();
String json = JsonConfigurationSerialization.serialize(item); // works fine
String json2 = gson.toJson(item); // Error, DebugCommand line 101
Stacktrace: https://paste.md-5.net/iharozecaq.md
JsonConfigurationSerialization class: https://github.com/JEFF-Media-GbR/JsonConfigurationSerialization/blob/master/src/main/java/com/jeff_media/jsonconfigurationserialization/JsonConfigurationSerialization.java
why does gson want to make any fields accessible in the first place?
Looks like its not using your TypeAdapter
does it not understand that ItemStack is ConfiguratzionSeriazable?
How did you register your adapter?
it's in the codeblock above
are itemstacks gson serializable?
You need to register it as a type hierarchy adapter
ah, but that's still work
not like the yaml one provided by bukkit where you can just put an itemstack and poof it's serialized
thx, that worked. but now the deserialization throws this error:
https://paste.md-5.net/ubufofekep.md
Everything works fine if I just directly use my to/from string methods, only these weird adapters are failing. It now claims that my map is full of json primitives and other stuff instead of the actual types
Uhm.
Try enabling complex map key serialization for your gson instace
(wild guess)
the gson instance used in the serializer lib, or the gson instance used in the test plugin (where I registered my hierarchy type "adapter" which isn't actually a typeadapter)?
oh I think I got it working
What was the problemo
tbh I have no idea. I did another mvn clean package because I noticed the lines in the stacktrace make no sense, but I don't remember having changed anything lol
🤷 dont touch it then
yeah lol. thanks!
but does this really make any sense? I mean my adapter basically only calls the methods I already had
also does it make sense to also extend TypeAdapter? I don't really understand the difference between JsonSerializer/JsonDeserializer and a TypeAdapter, and it also makes little sense to me that GsonBuilder#registerTypeHierarchyAdapter takes in an Object instead of a TypeAdapter and/or JsonSerializer/Deserializer
something is really wrong here
There's subtle differences but type adapter is easy iirc
(de)Serialiser works on the Json stream itself whereas adapter works after parsed
TypeAdapter only gives me JsoNReaders and JsonWriters and I have no clue how to turn those into the underlyin Map<String,Object>
So slower but easier
@tender shard I just made a basic type adapter for ConfigSerializable's
idk if you got yours working
a real TypeAdapter?
that is not a type adapter
do you Need a type adapter
that is a type adapter
I only need a Type Adapter so I know how to call my serializer/deserializer for the javadocs
I mean unless you're serializing and deserializing a ton during run time does it really matter?
it does not extend TypeAdapter
that will work as a type adapter
theres 2 ways
1 is extending TypeAdapter
the other is implementing 2 things
both will work in gson with the type adapter stuff
this is my issue. What am I supposed to say i nthe javadocs what this is, if it's not actually extending TypeAdapter`?
I can't claim it's a type adapter if it isn't extending it
then imho it isn't one
you have 2 options then
call it a type adapter with json de/serializer or figure out json reader/writer
I really hate gson
or call it a ConfigurationSerializableSerializerDeserializer
no you're just being stubborn
I mean its fine if you literally want to use a type adapter, but I whipped the equivalent of one up in like 5 minutes
hm? where?
the code I sent earlier
is quite literally the equivalent of a type adapter that isn't somewhat annoying to write
it works tested it with an item stack
I don't see any code here in this channel which uses a JsonWriter/JsonReader
TypeAdapter is synonymous with JsonSerializer and JsonDeserializer they are basically the same thing just using different tools to achieve the end goal
also didn't realize you had to serialize ItemMeta to when working with ItemStacks lol
I thought the ItemStack serializer would just do that
I won't call something TypeAdapter if this does not work
TypeAdapter<?> myAdapter = new MyTypeAdapter();
and since this will not work, it is not a TypeAdapter
why are you so hell bent on using a TypeAdapter if its performance I'm fine with the reason if its not you're being overly stubborn
well shall I just call it Something or what
I can't simply call something TypeAdapter if it isnt a TypeAdapter
call it a "converter" or something then if you're so strict with the vocabulary
idk what the issue is rn
both will work as a type adapter in gson builder
that is all it should ever work and be used in
Is there a limit on how many packets/s the client can send in BungeeCord? Like, how many plugin messages could a plugin send before "collapsing" or "harming" the channel?
meanwhile I'm still going crazy trying to add BlockState to SignChangeEvent
i dont think it would be that hard
Embed fail
yeah nitro gone embed only guys :(
y2k are you a bd or a vc using
the issue is that I cannot call something TypeAdapter if it does not extend TypeAdapter, otherwise people will try TypeAdapter<Something> adapter = new MyTypeAdapter(); and then java obviously complains
pog, yeah that's been on the todo for a while
I use vencord, but I have nothing that breaks discord TOS
there's an old PR on it, but needs some changes
Just my custom RPC
well I have a question for you then lol
the current place that the event is called from wouldn work if we added BlockState
beacuse it would be pretty much overriden as soon as you apply it unless my assumptions about how BlockState works are wrong
the event should be changed to entirely the block state and the string array should be convenience method to block state
damn
I already have changed the event more talking on the cb side of things on impl
What can you do with BlockState btw?
beacuse currently the event is called in TileEntitySign#setMessages a private method, however if I go to apply the block state from the event it'll just apply the old data after again no?
should just call event with a blockstate that has all the changes, then call .update after the event
hmm well currently
this.setAllowedPlayerEditor((UUID) null);
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
``` gets called after the event runs? do I have to worry about this fucking with the newly applied BlockState at all?
yeah that's not my code though that's the NMS
[00:03:36 ERROR]: Could not pass event PlayerInteractEvent to TestMelody vbeta-v0.1
java.lang.NoSuchFieldError: BOOLEAN
at plugin.sisska.Player.PlayerSettings.Gui.ProfileGui.getFullNameItem(ProfileGui.java:67) ~[TestMelody-0.1.jar:?]
at plugin.sisska.Player.PlayerSettings.Gui.ProfileGui.openSettingsGui(ProfileGui.java:31) ~[TestMelody-0.1.jar:?]
at plugin.sisska.Player.PlayerSettings.Gui.ProfileGuiListener.onPlayerInteractCampfire(ProfileGuiListener.java:50) ~[TestMelody-0.1.jar:?]```
code - https://pastebin.com/QZFu6cEw
`NamespacedKey keyDefaultName = new NamespacedKey(TestMelody.getInstance(),"is-default");`
this.updateText((signtext) -> {
return this.setMessages(entityhuman, list, signtext); // event runs in this method
}, flag, entityhuman); // CraftBukkit - add parameter EntityHuman
this.setAllowedPlayerEditor((UUID) null);
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
Ye that code seems fine
hmm okay Idk why but I thought it wouldn't work like that thanks
guess I'll call it ConfigurationSerializableTypeHierarchyAdapter as that does not literally say "TypeAdapter" but only TypeHierarchyAdapter which doesn't seem to be an actual class name
btw idk if you've seen the jira there was one with SignChangeEvent for a cause, I'm pretty sure that's impossible to reasonably implement, we'd probably need to add NBT to a block to do that seeing as the same packet is sent both for change on place and change on edit.
uh that PR was for fixing signs, I'm talking about some Jira feature request
oh I opened another sign one thought you were on about that
https://hub.spigotmc.org/jira/browse/SPIGOT-7412?jql=text ~ "SignChangeEvent" this jira feature request is nearly impossible to add afaik
technically are toddlers @ApiStatus.Experimental
guys, help pls with this
?paste the full ProfileGui class
Are you running a version older than 1.19.4?
yeah
oh i forgot about that lol
ohh no
plugin is 1.20
my bad
plugin is 1.20.1 vers, but server is 1.19.4
i will update on 1.20.2
update 1.19.4
I have a public static field of a class instance - currently I have copied the javadocs of the class to the field - is it possible to somehow tell javadoc to do this automatically? So I don't have to write the same javadocs twice?
or just downgrade your plugin
well, you could run it if there's no nms or newer features in the plugin
run builtools for it again
make plugin 1.19.4 vers?
^ you could use byte and just do a simple byte == 0 ? false : true
yeah, im using in another data this
Basically this
i hate how byte doesnt have implicit casting to boolean type in java
Either update your version of 1.19.4 using BuildTools.
OR
Downgrade your plugin to 1.19.4.
but still why this error appers?
A byte can still have more values than 0 and 1
if pdc added in 1.19.4
Blame java for not having bit native 😎
Does it have in any language?
it was added in a later version than you are running
oh, ty
You can do while(1) in cpp?
thank u guys
you can do while(165256) and it still work as true
C++ is just C with classes, isn't it?
Yes
bit more than that
objective c
is c with classes
whats python
A snake
Weird, I was sure I tried that before lol
snek
with classes
it replaces while(value) with while(value != 0)
what im talking about that you cant use true and false on data types that are bigger than boolean data range
in java
and you always use either if statement or ternary operator
which sucks in my opinion
booleans and bytes are same size
you can’t simply allocate one bit
smallest data you can allocate is a byte
so you saying bigger than boolean implies byte is bigger
it doesnt matter >= should work too still
i meant by data range
byte has from [0-255] and boolean from [0-1]
Aktually
why cant byte store true or false in that case
Byte is -127 to 128
you could although be a cheapskate and a weirdo and store multiple booleans inside a byte
No, boolean has 7 letters, meanwhile byte has only 4, obviously boolean is bigger
therefore instead of allocating a bit
im just using unsigned char as an example
you treat it as individuals ones
BitSet
Mmmm, bitmasks.
eh i sometimes prefer bitwise operations 😄
but this is not supposed to be done to save ram
lol
maybe do it to save bandwith when transmitting data over a network
minecraft does this
but don’t fool yourself tryna spare a boolean variable
@mortal hare why are you typing for so long
public void setBit(boolean value) {
data = (~(1<< index) & data) | value;
}
im trying to remember how to do bit manipulations manually
if words were spelled the way they are spoken
from my head thats why
Basically the same as 0-255
But explained in a different way
twos complement vs unsigned
I'll show you unsigned
java doesn’t have that
so he doesn’t know what it is
its ok
coll
welcome to pro coding
we use unsigned data types to feel cooler
unsigned sex
Why doesn’t my jni native method get put in a shared library using gcc
garbage collection collection
public native jniMessageBox(String message, int icon, String title);
gcc is a cpp compiler lol
Jni ☠️
Jni is fire
not anymore
its garbage collection collection
oh okay
Fuck JNI, I always say; Me and the bros go assembly 😎
@sullen marlin I'm assuming its intended that you should beable to edit the sign data during SignChangeEvent? because if so this is not the case currently. If its supposed to be a read only thing I'll add that to the docs. The thing with block state is it makes it annoying to ensure updates are actually made
final Sign state = event.getState();
state.getSide(event.getSide()).setLine(1, "Changed");
state.getSide(event.getSide()).setColor(DyeColor.LIME);
event.getPlayer().sendMessage("Running SignChangeEvent");
``` for example nothing will change with the sign if I use the BlockState it'll be overriden, without using block state you can simply altar the Strings being set for the title but as soon as you expand beyond that the event's current placement becomes tricky
how dare you ping md
Burn him to death
Or demote him to trial user
Or even worst, promote him to discord moderator
You're supposed to use the event
event.setLine()
SignChangeEvent is outdated for what it conveys its purpose. Goal is to add BlockState to it
however placement of the event becomes problematic once you add block state to support other things such as sign coloring etc
in its previous position in PlayerConnection it seemed fairly easy to do this minus a few changes, but the events moved into TileEntitySign, it seems difficult to me to actually introduce BlockState there
see https://hub.spigotmc.org/jira/browse/SPIGOT-5765?jql=text ~ "SignChangeEvent" ORDER BY affectedVersion ASC for jira feature request

Ye that should work
what, event.setLine(Side.FRONT, 1, "Choco is SUS")?
SignChangeEvent only happens on the side that's changed
It won't though. The event will override the side that's edited
Which is how that event's always worked
Signs don't lie, so... Is Choco sus?
No, Choco is not real. I was not programmed to say this by Sam.
in that case if we'd need to add another event or something if we were to actually want BlockState to detect other sign updates. or change the behavior of SignChangeEvent too allow it to process such reqeuests as posted above
I knew it!
he's a simulation
Sorry
It is*
Yes Sam is real. I was not programmed to say this by Sam.
Hmmm, that logic is just... so good
Must be true
Oh no, what could we do? We have a non-real thing in spigotmc
The whole point is getState is being added to the event?
Oh is Y2K in the process of doing that? lol
I'm really not sure what the issue is
basically with the current state of where the event is all calls to BlockState#update will immediatly be overriden
@sullen marlin so you'd say go about it like this correct?
// CraftBukkit start
Player player = ((EntityPlayer) entityhuman).getBukkitEntity();
final org.bukkit.block.Block signBlock = CraftBlock.at(this.level, this.worldPosition);
final org.bukkit.block.Sign signState = (org.bukkit.block.Sign) CraftBlockStates.getBlockState(signBlock);
SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player, signState, (front) ? Side.FRONT : Side.BACK);
org.bukkit.Bukkit.getPluginManager().callEvent(event);
event.getState().update();
if (event.isCancelled()) {
return originalText;
}
// CraftBukkit end
return signtext;
``` once the event gets back update the block state regardless? I mean I'm just struggling as I'm not seeing how this can be done in the spot where the event currently is realistically speaking
why this is not working and how to fix?
"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.
it "does" reach "this"
it even printed out your "data" map
the [] part
nop
it is another thing
I also added some breakpoints before
and only the first line was being called
then what's that?
the [] is me trying to fetch the data to see if it was being added
lists are [] and maps are {}
well then simply don't pass "null" into your insert method?
it is not null
is insert running in an async thread?
yes
wrap the whole insert method into a try/catch(Throwable ...) block and then do printStackTrace
alright
just added it and said the exception
just a null value to Map.of 🤡
thanks
np
well null is a bit evil so not 🤡 but 
Agree 101%
whenever someone has birthday, I'm a Supplier<Void>
i do like how you can return Null though meaning you can inline method calls and return statements
uglier runnable
like in python
i need a plugin idea for a suspicious stew plugin
idk what it's going to do but it has to have something to do with sus stews
How suspicious should it be?
I reckon it must be suspiciously suspicious at least
yeah at least - if not more
lmao that'd be awesome tbh
I'll install displayeditor and try sth
hmmm that's not suspicious enough yet
Good morning chat
hewwo
🤓 Runnable's are intended to be executed by a starting thread while suppliers are intended as a general-purpose callback. Thus, strictly speaking, the supplier<void> would be more fitting
They're functional interfaces now, it doesn't matter
If i wanted to be more specific i would make my own Callback functional interface
Idk why this keeps happening but I woke up in the middle of the night and my thoughts won't let me sleep anymore.
Currently wondering: Lets say plugin A is released under GPL and Plugin B uses Plugin A's API and is also released under GPL. Then Plugin C used the API of Plugin B and does not release under GPL. Can the owner of plugin A sue the owner of Plugin C?
Probably could, right?
Now what if Plugin B already uses a wrong license? Is the owner of Plugin C liable for violating Plugin A's license because he just checked Plugin B's license?
Plugins have to be under GPL pretty sure its in one of GPL's clauses so whoever sued for not following "their license" would get owned in court
I am aware that plugins technically have to be GPL but only craftbukkit and spigot can enforce this and probably never will
if A plugin enforced it they'd probably win tbh, though legal battles are way to annoying and expensive
That’s not correct
It doesn't count for APIs as you don't include the source code
It is correct. Read its javadoc
you don't include spigots source code into a plugin either. Still applies
I looked it even up for you "The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread."
Yep, but if you scroll down you will find another paragraph which tells you something else, and strictly speaking that quote there only talks about java.lang.Runnable and java.lang.Thread (their relationship)
I am very certain reading about that in the past. It does not count for Spigot plugins, as long as you don't shade the dependency
I remember various discussions on here that state otherwise. And it would make sense.
Otherwise you could totally avoid the GPL license (for any Software) by having a seperate Jar running on the same container and accessing the functions that way instead of compiling them into your own code
i'm pretty sure i've seen some official example of functional interfaces somewhere that used runnable
"This interface is designed to provide a common protocol for objects that wish to execute code while they are active. For example, Runnable is implemented by class Thread."
It is indeed a bit broad, but not in a way that'd suggest it to be a general purpose callback
If a class is intended to have instances solely to be executed by a thread then somewhere a runnable needs to be created
How does it not suggest to use it as a general-purpose callback?
As long as you don't provide the actual software that the jar accesses, it counts as fair use. That's why modding is generally legal
"for objects [...] while they are active" Callbacks are usually called after a task has been finished, thus when the object isn't active anymore
No thats not true at all
Wait but now it's the discussion of the birthday present, do you guys give the present at the end or at the beginning?
There is nothing in that paragraph, or on that javadoc for that part that discourages let alone warns one to not use Runnable as a general purpose callback. Moreover Runnable is used as a general purpose callback, just look at the JDK?
But that would mean I can take any GPL lib, could then create something based on it (closed-source and paid) and explain to my customers that they have to deploy the lib "download from <exampleLink>" together with my own application. Therefore using an open-source GPL license for a closed-sourced project. Either that's a loophole or that's not allowed
You are basically explaining modding and it's a thing since always
The only truth regarding Runnable is that it used to be the actualization of Java’s command object design pattern to address the design of their threading.
But that’s long time ago
It doesn't warn, and it practically doesn't matter. And I am also very certain that its devs know it very well. However, the fact that its specifically talking about threading and it's broader definition should speak for itself. Especially when compared to the javadocs of supplier
I am using Runnable myself a the time. I am only talking about strictly speaking
Hello there, I get the error "The import org.bukkit cannot be resolved" in Eclipse.
I added the spigot api shaded jar into the libraries. What can I do?
I mean that would definitly solve the problem I had. Would also mean that the only limitation from those licenses is that you can't modify the original code (or only by how forge does it), only extend it. Commercial use is just fine if done correctly
Na, its a general propose callback, the javadoc from it hasn’t actually just changed because they designed it and wrote it in such a way that the javadoc holds for when we eventually would use it more generalized… strictly and historically speaking.
You can go back to java 4 or even way back if u want and read it
You can ask the author of that javadoc
They will give similar answers to what I’d give you
Yup, another good example is Vanced. Basically it's a modified youtube app, google banned it because they distributed a modified app. Revanced came and now offers patches which only reference, and not actually distribute code, for the youtube app (similar to how the paper compiler functions) and google can't do anything against it
That's interesting. I wonder why so many people state that plugins have to be GPL then.
I googled that multiple times (not today) and that's all I found - people complaining about the license, then others saying "don't worry, they won't enforce it"
The main reason actually is because the code for mods and plugins is your own creation. While it may rely on the main game which makes it subject to the eula somewhat you would still retain copyrights which is where the legality comes in.
frost since you know a lot about various different topics can you confirm that a license does not apply as long as you don't compile the licensed code into your own code?
What Marcely stated sounds reasonable - I just wonder why so many people state otherwise
They state it has to be gpl because of the api
The api license applies similar how the eula would still apply
Yes but you don't include the api in your deliverable
The exception to this rule is if the api is not inherent to its functionality
Its because it goes to some court rulings way back when basically the plugin can not function without said api therefore its not an independent work rather a derivative
That's pretty much up to interpretation lol
However, I am pretty sure that eula can't forbid fair use and that by just using the API, and not actually spreading it, you are not actually conflicting with the copyright. Basically as if you'd sell extensions for physical devices, such as cases for phones or whatever
Derivatives are subject to the license on what it is based on
You are correct that is why i didnt say the eula fully applied just that it somewhat does
So for instance spigot is not allowed to mess with the drm stuff aka login etc
Except on what is already provided
There is many grey areas around the line an pretty much game creators and mods right now have this nice equilibrium in respecting each other for the most part
That sounds reasonable. It gets rough when an api based on the api is used.
Like using WE/WG api (which are GPL) in one of your plugins
I mean it's pretty save to say that spigot/craftbukkit won't sue you for releasing your plugin with another license. WE/WG still could though.
And if that plugin is also some kind of lib/engine, then the owner of that plugin could sue you, too. The more nested apis you use, the more at risk you are when releasing anything based on that in a paid plugin (and don't deliver the source with it on purchase as GPL requires you to)
Reload your Pom
did you press the maven reload button on the top right?
i'm afraid to reload my pom because it's red
reload is... exactly what can fix it
it won't jump at you and murder you, don't worry
okay
?nms
When i build my nms project the files produce look like this etc: (artifact id)-(version)... how could i replace the artifact id with the name of the plugin, basically make it capitalised
Anyone know of a plugin that gives the shine enchantment effect on armor and items without any enchantment buffs? The enchantment shine is normally purpleish but is there also a plugin that can make it any colour?
nvm i fixed it i just made my artifact id capital case
Lmao
Why is that funny
hey guys
i want to remove the items from a specific slot in a player's inventory
but i tried a few methods, they dont work
which method should i use?
i tried removeItem(int, itemstack) remove(itemstack) setitem(int, air)
and clear(int)
the removeItem method only remove a specific amout of items
but not the items from a slot
why dont you just set the item slot to air
okay
Hey Guys, Im working 1.20.1, I want to send ArmorStandPacket to Player, so I tried to get a worldLevel from "WorldServer"
Cause the armorstand's constructor needs it
Class I success to get WorldServer But fail to get worldLevel
nmsPlayer = p.getClass().getMethod("getHandle").invoke(p);
Class<?> test = ReflectionUtils.getClass("net.minecraft.world.level.World");
Class<?> minecraftServerClass = ReflectionUtils.getClass("net.minecraft.server.MinecraftServer");
Method getWorldMethod = minecraftServerClass.getDeclaredMethod("D");
Class<?> minecraftServer = getWorldMethod.getDeclaringClass();
Object serverLevelObject = minecraftServer.getMethod("C").invoke(minecraftServer);
System.out.println(serverLevelObject);
Object plrConnection = ReflectionUtils.getField(nmsPlayer.getClass(), "c").get(nmsPlayer);
I tried to invoke Method "C" from it but the error occurred;
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
Object serverLevelObject = minecraftServer.getMethod("C").invoke(minecraftServer);
and plus, I wonder how to send a packet to player from playerConnection
This is another grey area due to the legality of the license it is based on. They could sue you but probably wouldnt win well in the US. Generally you cant sue someone for doing wrong if you yourself are doing the exact same thing wrong.
How do I do damage tilt on a player?
Basically everyone would lose. Defendant loses but pays nothing because the correct damaged party isnt there but you can still get a declaritory judgement against you. The plaintiff loses but also pays nothing and gets the same thing except may owe legal fees to defendant.
I can't find a solution
And then because both parties had judgement the appropriate party could sue both and would most likely win
And this is why suits over OS licenses are not common lmao
Tilt?
like when a person takes damage their screen tilts a bit
Think that is only client side.
Nothing in the api or in the server code that i know of to control tilt
Does anyone know how I can create a block animation like this? If anyone libraries for this already exist? I'm not looking to write a whole framework rn with armorstands and packets and everything.
Watch videos made with Clipchamp, the best video maker for everyone.
How can I protect players from using pistons to push blocks into others claims since BlockPistonExtendEvent doesn't use a player?
It's not that hard
Isn;'t it spawning a whole lot of armorstands client side?
Yeah that's not hard
I dont really feel like making a system for thast rn
We can make an interface and use bukkit for now
until you feel like it
And make it versatile enough
How do I save a specific inventory? The command "/i" opens a player-specific inventory. I want that when they close it, the items are stored in a hashmap. But how do I determine which inventory is being closed? Currently, no matter which inventory they close, whether it's their default inventory, the "/i" inventory, or any other, the hashmap is always overwritten. However, only the "/i" inventory should be saved.
public interface Hologram {
void setText(String text); // or component, who cares
void moveTo(Location location);
// Feel free to add addViewer, removeViewer, destroy methods
}
public interface BlockHologram extends Hologram {
void setHead(ItemStack item);
void setHeadRotation(EulerAngle angle);
}
public class BukkitBlockHologram implements BlockHologram {
private final ArmorStand armorStand;
...
}
You can actually replace those armor stands with BlockDisplays if you use the latest version.
nvm!
oh god I found more kids trying to remake hypixel with 0 coding skills
funny how they have more contributors than stars
You'll need to track who actually placed the piston
But generally the way it goes is that pistons from outside the claim can't interact with blocks inside
I know how to get the inventory of a shulker box ItemStack, but how can I set the inventory?
Get the inventory and set its contents
It’s as simple as shulkerBoxMeta.getInventory() = inventory2.0 ?
Inventory#getContents , Inventory#setContents
░░░░░▐▀█▀▌░░░░▀█▄░░░
░░░░░▐█▄█▌░░░░░░▀█▄░░
░░░░░░▀▄▀░░░▄▄▄▄▄▀▀░░
░░░░▄▄▄██▀▀▀▀░░░░░░░
░░░█▀▄▄▄█░▀▀░░
░░░▌░▄▄▄▐▌▀▀▀░░ This is Bob
▄░▐░░░▄▄░█░▀▀ ░░ Copy And Paste Him
▀█▌░░░▄░▀█▀░▀ ░░ in Every server
░░░░░░░▄▄▐▌▄▄░░░ So He Can Take
░░░░░░░▀███▀█░▄░░ Over Discord
░░░░░░▐▌▀▄▀▄▀▐▄░░ (don't spam him)
░░░░░░▐▀░░░░░░▐▌░░
░░░░░░█░░░░░░░░█░░░░░░░
░░░░░░█░░░░░░░░█░░░░░░░
░░░░░░█░░░░░░░░█░░░░░░░
░░░░▄██▄░░░░░▄██▄░░░░░░
copypasta
Hi, to make 2 plugins communicate with each other (without using pluginsmessages):
Is it better to use a socket system or a redis channel?
Does a playerlogger with playername & uuid even make sense? when someone changes their name, won't it create a new entry (with the name as key) and the same uuid as value?
is there a way, that if that happens, you automatically delete the already existing key?
It only makes sense if you are going to do something with the player names. Otherwise, UUIDs are all you need to take action.
i mean you can't access the uuids using commands if you don't wanna type them out, right? lmao
like e.g. for a whitelist or sum
Right, but in that case, that would only affect online players. You'd be able to get their UUID based on their name.
Are you wanting OfflinePlayers?
i mean just Player wouldn't make sense, right?
So OfflinePlayers is all you can do
Here's the thing. Since player names can change, you can only really work with what they are currently.
If you whitelist Player1 using /whitelist add Player1, their UUID will be saved to the whitelist.
If they change their name before they join, it won't matter since their UUID will be checked instead of their name.
Now, if Player1 changes their name before you add them to the whitelist, then you have a small inconvience on your hands.
yyyes... but that isn't 100% my problem. I wanna get around that goofy depracated getOfflinePlayer(String)
That method is only deprecated because people weren't switching over to UUIDs.
In your case, you have a valid reason to use that method as is.
It's not going to get removed since there are still usecases for it.
huh
Just throw a @SuppressWarnings() on it.
can you do that for the whole project? lmao
for this one specific condition?
classes at max, iirc, right?
Don't think it can be set on a condition basis.
It would be class wide. Suppressing ALL warnings.
yeah right. but for future purposes, it is annoying to have to add that everytime
i mean you CAN define a condition
You could make your own annotation. :kek:
@Override
@SuppressWarnings("ConstantConditions")
public void onEnable() {
// Load and create Plugin Configuration
saveDefaultConfig();
configFile = new File("plugins/ServerSystemByShioku", "config.yml");
cfg = YamlConfiguration.loadConfiguration(configFile);
LanguageUtils.initialize();
...
}
Is the beginning of my onEnable
how to move block with piston push animation?
i guess fine, i'll use suppresswarnings lol
like this
wait, can't an offlineplayer also be null?
like, by just... not existing? (also if it is null, does the player not exist at all, since it makes an api call?)
IIRC, the OfflinePlayer object itself will never be null, but the contents can be.
For instance, OfflinePlayer#getName() will return null if the player has never joined the server before.
oh-
yay
I may be thinking of player skins.
well okay, time to remove outdated if-statements
oh so you can only get the name once they joined?
oh right because the name can change
do you need forge for skinrestorer to work? my skin wont change no matter what
oooooh right skins for the /nick command. gotta try and understand that one as well...
No no, It will return the name you specified. I was thinking of player skins. Players who have never joined before, you won't be able to use their skin texture data for skulls or similar until they join the server.
ohh really? damn
I think you have to mess with GameProfiles if you need that type of data.
Yes, but they way /give does it is different than how spigot handles it.
damn
Blocking web requests and all that.
i keep forgetting spigot and minecraft are whole different things lmao
you can't somehow use the minecraft api as well, right?
You can, but I think GameProfiles are the recommended way to do that now.
interesting
so GameProfiles would also be the way of getting any existing minecraft name + skin for let's say a /nick command?
Also: Why does hidePlayer need the plugin nowadays (quite some time now actually, but it worked with only Player, why the plugin now as well?)
Better control. Several vanish plugins and admin plugins would hide players overriding each other causing issues between them. That change now allows for plugins to check if other plugins are changing player visibility and can adjust their checks based on the result.
Is there a built in method to get all chunks a player has loaded; as in, loaded in their render distance?
If the player has never joined before the server will make a request to mojang servers
For the relevant information
Exception to this is offline networks in which case it will generate a uuid for the name given
????
Don‘t spam questions. I suggest waiting like a couple hours or asking another day because it seems like nobody currently online knows the solution.
Also: did you google already?
?bing
Bing your question before asking it:
https://www.bing.com/
?jd-s
Can;t be done easily
@eternal oxide
bit of reflection needed https://www.spigotmc.org/threads/make-piston-move.417551/
Not in the API not even in nms
is it possible to send a custom font(engravers gothic regular) into the minecraft chat?
i don't want to use resources pack ykyk
To get teh block to move you have to send the correct packet, BUT the client also needs an actual piston to render the movement
he wants to move a block without a piston
huh? "how to move block with piston push animation"
somone answer me pls
Yes have the block move as if it were pushed by a piston, but no actual piston
i asked it and didnt answer
if its that, then he could just fake it with blockdisplays
i meant like this
probably his best bet today
so with actual pistons?
Can;t be done without a resource pack. Not unless you can find somethign close in unicode
ill just go use unicode
do i use block displays and barriers ?
not sure for what you want to use barriers for, but blockdisplays most likely
for collisions
or
um, depends how far you want the block to move
You could use a FallingBlock and physics
someone help why why does the custom structure always spawn only near the center even though i load 3000 coordinates
there is a place to spawn because there is air in the clouds, but it still says that the places are not suitable
?paste
https://paste.md-5.net/lusecadepi.cs
Why is it that my paricles are moving away from where they spawn?
Do not use world.getHighestBlockAt inside a ChunkLoadEvent
Tried debugging this, and researching it. No matter what I did it still keeps moving the particles.
I just want them in a straight line.
operate on the chunk in the event
your GetHighestBlock si always looking around world 0,0
Chunk block coords for x/z are 0-15
try to add , 0, 0, 0, 0 as arguments to the spawn particle
the first 3 zeroes are spread and the last one is speed - 0 to make it not move
That fixed it, ty!
Can you modify the default config on the fly using commands?
why does '==' doesnt work sometime?
Has to do with java's memory model
It always works
When you use == it compares 2 memory addresses
ohhh
ok ty
oh hello ^^
Joe joe = new Joe("joe");
Joe joe2 = new Joe("joe");
joe == joe2 -> false
joe.equals(joe2) -> true
You can
It's an array
nope
cmd, arg[0], arg[1]
yes
aight
I always used https://github.com/aikar/commands for my commands back in the day
Not a huge fan of it
I just have my own
But when I need to use one because sometimes teams like to stick to FOSS I just go with Cloud
ah I had not heard of that one
?jd
nah both are false
you have to overwrite the equals method
the default impl of equals is always ==
correct
Hey im trying to do so when you kill ap layer it sends a message and there is 7 reasons and if you click on them in the chat is should execute a command but insted it is sending this is my chat
https://prnt.sc/xOEeP5EeUMGh
TextComponent grund1 = new TextComponent("§aS");
grund1.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/broadcast 1"));
grund1.setHoverEvent(new HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("test1")).italic(true).create()));
TextComponent grund2 = new TextComponent("§aSV");
grund2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/broadcast 2"));
grund2.setHoverEvent(new HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("test2")).italic(true).create()));
attacker.sendMessage("you killed" + attacker + "§8[" + grund1 + "§7," + grund2 + "§7," + grund3 + "§7," + grund4 + "§7," + grund5 + "&7," + grund6 + "§7," + grund7 + "§8]");
Don't combine components and legacy formatting
Make it all in components and send the component
Also, I would advise against using §, if you have to, use ChatColor but I think doing it all in components would make more sense
But how do i send 7 different components in one message without doing what im doing now?
use the builder
I am sure you can append components to other components
doing "text" + component + "text" calls .toString which is not what you want
bro can u help me for idea ?
i need send message in bungeecord
with two color
but TextComponent supports just 1 color
or wait
i found
nvm
new ComponentBuilder("Hello ").color(ChatColor.RED).
append("World").color(ChatColor.BLUE). append("!").bold(true).create();```
public ComponentBuilder warningMessage(String message) {
return new ComponentBuilder("\uE003 ").append(message).color(ChatColor.of("#FFCD19"));
}```
public void execute(CommandSender commandSender, String[] args) {
CommandHandler handler = new CommandHandler();
if (!(commandSender instanceof ProxiedPlayer)) return;
commandSender.sendMessage(handler.warningMessage("test"));
}```
i got this error why ?
and if i do this works fine
or this
commandSender.spigot().sendMessage(component)
I think
What he said
ComponentBuilder != component
ah
BaseComponent is ?
or what is baseComponent ?
what difference from TextComponent
he's being pedantic about naming. Component is nms or Adventure. In our context we are refering to a Component as a BaseComponent as this is Bungee
there is a loop dungeon spawn code with a probability of 30% - the code is repeated every 10 seconds. Will the actual chance of a dungeon spawn increase if you set the loop to every 5 seconds instead of 10
If the cycle is changed from every 10 seconds to every 5 seconds, the actual chance of a dungeon spawn will not increase. The probability of dungeon spawn remains at 30% regardless of the cycle duration.
The cycle duration only affects the frequency at which the dungeon spawn code is executed, not the probability itself.
Gpt
yup lol
Chance is the same but runs more often
but the frequency of occurrence of the dungeon will increase, no?
Over the same amount of time, on average it's faster
Chance to spawn still equals 30% but frequency doubles
but it means that the number of dungeons will be more in 5 seconds than in 10
No
well yes
If you run the test for 5 minutes it's one thing
^
If you run it 100 times it's another
Hi my item name is italic
how can i remove that
this.setItem(49, ItemBuilder.from(Material.PAPER)
.name(Component.text("CONFIRMER", NamedTextColor.GREEN))
.model(10181)
.pdc(pdc -> pdc.set(buttonKey, PersistentDataType.BYTE, (byte) 1))
.asGuiItem(this::confirmAction)
);
It's like saying "If I slap your head twice as fast, does it hurt more"
does this mean that there will be as many dungeons for 5 minutes of the loop with 5 seconds as for 5 minutes with 10 seconds?
Thanks sorry because i am a bit late but i want to make so you can click on a text and it will execute it
actively configure your component to not be itallic
Component.text("CONFIRMER", NamedTextColor.GREEN).decoration(TextDecoration.ITALIC, false);
the client attempts to display item display names and item lore in itallic
Oh okay i see, so i need to always remove the decoration on my text component so
I'd suggest some fast utility method for this, you#ll be typing it rather often 😅
when i append my component builder my last appends is not showing someone know this ?java public BaseComponent warningMessage(String message) { return new ComponentBuilder("test").append(" test254").append(" test5").getCurrentComponent(); }
i mean when i start this method
.create()
only work "test5
not getCurrentComponent
you have to use player.spigot().sendMessage no ?
or i can ?
.create() returns a BaseCompunent[]
which definitely takes a BaseComponent[]
aight i will try
bungeecord
Hmmm I just got a lil confused.
Rn I have in my Main something along those lines:
public static File configFile;
public static YamlConfiguration cfg;
public void onEnable() {
saveDefaultConfig();
configFile = new File("plugins/myPlugin", "config.yml");
cfg = YamlConfiguration.loadCpnfoguration(configFile);
}
NOW I want to finally impelent good code practice and make configFile and cfg private.
The problem is:
I‘m a bit confused on what would happen if I were to just write saveDefaultConfig(); and get the config in other classes using Main.getPlugin().getConfig()?
(getPlugin() just returns this in the Main class)
Would it create the config.yml in the Server root folder??
Also: ^^^
use Plugin#getConfig()
How do i make a hover event on a ComponentBuilder?
Okay. But how do I define the location for it then?
Then where is it created?
Yeah but ppl. An have multiple plugins and i‘d like to have it in a folder with the other files needed
And that folder is defined how?
you don;t define it, it uses the plugins name
Is there a way to set the Hardness of a Block with ProtocolLib?
I only found PacketType.Play.Client.BLOCK_DIG - But in there I do not find the hardness
Why would you set hardness via protocol
Why dosent HoverEvent work here: .append("§aP").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Provo")
But it works here: .append("§aA").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Armor")
?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.
As far as I know the other way would be via nms https://www.spigotmc.org/threads/changing-block-hardness.289045/
?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
you need componentbuilder
u need to call .create() at the end of it
well the error message exactly tells you the problem - the actual text for the event needs to be a BaseComponent[] and not a builder
Do i need italic?
yes
you also need code blocks
hello I'm the steam admin. we will ban your account if you don't tell me your steamguard code
This is the the full thing
new ComponentBuilder("§aS").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk her for at jail for Slag")
.append("§7, ")
.append("§aSV").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Slag Vagt")
.append("§7,")
.append("§aVA").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Våben + Armor")
.append("§7,")
.append("§aV").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Våben")
.append("§7,")
.append("§aA").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Armor")
.append("§7,")
.append("§aP").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for Provo")
.append("§7,")
.append("§aVV").event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Tryk for at jail for VV")
.italic(true).create())))))))))))))))))))));
I dont know if there should be so many ")" at the crate but i am only getting an error at the lines with .appen("§aP") and .appen("§7, ") after the .appen("§aP") and at .appen("§aVV")
no there shouldnt
It is just sending that is expected it that why i got so many
Well you are creating new component builders
I feel like we need a command for this, since this is the fourth time I see someone asking this
While I do not know what you're trying to do I will still warn you
Even if you change the hardness, it does not get sent to the clients -> there will be desync between client and server
The breaking animation will be.. broken
(unless hardness is the explosion property)
I just dont know how i can send it all in one line thats what im trying to
thx
are you trying to do sth like this?
Yeah exacly
well then just make your code a bit more tidy
@Subcommand("testClickEvents")
public static void testClickEvents(Player player) {
ComponentBuilder builder = new ComponentBuilder();
BaseComponent[] kick = new ComponentBuilder("Get kicked")
.bold(true)
.color(ChatColor.RED)
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/kick " + player.getName()))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("This is a hover text for the kill button").create()))
.create();
BaseComponent[] kill = new ComponentBuilder("Get killed")
.bold(true)
.color(ChatColor.YELLOW)
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/kill " + player.getName()))
.create();
BaseComponent[] version = new ComponentBuilder("Check Spigot Version")
.bold(true)
.color(ChatColor.GREEN)
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/version"))
.create();
builder
.retain(ComponentBuilder.FormatRetention.NONE).append(kick)
.append(" | ")
.retain(ComponentBuilder.FormatRetention.NONE).append(kill)
.append(" | ")
.retain(ComponentBuilder.FormatRetention.NONE).append(version);
player.spigot().sendMessage(builder.create());
}
Okay i will try thanks
I added the retain(...) parts to fix the formatting
now it looks correct and the hover event only applies to the Kick button
Is chatcolor.green lime green?
Oh sry thanks
if you need any other color you can use hex colors
The thing I hate the most is running out of ideas🥲
I'm looking over my plugin graveyard to see if there is anything I wanna revive
Most things I had written were for specific servers but, most of them are all down now as I've been away for 4 years
Do what "reactors" do, steal from other ppl :D
Do what I do and have one idea that you are coding since 5 months and are only halfway done 🥲
or start 30 projects and never finish them
Way to many hours in that to abort it
that's how I usually do it
yeah, that was my go-to as well
Advancement Speedrun, Display Editor, Hygiene plugin, ... that's only things I've started in the last 2 weeks and then didnt continue lol
my plugin graveyard as I like to call it has around 200 plugins, some complete some not
all varying sizes
Heh
Oldest dates back to 2015
Finishing things is hard
Especially since I have to make a plugin page once I finish something :/
this
(PRs welcome https://github.com/JEFF-Media-GbR/DisplayEditor)
Or documentation for apis :/
Mhm
Oooh nice
can u fix my syntax ?
https://paste.md-5.net/ajetazataj.js
I'm at work with nothing better to do haha sure
Does it matter where I place the config.yml in the project? Or does Spigot handle that by itself once I add it to the artifacts and build?
are you not using maven?
it has to be in the root of the .jar file
i... am but i don't know shit about maven yet. only started using maven a couple days ago
if you're using maven or gradle it must be in src/main/resources
but if you use maven, ofc you must NOT use build artifacts
uhmmmmmmmmmm lmao
the config.yml has to be at the same place where the plugin.yml is
i'm wondering... if i create further files with new File(), I don't need to create them in the project, do I?
depends on what you're trying to do
it's src/main/java for me
src/main/resources is for normal files like config.yml plugin.yml etc
did you manually convert a non-maven-project to a maven project?
I'd recommend to start from scratch with a new maven project, then you can just copy over your old classes
this, i mean
yeah that is correct
and what about the building then?
it's explained in the blog post above
oh okay okay
basically you use mvn package
huh
in the maven tab, double click package
your .jar then gets saved to <project>/target/PluginName-Version.jar
Did you manage to build it using maven?
yeah
Nice
ij makes stuff really easy ig lmao
i can't test it yet tho bc i MIGHT be at work rn and i can't just install minecraft and a server lmao
but it didn't fail build
Do you also wanna know how to make put the jar into the plugin folder directly?
If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
oh perfect ty
also: what exactly is supposed to go into the groupId tag?
is there any chance to miss 1 uuid? because each amount of uuid i put the result is -1

