#help-development
1 messages Β· Page 316 of 1
im trying to use (Advancement::fromString) for an advancement list and its saying it cannot resolve method, is there a workaround for this?
e.g. "Please enter you rname". Then you enter your name. Then your plugin can get the reply
hmm I'll mess with it
?paste your code pls
CompletableFuture<Boolean> future = new CompletableFuture<>();
if (CACHE.getDocument(playerId) != null) {
System.out.println("cached != null");
future.complete(CACHE.getDocument(playerId).containsKey("loadouts." + loadoutId));
return future;
}
collection
.countDocuments(Filters.and(
Filters.eq("_id", playerId.toString()),
Filters.exists("loadouts." + loadoutId)))
.subscribe(new SubscriberHelpers.ObservableSubscriber<>() {
@Override
public void onSubscribe(Subscription s) {
super.onSubscribe(s);
System.out.println("C Subscribed");
}
@Override
public void onComplete() {
super.onComplete();
System.out.println("C Completed");
future.complete(first() > 0);
}
@Override
public void onError(Throwable t) {
future.completeExceptionally(t);
}
});
return future;
can anyone figure why this Subscriber is only subscribed to, but never completed?
like I can't imagine why countDocuments is not completing ;c
@tender shard If I'm creating a plugin that will have a Parent, API, Build and Implementation module, where do I import spigot
parent doesnt build anything ofc
what is build?
the complete thing?
it builds api and implementation and anything else
you can throw it into the parent, or into API and implementation
hello, my plugin is throwing a strange error and i cant figure out why. im getting "java.lang.IllegalArgumentException: Plugin already initialized!" "at rocks.craftclue.connectioncontroller.Events.onConnect(Events.java:48)"
my code is https://paste.md-5.net/imufamowup.cs
actually i have no idea
only thing thats not working is getting the list from the config
there is no Advancement.fromString method
i need a good example of how to do multi module stuff
you gotta use Bukkit.getAdvancement
im assuming what causing it is my runnable in my login event but im pretty sure i did everything right
like 48 isnt lining up with this code
also why are you using a List<UUID> if you want a List<Advancement>?
so how would i use that
oh thats just me forgetting to change stuff when i copied from my players list
wdym?
can't disallow a method in a runnable
List<Advancement> advancements = getConfig().getStringList("array.advancementName")
.stream()
.map(advancementName -> Bukkit.getAdvancement(NamespacedKey.minecraft(advancementName)))
.collect(Collectors.toList());
nothing gets instantiated here
oh
but i ended up seeing where u went wrong anyway, a few lines down
u cant instantiate a Plugin
you do new ConnectionController()
you cannot just create a new instance of your plugin
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
read this @solemn frigate https://blog.jeff-media.com/getting-your-main-classes-instance-in-another-class/
absolute madlad, im more of a set instance on onEnable
think abt it, when you schedule a task to run later, that runs at some point in the future. The rest of the code in the method continues executing. WHen the end of the method is reached, spigot doesn't know to wait 20 ticks for you to disallow the event. And if it did know to wait, it would have to freeze the player
i get this stuff in onEnable, there wouldnt be anything to get an advancement with
altho ive opted for just using DI instead of a master instance
what if i make an instance 
why? the instance should be set as soon as the object is created
wdym "there wouldnt be anything to get an advancement with"
well for me i dont need to worry about it being null before onEnable since i dont require my plugin to be used until its enabled
same. passing the logger to every single object, that's ridiculous
yh lmfao
advancementName wouldnt have any advancements in the array cause the plugin is enabling from being disabled
oh, how do i delay that part of my code then?
well you can't
you can just kick the player
damn
OR
ezpz
use AsyncPlayerPreLoginEvent
the advancementName is whatever is i nyour string list
read this and you'll understand https://blog.jeff-media.com/understanding-lambdas-and-method-references/
if i used this, would i have to do the dependency injection thing as well?
what are you doing btw?
you need to either have a static getter, or use DI, if you need your main instance
Library name please? Or its private
annoc? its my own
oh ok
im sending a message to a websocket server to make sure the connecting player is from one of my official bungeecords
right
so
use asyncplayerpreloginevent
alr
and do it then, wait for response
its pretty barebones n WIP, i think @quaint mantle has much more polished annotation based configuration system in BlueLib
how would i wait for a response without a runnable tho?
what did that player do π why r they on the block list
oh
do you HAVE to use a webserver?
rite
yeah
eaglercraft so yeah
damn i didnt know people in this server knew about eaglercraft
i only know of it because of this discord lol
someone sent it ages ago i think when there was a 1.5.2 browser build
i hear now theyre up to 1.8?
what is an eaglercraft lol
minecraft java edition in the browser
up?
yeah
what did they use before? beta 1.3?
1.5.2
its an impressive project tbh
i think it uses a lib called like IcedTea to run java in browser
yeah it's interesting, but also completely useless ig
can have voice chat and stuff
soo
might allow for more socialization
which alot of people look for in games
I had another idea of going about my problem and it was running a JavaScript file which would do the websocket stuff
But it turned out that you canβt use web sockets in javas js runner
java's JS runner? which one do you mean
The nashorn thing
It might have but im using jdk 8
yes
what version r u running to run ur servers tho
i wonder why, they should have just kept it
1.8 i assume?
Perhaps
The dev of eaglercraft specifically included it so people wouldnβt complain about it
oh, its a little buggy
might be a firefox thing, webgl on FF isnt the greatest
i took fall damage and the game crashed
nice
It is possible using the component api, to add a click event that when clicked executes code, instead of actions pre-defined by the component action.
I know that at least in Eclipse you can ignore package suggestions
I'd imagine IJ has something similar'
bro
didn't i explain how to do this earlier?
I added java.awt.List specifically but I realize that I can also just enable the java.awt.* package filter
here @sterile token
RE: this by the way. Nashorn was too much of a burden to maintain between versions and couldn't keep up to JS' new standards
There are open source continuations of the Nashorn engine among other JS engines that have support for ES6
But i cannot run a command
Because what if the player doesnt have permission?
you intercept the command with commandpreprocessevent
iit's not a real command
the command will look like /<fixed random string> <random uuid>
gonna just create it
cuz i wanted to do this for a while
Oh never realize that
PlayerCommandPreprocessEvent runs even for commands that don't exist
So if you write a command that would be relatively unique to you, (e.g. yourplugin:command_that_does_an_action), then you can do whatever you want
nvm i'm feeling lazy
well... what if ur working with awt..
Mozilla's Rhino is apparently a good alternative
and GraalJS iirc
Rhino is a good one, yeah
Then disable the filter π I don't often work with awt though
Eclipse lets you do it on a project-by-project basis so I'd just disable it for that one specific project
o
TextComponent component = new TextComponent("My awesome text");
text.setClickEvent(new ClickEvent(CLickEvent.Action.RUN_COMMAND, "/tp " + player.getName() + Utility.format(region.getCuboid().getCenter()));
ur gonna have a Map<UUID, Runnable>
generate a uuid with UUID.randomUUID()
check if the map contains it (1 in a trillion so i'm not sure if it's necessary)
if it doesn't, you can store the uuid and the code u wanna execute when the component is clicked
then set the command to /<pluginname>:<uuid>
listen to playercommandpreprocessevent
see if command starts with <pluginname>:
if it does, split at :
My question, why the event doesnt allow you to directly pass a void or a lambda expresion
π€
how will the client send the server code to run
when the click is done, the client automatically executes the command
it's not like spigot can detect the click
can a player change his/her name when on a server?
for what reason?
because a player's name is expected to stay the same for a single session
the display name can change
but their name itself shouldn't
okay thanks
which swing element would be the best to display logs etc? Basically like the console in intellij?
sth like this
the notepad looking one?
can u send how it looks?
I dont have any yet, I'll try it now
oh okay, so thats is how is designed the components right
@echo basalt The spice must flow
//Get locations in zone
protected Collection<Location> getZoneLocations(ScriptActionData scriptActionData, ScriptTargets actionTarget) {
//Get the locations from those zones
return switch (actionTarget.getTargetBlueprint().getTargetType()) {
case ZONE_FULL ->
consolidateLists(generateShapes(scriptActionData).stream().map(Shape::getLocations).collect(Collectors.toSet()));
case ZONE_BORDER ->
consolidateLists(generateShapes(scriptActionData).stream().map(Shape::getEdgeLocations).collect(Collectors.toSet()));
case INHERIT_SCRIPT_ZONE_FULL ->
consolidateLists(generateShapes(scriptActionData.getInheritedScriptActionData()).stream().map(Shape::getLocations).collect(Collectors.toSet()));
case INHERIT_SCRIPT_ZONE_BORDER ->
consolidateLists(generateShapes(scriptActionData.getInheritedScriptActionData()).stream().map(Shape::getEdgeLocations).collect(Collectors.toSet()));
default -> new ArrayList<>();
};
}
Yaaay I fixed all the swing issues I had so far
I'm glad to hear that you have finally put your life in order and are now a model citizen, the picture of happiness and health by every metric
thank you
erm
to use Bukkit operations like opening an inv
I guess I can't use CompletableFuture#thenAccept?
like I thought thenAccept will run on the current thread, being Bukkit's main thread, no?
you can just use the scheduler
thenAccept(o -> { Bukkit.getScheduler().runTask(...); });
well most API methods do ensureMainThread or however it's called
at least stuff related to worlds, e.g. spawning or removing entities, changing blocks etc
opening an inv, I am not sure
am I in Bukkit's thread atm?
you'll just have to try whether this works. However, whether that works could change between spigot/paper and different versions
no idea lol
smh this is so confusing
yeah im on the actual javadocs page and it says that
but the debugger seems to make it out that im on a diff thread
yeah probably the one that completed the future
my thought process was to do the mongo operations async, then accept the result on Bukkit's main thread
is that not how it works π’
OH
i think the orange highlight and orange checkmark means that just those methods were on the other thread
okay next problem
[23:12:34 INFO]: [org.mongodb.driver.cluster] Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message
at com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.failed(AsynchronousChannelStream.java:263) ~[CPvP-Kits.jar:?]
at com.mongodb.internal.connection.AsynchronousChannelStream$BasicCompletionHandler.failed(AsynchronousChannelStream.java:233) ~[CPvP-Kits.jar:?]
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:131) ~[?:?]
at sun.nio.ch.Invoker$2.run(Invoker.java:221) ~[?:?]
at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:113) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.nio.channels.InterruptedByTimeoutException
at sun.nio.ch.WindowsAsynchronousSocketChannelImpl$ReadTask.timeout(WindowsAsynchronousSocketChannelImpl.java:621) ~[?:?]
at sun.nio.ch.WindowsAsynchronousSocketChannelImpl$2.run(WindowsAsynchronousSocketChannelImpl.java:656) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
... 3 more
is this error.. erm how do I get rid of it?
set a keepAlive thingy
do you got a MongoClientOptions object?
do socketKeepAlive(true)
how do i strip a message of its ChatColor
makes sense
yes lol
@tender shard do you have an example xd
MongoClientOptions doesn't exist
I have MongoClientSettings but it doesnt have socketKeepAlive
what about SocketSettings.Builder or sth?
what version of the driver are you using?
in 3.6 keepAlive is enabled by default
4.8.0
so my code is the problem
I'm ready to just turn it all into sync and make it async myself
this is ridiculous this publisher nonsense
Hey, anyone here have expeirence with MerchantRecipe? I'm trying to modify a villagers trades but I've never worked with MerchantRecipies before. When i try to set a recipe with Villager#setRecipe I get the IllegalStateException "No offered ingredients". I am using MerchantRecipe#setIngredients but it doesn't seem to be working, Any idea why? recipe.setIngredients(Arrays.asList(new ItemStack(Material.BOOK, 1), new ItemStack(Material.EMERALD, ThreadLocalRandom.current().nextInt(16, 65))));
it's not well documented at all
show your whole recipe code
For some more context I am calling this on VillagerCareerChangeEvent to have a 5% chance to change a librarians trade to a custom enchantment
Sure thing, here's the event: https://paste.md-5.net/qugicedoqo.cs
send the full stacktrace pls
if you call getIngredients() on your on your recipe before adding it to the villager, does it contain the ingredients?
hmmm that makes no sense
Got that from this List<ItemStack> ingredients = Arrays.asList(new ItemStack(Material.BOOK, 1), new ItemStack(Material.EMERALD, ThreadLocalRandom.current().nextInt(16, 65))); recipe.setIngredients(ingredients); System.out.println(ingredients.toString());
oh no
wait hold on
do System.out.println(recipe.getIngredients())
eyo
recipe.setIngredients(ingredients);
System.out.println(recipe.getIngredients());```
wait I'm dumb
dude got me searching through NMS for 5 minutes lol
you create a new recipe instead of using your existing recipe lol
God I'm dumb sometimes
Lmao thanks for the help, sometimes you just need another set of eyes
I was very confused for a minute
np π
How can I set a skull's ItemMeta to have a custom texture/from the base64?
you know what's funny
I've actually done that without using your blog
(I had a bit of help in PaperMC for the createPlayerProfile in Bukkit, is that new?)
1.18
ah yep
Hey do you know if there is any way to get a villagers gossips without nms?
There was a PR waaaay back in the day but it never got merged
So no, only NMS at the moment
Ok thanks
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
Hey choco do you know where the price multiplier for villagers is calculated?
where do u get it from?
i can tell you where it's calculated
i have craftbukkit src open
looking into creating a gossip api btw
I'm referencing the mappings fabric provides and I am looking at the villager class and there is a prepareOffersFor method ```private void prepareOffersFor(PlayerEntity player) {
int i = this.getReputation(player);
if (i != 0) {
Iterator var3 = this.getOffers().iterator();
while(var3.hasNext()) {
TradeOffer tradeOffer = (TradeOffer)var3.next();
tradeOffer.increaseSpecialPrice(-MathHelper.floor((float)i * tradeOffer.getPriceMultiplier()));
}
}
if (player.hasStatusEffect(StatusEffects.HERO_OF_THE_VILLAGE)) {
StatusEffectInstance statusEffectInstance = player.getStatusEffect(StatusEffects.HERO_OF_THE_VILLAGE);
int j = statusEffectInstance.getAmplifier();
Iterator var5 = this.getOffers().iterator();
while(var5.hasNext()) {
TradeOffer tradeOffer2 = (TradeOffer)var5.next();
double d = 0.3D + 0.0625D * (double)j;
int k = (int)Math.floor(d * (double)tradeOffer2.getOriginalFirstBuyItem().getCount());
tradeOffer2.increaseSpecialPrice(-Math.max(k, 1));
}
}
}```
whatya typing
The getPriceMultiplier just goes back to TradeOffer and I don't know where the TradeOffer classes are initialized for the trades
wait you mean you wanna know how tradeoffers are generated
or in this case merchantrecipes
Right but where is the special price generated
you mean the base price?
I want to get the value i need to multiply the base cost by
actually wait that won't quite work how I want it to
Ok so I am adding a custom trade to villagers on VillagerCareerChangeEvent when they become a librarian and I want to apply the price multiplier like the vanilla trades have, what is the best way to do that?
Ah so it seems MerchantRecipe does have a priceMultiplier arg but what's the best way to get that value
Well the vanilla trades apply price reduction based on the player reputation and their hero of the village status
Yeah I am looking for where the priceMultiplier is calculated based on the villagers gossips
Is that in EntityVillager?
Wait could I just use getOffers and use the getPriceMulitplier method from one of the offers?
@remote swallow
java.lang.ClassCastException: class org.bukkit.configuration.MemorySection cannot be cast to class java.util.Map (org.bukkit.configuration.MemorySection is in unnamed module of loader java.net.URLClassLoader @504bae78; java.util.Map is in module java.base of loader 'bootstrap')
at me.epic.betteritemconfig.BetterItemConfig.fromConfig(BetterItemConfig.java:176) ~[CPvP-Kits.jar:?]
at
values.put(id, new SelectionItem(itemSection.getInt("display_slot"), BetterItemConfig.fromConfig(itemSection.getConfigurationSection("item"))));
Am I doing something wrong :<
it's fkin hardcoded
this is for librarian i assume
?
It's hard coded :(
@unkempt peak it's 0.2 for librarians
Wait but how does that work with the gossips?
Is it just 0.2 more if the gossips are negative or what?
Seams this issue will stay in spigot or no one cares about making recipes because how broken the system is.
yeah
seems to be that way
So I just need to pass in 0.2 to the priceMultiplier of MerchantRecipe then?
yeah
idk what other types of villagers there are btw but all villagers seem to use 0.2 except for 2 types
i cant tell u what the types are sinced they're named a and b
ur using nms to add the recipe?
can't u use spigot?
No just the normal way with org.bukkit.inventory.MerchantRecipe
ah ok
Thanks for the help, 0.2 seems to work
I have no idea why it's hardcoded like that but whatever
AAARRRGH the fucking progress bar when updating maven doesnt work
it works when it downloads maven the first time, but after that it's just empty D:
@unkempt peak
so i'm working on the gossip api
what should i call the interface that represents all of a villagers gossip data?
we could just go the nms way and use Reputation?
That seems logical to me
call it Swagness
should there be Villager#getReputationData#getReputation(Player)
alex can i borrow ur eyes
not sure, I'm going for a smoke and then I gotta sleep, it's 7 am and the chimney dude comes at 1pm
I'd say the latter
public Map<String, SelectionItem> loadoutItems() {
Map<String, SelectionItem> values = new HashMap<>();
ConfigurationSection section = getConfig().getConfigurationSection("kit-items");
for (String id : section.getKeys(false)) {
ConfigurationSection itemSection = section.getConfigurationSection(id);
int displaySlot = itemSection.getInt("display_slot");
ItemStack item = BetterItemConfig.fromConfig(itemSection.getConfigurationSection("item"));
values.put(id, new SelectionItem(displaySlot, item));
}
return values;
}
java.lang.ClassCastException: class org.bukkit.configuration.MemorySection cannot be cast to class java.util.Map (org.bukkit.configuration.MemorySection is in unnamed module of loader java.net.URLClassLoader @504bae78; java.util.Map is in module java.base of loader 'bootstrap')
at me.epic.betteritemconfig.BetterItemConfig.fromConfig(BetterItemConfig.java:176) ~[CPvP-Kits.jar:?]
at us.cpvp.kits.CPvPKits.loadoutItems(CPvPKits.java:79) ~[CPvP-Kits.jar:?]
what's going on here?
yeah but then there are the different types of reputation
well let me borrow just an eye then xd
how does the config look like?
kit-items:
healing_potion:
display_slot: 0
item:
type: potion
amount: 1
effects:
STRENGTH: 3 ; 60
diamond_sword:
display_slot: 1
item:
type: diamond_sword
amount: 1
enchants:
mending: 1
sharpness: 3
so if i were to create a ReputationData class, what should it be called?
which line is BetterItemConfig 176, and what's CPvPKits 79?
it should be called gossips π
:79 -> ItemStack item = BetterItemConfig.fromConfig(itemSection.getConfigurationSection("item"));
as for line 176 of BetterItemConfig..
just Ctrl+B into it
in github it's builder.potionEffects(potionEffects);
in intellij's decompiler,,, it aint even in the method I'm calling
Yeah you could have Gossip class that has that data and the getReputation player can return a list of Gossips
that's why im so confused
you got the github link?
Like an enum GossipType with the gossips value and decay or whatever
ah it could be this alex?
for (Map.Entry entry : ((Map<String, Object>)itemMap.get("enchants")).entrySet()) {
he's casting a configurationsection to a map right there
or no
an object to a map
yes, or this: (line 170 on github)
@remote swallow #help-development message
could it be that something changed?
his gradle build is compiling against 1.17.1
am in 1.19.3
i gotta go to sleeep
but like.. this doesn't seem like a highly changing API
bb
how would i repeat something in my code until a condition is met?
ive tried bukkit runnable's runTaskTimer but it seems that the server is skipping it and going to the next code for some strange reason
are you on the main thread?
yeah
does run task timer run that code until it gets cancelled and then moves ahead or does it move ahead while also running that code?
you can't halt your code and wait for a task to finish
oh
you run a timer and when yoru condition is met you run the code you want
Technically you can
It's just not reccommend for spigot
Your main thread shouldn't wait for anything to be done async
me laughing in Thread.sleep()
Real pro's use Unsafe#park
?paste
is there any way I can instead code and compile spigot plugins without using and IDE
using maven or gradle or whatever
is there any tutorial for that?
Not really a great idea and would slow you down but why not
You could always use maven with the terminal
and type the commands out there
I don't have enough math knowledge but my wish is to write math formulas into java code
totally dont slow down anyhting, it is faster tbh. and a bit lighter on the system.
Because running a server, minecraft and java IDE at the same time can be a bit painfull for a low end computer to handle
howww?
Is there any specific tutorial to that?
please tell me i really need it
simplify in what way
functionality, readability, cleanyness...?
debugging?
improving?
well the core functionality would stay the same
what you can do is: add logs, use Optional, make the parameters non null, fail fast, comment your code, dont just throw in an entire codeblock, ENTER exists
or even the smallest stuff like: is the database connected?
also, as a heads up, you are closing the statement before returning it
descriptive names, not just glue your code together
your method barely makes sense as is
its an auto close
yes
oh read that wrong
does anyone know what this.bP.a(0,new PathfinderGoalMeleeAttack(this, 1,true)); (from 1.17.1 EntityZombie) is in 1.18.2?
or similar
that is still returning a closed statmenent
your try-resource block closes before the method ends ?
that is the entire point of it
yea
not building a rather useless method like this tbh
idk what kind of monsters of SQL queries you are writing
but like
this saves you, 3-4 lines ?
maybe ?
sure
now your caller has to try-resource
Shouldnt use throws if you are able to handle the error unless you want the user to handle or should
Also why are you using generics?
Then you should just handle it in the method
anyone know how i can still do this?
rewriting all data classes as non records would suck
for (int i = 0; i < l; i++) {
Field field = declaredFields[i];
Class<?> type = field.getType();
FieldData data = new FieldData(ObjectSerializer.getPrimitiveType(type),
ObjectSerializer.unsafe.objectFieldOffset(field)); // err here
fieldData[i] = data;
}
Trying to Instantiate records?
i was trying to get the field offset of a record
component
which is a field afaik so i dont get why it wouldnt work
but ig ill have to create a seperate prototype for those then
Uhh
one ms per pass to deserialize an array of 500 objects
pretty decent i think
bruh nvm object input stream faster
Lol
certified bruh moment
ok with one object, not an array, object input stream is much slower
targetGoalSelector.register(0, new MeleeAttackGoal(this, 1, true));
is probably what it remaps to
on runTaskTimer, what's delay and what's period?
Delay is before it runs, period is how often
there arenβt many good words that could describe it better
Well interval is what java uses for ScheduledExecutorService, think that wouldve been the best choice
yep
epic π
alex and I tagged you abt a problem last night, you were probably asleep; once you get a chance can u take a look and just lmk if I'm doing something wrong
Am using 1.19.3 without the NMS imports, incase I need em
did u leave your Discord open in this channel?
lmao
Yep! Potion effects
kit-items:
healing_potion:
display_slot: 0
item:
type: potion
amount: 1
effects:
STRENGTH: 3 ; 60
diamond_sword:
display_slot: 1
item:
type: diamond_sword
amount: 1
enchants:
mending: 1
sharpness: 3
mm perhaps it's INCREASE_DAMAGE instead
I could'nt even narrow it down to what line was causing the error so didn't even think about the enum matching for effects
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionType.html#STRENGTH it appears to exist
declaration: package: org.bukkit.potion, enum: PotionType
its comming from this
specificly the entry set of effects
ah i think ive figured it out
a config section is a MemorySection and i dont call the value stuff on that section
i just call entrySet
but you use .get() then cast, no?
which'll return as an Object
ah yk what it is, that's exactly why
memory sections are weird
yeah one sec, ill update it
ty!
i think ive fixed it, just gonna get the test project up and test it
Many thanks aha, glad it didnt work tho because I would've been up for longer
lol
put a good stop to my 5+ hours of debugging last night (unrelated problems)
in spigot 1.8 there is no ItemStack#setLocalizedName so is there any other method? (I use it to detect the specific item)
Nms probably
Old api no new api support
how u detect items in 1.8? without nms
Lore or item name
damn hate this api
Update then
sorry ig?
ofc not
yikes, no thanks
ofc it does. if you don'T use any 1.9+ api features
so i cant use setLocalizedName
what does that even do?
setLocalizedName is supposed to be used for servers that have a different language set. It represents the name for the language being used.
but from what I know, the client never sees the localized name
AFAIK, it does get sent to the client, it just depends on how it's applied to the item. However, I know very little about it to begin with.
I just know people use it for a quick and easy way to add unique data.
It didn't exist back then.
anyway, still better then using the lore lol
hm yeha well ok
yeah I also only learnt about PDC in 1.16
when it was already added in 1.14 / kinda added in 1.13
Legacy versions there is no other way of doing that, the better one is using ItemStack#isISmilar()
I think thats the correct name
what does isSimilar(ItemStack) have to do with saving custom information in an item?
also legacy versoins are outdated versions that should be dead
1.8 is so old, it's old enough to sign contracts in germany
?1.8
Too old! (Click the link to get the exact time)
seven year olds can sign contracts?
or is this some sarcasm lol
8 years old can
under certain circumstances that is, ofc
Β§Β§ 107ff, 110 BGB
that is really interesting
Lol, why is the age so low?
well why should an 8 year old not be allowed to buy sweets in a supermarket
in the US, minors can not enter into contracts without parent consent or a guarantor
probably with parental permission
imagine being 17 and you wanna buy a bottle of water but you cannot do that without parent's permission lmao
that's kinda weird
you need to sign a contract to buy a bottle of water?
no, almost all contracts are valid without signature
No, but it is implied as they are so called rendering services
so its not signing
a contract is merely proposition and acceptance
They should be able to, but I would hope that it isn't viewed as a legally binding contract. Ffs, the 8yr old is just giving the merchant the necessary money.
a signature in 99% of cases doesnt decide whether a contract is valid or not
almost everytime, a signature is not needed for a contract to "work"
what
"yo do you wanna buy my car for 20k�" - "yes".
that's already a valid, enforcable contract
there is such things as verbal contracts
Β§ 125 BGB says that in general, no "form" (such as written contract) is needed
unless they clearly accept the terms by performing the action, im pretty sure you cant just write a document saying some shit directed at someone random and it will work
that's obviously a buying contract
i thought he was needing to compare item stacks, so far you dont have any metadata based on 1.8, that the only option without NMS
yes ofc the other person has to accept
Β§Β§ 145 ff BGB
No? Atleast in uruguay, if you write a contract, must be signed and validated by governaments organizations
yeah
also in the US contracts in general are only valid if there is some kind of value that is recognized by law
not in germany
oh right, i didnt know my bad
Ehhhh, not the way it's viewed over here in the states. While I can see the reasoning behind it, I'm not sure I can 100% agree with it. While sales are may technically be a contract, it's pretty cut and dry. It's an exchange. It shouldn't require extra laws to ensure that minors can spend their money.
the US does in indeed have laws covering the exchange of money for goods and does state its an implied contract for goods
ofc it's a contract. imagine you buy something and it's broken. Of course now you wanna say "we have a buying contract and since it's broken, you didnt fulfill it, so I demaned compensation"
what are "goods"
a contract is needed
and it's ruled in Β§ 433ff BGB
you guys seem to confuse the word "contract" with "written contract"
Iβm using my own plugin for lightspigot (a custom fork) and for some reason my plugin works perfectly fine on spigot but I get this error when using the custom plugin. Does anyone know why? https://pastebin.com/xGYq4yRW
anything that the business sells for people to buy. Items.
if it isn't an item its a service
not only that, I think they forget or don't know or understand there is different kinds of contracts with their own limitations etc
yeah
then you should head over to LightSpigot's support
I did but they donβt reply when they do they tell me to make sure it works with spigot and itβs like an endless loop
we can't help you with obscure forks though
whenever I visit you, one of the things I want to experience is German Techno/Rave parties
all I can tell you is that "cmd" is null in PingCOmmand line 24
Do u know any forks to fix 1.8 pvp hit reg then?
you are expected to take many drugs to be let in lol
you said it works in spigot, but not the fork. We can't do anything about that
1.19.3
what if you don't?
then just pretend it
lol idk I dont go to rave parties
but my best friend always comes home totally wasted at 1pm the next day
from them?
yeah
interesting, anyways reason being I want to go to one is because from my listening experience of techno
German techno routinely tends to be better
also, them clubs for techno seem to be like 10x better then the ones in the US
Can you add extra rows of hearts with a plugin in later versions? (ie does increasing max health of a player display clientside now?)
not entirely sure
but it has always been a client side limitation, so I would imagine a datapack probably could solve it
you can set the max health and the hearts will "stack"
visually on the client?
that's what I'm after, I just need to figure out if I can make this a plugin or need to make a mod
cheers, appreciate it massively β€οΈ
Oh yea alex, did you ever figure out that issue with your GUI that you're making?
yep, I rewrote it from scratch, now it works perfectly
Oh cool. What was it? I was messing around with it and I couldn't figure out why resizing it was adding extra padding.
The best I was able to get it was this.
i dont know what the issue was. I rewrote it from scratch, one JFrame with a JTabbedPane. every tabbed pane is a JScrollPane with a JPanel inside that has a GridBagLayout (or BorderLayout for the Generate tab)
you should totally add better item config when i finish it
can you like use css with smth graphical in java?
Huh, then I might have been going down the right path.
I had to put the tabs in their own containers/panels so that they would stick to the left.
you would need to implement the engine for CSS or create your own parser
at that point might as well just not use it
Nice to see it working properly now.
oh thats a no
JavaFX does many things using css and stuff
That why i prefer Blazer interfaces rather Java ones
javafx?
at least i think javafx
hmm was just wondering
downside of using it is that it isn't in the JDK anymore
have to shade it or include it with your app
or just hope they have it installed
true
That cuz they added modules and they modularized the JVM
that isn't why, they didn't want to maintain JavaFX at the same time as the JDK. So they split it off and it has its own team that maintains it
which it did speed up JDK development as they wanted to
Does anyone know how the leak detection threshold works in hikari? I keep getting the Apparent connection leak detected warning and I just don't know why it's happening. The threshold is 30 seconds and I get it more or less after the plugin loads. From what I've found, it might just be a warning, but ideally it wouldn't be throwing them in the first place.
leak detection works by detecting the time outs
basically what it is for is detecting when you are not closing connections
to close a connection properly you have to use the hikari API to close it
I personally don't like hikari
That's the thing though. I am closing connections. From what I've been reading, the warning is there to let you know that one of the connections has been out of the pool for longer than the threshold. Apparently in some cases, it's queries that are taking too long, but I don't believe that I'm even sending queries on startup.
I recommend giving BoneCP a try
its the predecessor of Hikari but it works just fine. Caveat is that it isn't actively developed anymore and some people will tell you using something that doesn't have support is bad lol
but I think it works better then Hikari and has a nicer more intuitive API
hikari is just like making a connection pool and asking a connection from it, simple isnt it?
Hmm, the weird thing is that if I remove the threshold it doesn't throw the error. However, that makes me wonder if it's still happening in the background. The only issue I have with it is its lack of clarity. I'm closing the connection, so that leaves how long the query is taking. Which they should be short, but very frequently sent. Maybe I should try other config options?
if you need to verify queries
there is a command in MySQL that lets you see the statistics in regards to queries
specific statistic you would be interested in, is mysql calls them slow queries
What's the command?
just run the mysqltuner script
it will help you optimize your db server as well as show you some stats
the link alex gave is pretty good too
Yea, I was reading though that and from what I've been checking, it doesn't look like I have slow queries.
Well give mysqltuner script a try
I doubt you actually have any problems in regards to your queries and it is just hikari
Yea, looking though the script, the recommendations are minimal. Also, a lot of failed tests. Probably due to it being for personal use.
But, I did see a slow queries stat and it was 0%.
Highest usage of available connections: 33%
So wtf is wrong with hikairi?
recommend sys schema
helps with statistic gathering and reading
how can I fix this ?
'java.util.Collection org.jetbrains.idea.maven.server.MavenServerEmbedder.resolveProject(java.util.Collection, java.util.Collection, java.util.Collection, org.jetbrains.idea.maven.server.security.MavenToken)'
show the full stacktrace
skip-name-resolve helps your DB be more optimal in cases where you are accessing it between hosts because if you use a domain mysql queries the DNS
to resolve the hostname
Following the link, it provides files for MySQL 5.6 and 5.7. Are those going to work with MySQL 8?
in the event the DB server is used only on localhost, then you should have that set anyways and just use the localhost ip
should, its a schema
its not typically version dependent
hmmm
seems that it is included in mysql
already after those versions
just need to run mysql --initialize
however not sure if that would hurt your DB server if you ran it
Well apparently it doesn't exist anymore. :p
Guess I gotta figure out how to run that other script.
you don't run it inside the mysql console
you need to invoke mysqld with that argument
that isn't invoking mysqld
Anyone know how to use the Lunar API in order to disable freelook?
Shouldn't you ask lunar they have a discord
Apparently I don't even have mysqld installed. Unless you are referring to the service?
it refers to the daemon. You do have mysqld installed otherwise you wouldn't have a DB server lmao
Well, what am I missing then? The command apparently isn't recognized.
ok did some reading, probably shouldn't do it
but
bin/mysqld --initialize --user=mysql
user being whatever is your user
No such file or directory. lmao
have u tried looking at their documentation? i dont think spigotmc discord is the right place to ask imo
Iβll ask in their discord
its wherever your bin directory is at. So its either /var/bin or /usr/bin
I did install the sys script. Although looking that the documentation, it looks like it just runs a bunch of scripts that generates tables that you have to search through yourself.
yes it generates some tables and functions that are useful for things like MySQLtuner because it helps aggregate the necessary information

Oh, so I need to rerun the tuner script?
well you can, but I thought you were referring to the sys schema stuff
either way, once you have sys schema if you ever decide to put it on the mysql server, yes you would re-run the tuner script
I recommend running that script every so often to keep tabs on your DB servers performance π
servers are meant to be tweaked regularly lol
So its not possible on TextComponent ClickEvents run some code, instead of any default action?
Hello I try to use vault for my plugin but when I want to use a function that's return that
at fr.spectr2155e.shinobicraft.Main.onEnable(Main.java:62) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316) ~[server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:412) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugin(CraftServer.java:476) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.craftbukkit.v1_7_R4.CraftServer.enablePlugins(CraftServer.java:394) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.craftbukkit.v1_7_R4.CraftServer.reload(CraftServer.java:866) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.Bukkit.reload(Bukkit.java:301) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchServerCommand(CraftServer.java:753) [server.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]```
ok, like have said Minion yesterday right
Java null Pointer Exception
?npe
The NullPointerException, (commonly referred to as NPE), is thrown in the following cases, but not sealed to: 1. null is passed into a method or constructor which does not allow it; 2. When trying to access a field on an object pointing to null; 3. Casting null to a primitive. See https://stackoverflow.com/a/3988794/17047120 for information on how to debug NPEs.
whats main.java line 62
?conventions
tell them not me
economy.bankDeposit("Spectr2155e", 100);
economy or the player is null
okay
Wait wait
I was, but I might not have installed the sys schema correctly. I reran the tuner script and it said the same thing, so I redid the sys schema script, but I keep getting script errors when trying to run it.
I know the problem
With vault you must pass an OfflinePlayer, name is deprecated on neers versiosn and wont work
Okay
Try that, atleast that is how newest docs are document
Yeah, he is using old api version
I figure the database configuration is fine based on the other things I've tried, but that still leaves the issue of hikari.
Also try using latest vault api, your version is not updated
Dont you use maven?
No
Because maven must told you that you are an old version from the dependency
Oh that why, i wouldnt work without any dependency manager like Maven or Gradle
Why?
1.7.10 ...
π
haha i understand you tho
Im 1.8 dev, but mainly trying to work only on 1.16 up projects
Yes that's horrible
Do you want to chat via dms then?
Wtf
odd
Yes I work on a 1.19.2 project and that's just beautiful
1.7.12
something i dont understand abt mc is the distribution of versions ppl stick to
So did have a solution for my problem ?
1.7.10, 1.8.8, 1.12.2, and then latest
and maybe 1.5.2 or 1.6.4 for modded players
1.7.9 is like this weird slimy grandma from the other side of the road that always stands there and stares into your windows at night but you cant do anything agsinst it because even police is afraid of her. nobody knows whats in her handbag
its the same as music, old songs are 70-80% more listened than newer bullshit
oh wait doesnt spigot 1.8 (like, 1.8, not 1.8.8) support 1.7.10 and 1.8 players?
Just Upgrade and there wont be any problem
like for some odd reason it had cross version support
My installation should be fine even though it's a local install for personal use. Based on the other things I've looked at, I doubt it's an issue with the configuration.
π Yes but that's unfortunatelly not an option
And 1.4.6 if youre leguernic
yeah it should be fine
just be nicer if you got to see the pretty data though
anyways, its a hikari issue it looks like
I canβt find any lunar client API does anyone know how to disable Lunar features using a plugin?
github one?
I found one on GitHub but it doesnβt work
Bukkit API for interacting with Lunar Client. Contribute to LunarClient/BukkitAPI development by creating an account on GitHub.
?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.
Yeah itβs not working on my server
did you restart, did you add the freelook disable
Iβll get the error and put it in a paste. In
As you read not working, is useless statements
hes getting the error for us
My function return false...
RegisteredServiceProvider<Economy> economy = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if(economy == null) this.economy = economy.getProvider();
return (this.economy != null);
}```
So its not registered the service
Check if your plugin is loaded
Yes when I using /pl the plugin is here
But I think that vault load after my plugin
How can I load it before my pl?
π₯² I don't understand. I'll try messing around with some more settings and maybe try out BoneCP as I have used it in the past. However, there shouldn't be a reason why hikari shouldn't work. Maybe I've just written it wrong? My code is far from perfect. ;3
add it to plugin.yml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
make it a depend
Thx you !
lol, well I don't use hikari due to issues like this
I get this message: https://pastebin.com/VidW0nnv
so I have just stuck with bonecp. I am not a fan of changing something when it isn't broken
Does BoneCP also have the leak detection?
Or is it a lot more barebones? No pun intended.
Seems an internal library issue, but i dont really have time to check what happens, if not i would helping
Guys... i cant find the spigot forum thread for buildtools with mojang mapping stuff ... anyone can help ?
It's also on every version release post since they were added
true
Well, the buildtools command is as follows. java -jar BuildTools.jar --rev <version> --remapped
You'll need to run that first before you can actually use it with maven.
'java.util.Collection org.jetbrains.idea.maven.server.MavenServerEmbedder.resolveProject(java.util.Collection, java.util.Collection, java.util.Collection, org.jetbrains.idea.maven.server.security.MavenToken)'
Yeah i needed a help for a friend. thank you
how can I fix this ?
Maven isssue?
y
How do i check is this is not null
i thought this was how i do it but it's showing errors
Does anyone know why I might be getting this error message: https://pastebin.com/VidW0nnv
Interesting, should people try to ask chatgpt instead of asking in forums?
This is java, not Javascript, they are totally sintacticall langs
Javascript? Also, it depends on what you are trying to do with it. Are you checking to see if they hit a block or an entity? Either way, you'll have to use the included getters to compare against.
block
Then use the included getter. rayTraceBlocks()#getHitBlock() Just check if that is null.
If you used to code on Javascript and want to use a Library/Api on Java, i would suggest learning Java, because Javascript is not the same language as java
Thank you
noxmil, i would straight suggest learning Java because its totally diff from Javascript
Jsut a recommendation, not wondering to be rude
You take it as you want, cuz many ppl think Java and Javascript are same lang or have the same sintaxis. But they are not even the same langs
do you have vault AND an economy plugin like essentials?
by using == instead of ===
there is no === operator in java
java is as much javascript as car is related to carpet
wait, i thought that was checking if the thing was null?
it's true. Both have an "if" statement, and both a car and a carpet are chattels. That's about all they have in common
==
if(something == null) // something is null
=== does not exist in java
= is to assign variables
== is to compare identity of objects
=== is a syntax error
isnt js be like if (!something)
im trying to check if it's not null
then do ```java
if(something != null) {
// something is NOT null
if (!(something == null)) hehe
they're pretty much the same to aladdin
thats what happens when coding at 1am
fuck you
bruh its in F again
alright, thanks
@sterile token were you able to "run code when a component is clicked on"?
Here's an overly complicated way to check whether sth is null
public static Boolean isNotNull(@Nullable Object anotherObject) {
if(!Objects.isNull(anotherObject)) {
return Logic.UNFALSE.getMyInvertedInvertedValue();
}
return !!!Logic.NOT_TRUE.getMyInvertedInvertedInvertedValue();
}
private enum Logic {
NOT_TRUE(!true),
UNFALSE(!!!false);
Boolean myInvertedValue;
Logic(boolean b) {
myInvertedValue = !b;
}
public Boolean getMyInvertedInvertedValue() {
return !myInvertedValue;
}
public boolean getMyInvertedInvertedInvertedValue() {
return !getMyInvertedInvertedValue();
}
}
oh no
Wtf
KIUCSS principle
Does the triple exclamation mark represent anything? Or wouldn't two of them just cancel out?
if (anything == null) { //do blablabla }
true == true
!true == false
!!true == !false == true
!!!true == !!false == !true == false
so no, triple exclamation is just another "not" operator
Ok, but is there a point to writing it like that?
none
if (t == null) { System.println("Null"); }
Then wtf. xD
.out.
unless you wanna contribute to terrible-plugin on github
Sorry
I was copying the answer that minion sent but in spanish to explain my friend what happening
the only uruguanian words I know are "kitchen roosted" and "wheel"
This is hilarious.
hahaha
yeah you should PR something lmao
I also got 3 PRs merged https://github.com/Jaimss/terrible-plugin/pulls?q=is%3Apr+is%3Aclosed+author%3Amfnalex
IIRC that crashes the server every now and then
The uncapitalized class name. Random kotlin integration. And the cherry on top.
This is top tier
lmao build failing is the best one
however last time I cloned it, it compiled just fine
how doyou add those things to oyur readmes
I never could understand then
π
I just know they insert it somwehre
i just grab it from a site somewhere
is there any posiblity to crash OS while using JAva?
Or would never be posible, its a question dont kill me
it's just a gif with some additional properties
no
well not really with std libs
"std libs"
and then the index.php takes in the text=asd parameter and turns it into whatever it likes, and returns a png
Just Google build succeeding png and add it
that's the "maven version abdge"
ive literally seen people code like this
@sterile token I got it from here https://shields.io/ / https://github.com/badges/shields
We serve fast and scalable informational images as badges
for GitHub, Travis CI, Jenkins, WordPress and many more services. Use them to
track the state of your projects, or for promotional purposes.
Have mercy please. Spamming sounds is the worst thing you could have done.
π π
Hello! Does anyone know if there is any way to remap plugin class from obfuscated to mojang-mapped?
From 1.17 we can develop under mojang-mapping and then compile it into obfustaced variant. But I have asked a question to myself, it there any revert way?
feeling like a dumbass trying to figure out why my simple fuckin php wont work
Still using php π
If you use the maven plugin then it'll convert it back to obfuscated. It's actually necessary to do this since you can't distribute remapped code.
its just so i can move files from my phone to my pc w/o having to connect w usb or use like a cloud service
<?php
if ($_SERVER['REQUEST_METHOD'] !== 'POST') return;
if (!isset($_FILES['uploaded_file'])) return;
$uploaded_file = $_FILES['uploaded_file'];
$upload_err = $uploaded_file['error'];
if ($upload_err != UPLOAD_ERR_OK) {
echo $upload_err;
}
$file_name = basename($uploaded_file['name']);
move_uploaded_file($uploaded_file['tmp_name'], "uploads/$file_name");``` except it doesnt fuckin work for this *one* file i need to move
I mean I have obfuscated code and want to retreive mojang-mapped from it.
It is possible by your opinion?
quck question:
Bukkit.getPluginManager().callEvent(new SomeEvent());
obviously this will throw an exception when some plugin cannot handle the event properly. But what about:
try {
// call event
} catch (Exception e) { }
will this also print the stacktrace, or not?
I gotta go in 5 minutes so I cannot check rn
if u eat up the exception i dont think so no
It wont
I am not sure whether this is the case because it's not me who throws the exception but the event handler
Pretty sure callevent doesn't throw any exceptions, just logs them
Because otherwise a lot of shit would break if a plugin errors
yeah that's waht I meant
so catching it wouldn't do anything
Stash time!
I'd check it out myself but I literally gotta go in 5 minutes or 10 D:
fuck birthdays
Uhh, to my knowledge, there isn't an automatic way that does this for individual projects. However, there are ways to convert. Usually if you want to get the mojang equivalent you'd have to use a site like screamingsandals and look up the class methods you want to convert.
why do people always have one birthday per year? can't it be one birthday every 5 years? we'd also all live much longer
answer, no
