#help-development
1 messages · Page 11 of 1
?paste
ah i see why not use else if?
dawg wtf why does it work now
uhm you could, but guard clases look nicer (Just in my opinion)
true
mm
seems you want a CompletableFuture
this is prob why i take ages to fix a simple code
no
yeah its a lot harder to debug 5 checks on one line
trust me it is
You want the future to complete and not block the main thread
no as in not another thing I need to figure out how to use
ha if you saw my other code lol
oh lol
You could do
FunctionalInterfaces if you like
might be slightly easier
it would be really easy uhm
i can make some type of markup
public void executeSomeFunction(String playerName,
CallbackFunction theFunction) {
Bukkit.getPlayer(playerName).sendMessage("lol u fuckin suck");
theFunction.onComplete();
}
CallbackFunction class
@FunctionalInterface
public interface CallbackFunction {
void onComplete();
}
This is used similarly to Runnables in a sense, here is how its used ->
executeSomeFunction("Burchard36", () -> {
Bukkit.broadcastMessage("Im so cool! I waited until executeSomeFunction() completed before runing!");
});
Essentially, FunctionInterfaces store a function (In this case onComplete()) and you are able to call said function whenever, whyever, whoever, wherever you want to
mm
wait what
And you can execute it using its method name (In this case onCompelte())
You can have arguments in said method, thats fine
u can create your own functional interface?
I had no clue that was allowed, how interesting
so for you, you could calll onComplete() in getFancyUpdateStatus's lambda
and onComplete will execute once you have the return value
Yep been a thing for a while
isn't it just an interface with one implementation?
yep in a sense
any special names for two implementations, or is that just an interface?
you could use Runnables instead of FunctionalInterfaces if you rly wanted to you get the same effect, runnable stores the method until start() is called
negative they can be named whatever
If you want its called Completable with a method called complete() you could
its really useful
While not async like CompletableFuture, its still nice
man i wish
brah i really want em to add firstclass functions cuz almost every lang has that now
can we get a cancel event for onquit?
I dont think you can cancel that
it was a joke
The #1 trick for increasing your player count. Server owners hate him!
lol
Nah guys lemme show you my idea
Just make an event
that forces a player to join
how hard is it, cmon you guys are slacking
Alternatively you could hire people to go to everyones house and make them join the server, then use the onquit.cancel
I mean you can also force them into a player inventory that constantly reopens 😏
though they might just alt f4
unfortunate
no event listener for computer power off either
just to be sure
thats actually a secksy idea
ill add that to my server as smth really unluckky
its not possible for PlayerRespawnEvent to be called if the player had not died?
true
it's not a new one by any means, it's been done at least since 1.7, the earliest I seen it
what are you trying to achieve
its complicated
RespawnEvent might be fired from the end portal
wtf
oh yah
wait seriously
pretty sure the portals under the hood just spawn the player in the world
thats actually dumb
No
well, the entity doesnt exist in the world technically
lemme test it out
so you cant just teleport directly, entity needs to be spawned first then teleported
For the time the player is viewing the end credits it doesn't exist in the world
How would you have done it?
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
at java.util.regex.Matcher.getTextLength(Matcher.java:1769) ~[?:?]
at java.util.regex.Matcher.reset(Matcher.java:415) ~[?:?]
at java.util.regex.Matcher.<init>(Matcher.java:252) ~[?:?]
at java.util.regex.Pattern.matcher(Pattern.java:1134) ~[?:?]
at com.squallz.cadiabees.utilities.ColorUtil.color(ColorUtil.java:19) ~[?:?]
at com.squallz.cadiabees.managers.configmanagers.GUIItemConfigManager.loadGUIItemConfig(GUIItemConfigManager.java:44) ~[?:?]
ConfigurationSection itemsSection = guiItemConfig.getConfigurationSection("gui-items");
ConfigurationSection mainGuiSection = itemsSection.getConfigurationSection("main-gui");
String guiName = mainGuiSection.getString("gui-name");
for(String itemLine: mainGuiSection.getKeys(false)) {
Material materialType = Material.getMaterial(mainGuiSection.getString("hive-information-item.type"));
int itemAmount = mainGuiSection.getInt("hive-information-item.amount");
String itemName = cadiaBees.colorUtil.color(mainGuiSection.getString("hive-information-item.name"));
line 44 is String itemName = cadiaBees.colorUtil.color(mainGuiSection.getString("hive-information-item.name"));
config
gui-items:
main-gui:
gui-name: '#c35bfb⋯#b65ff8「#a963f6C#9c67f3a#8f6af0d#826eedi#7572eba #6776e8H#5a7ae5i#4d7ee2v#4081e0e#3385dd」#2689da⋯'
items:
hive-information-item:
type: book
amount: 1
name: '&eHive Information'
would likely have player states with a stasis state
where players data is flashed into a map and player is despawned
then when respawned if that flashed data exists just apply to player
ig
its the same thing
ngl
cause hes still not alive or dead that method
Found the nocturnal
between midnight and 6am is exclusively work time
there's just nothing better than coding with the AC on and family asleep
This is just giving me the same problem
public String applyInternalPlaceholders(String initialMessage, @Nullable Player player) {
internalPlaceholderReplacements.clear();
internalPlaceholderReplacements.put("%TPS%", getFancyTps());
internalPlaceholderReplacements.put("%TPSHALT%", getFancyHaltTps());
internalPlaceholderReplacements.put("%SERVERHALTED%", fancyIsServerHalted()); //Player null because we don't care about bypass
internalPlaceholderReplacements.put("%PLAYERCOUNT%", String.valueOf(Bukkit.getOnlinePlayers().size()));
internalPlaceholderReplacements.put("%PLAYER%", player == null ? "None" : player.getName());
getFancyUpdateStatus(result -> {
internalPlaceholderReplacements.put("%UPDATESTATUS%", result);
});
return UtilManager.replaceFromMap(initialMessage, internalPlaceholderReplacements);
}```
cant return inside of it
you should just make a placeholder system honestly
its not my code
declare that map inside the meth- oh
not my code
expensiveLookup replaces and re-loops
so that if a placeholder returns another placeholder, both get parsed
cool
or just, yk, use minimessage 😏
Or, you know. String#replace(), which is chainable
:)
nahh
I do use string.replace but what if you use a supplier
what if the value isn't a constant but varies
you'd have to reparse the entire map
thats deep
🤡
How the hell if one meant to do return UtilManager.replaceFromMap(initialMessage, internalPlaceholderReplacements); in sync with the callback but not inside the lambda expression?
5, weak
I love how the only recommendation I got from that video was 8 mile rap battles
lol
no joke
man says "go" at the beginning xd
It's a vine. Do you expect it not to be scripted? ;p
lmao
Anyone know how https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/block/Block.java is actually coded? Trying to replicate it but be able to remove the drops. For some reason doesnt seem like theres a way to do that
Also you can remove drops with the api already
Right. BlockDropItemEvent
all of the api usually has Craft equivalents as well
let me double check
A Block is less a persistent block reference in the world more than it is just a data wrapper that calls upon methods from the World at a specific block position
if you need to check implementation use CraftBukkit versus Bukkit
Choco, can you give me any pointers for my problem i was having earlier?
I dunno what your problem was
So for this code
public String applyInternalPlaceholders(String initialMessage, @Nullable Player player) {
internalPlaceholderReplacements.clear();
internalPlaceholderReplacements.put("%TPS%", getFancyTps());
internalPlaceholderReplacements.put("%TPSHALT%", getFancyHaltTps());
internalPlaceholderReplacements.put("%SERVERHALTED%", fancyIsServerHalted()); //Player null because we don't care about bypass
internalPlaceholderReplacements.put("%PLAYERCOUNT%", String.valueOf(Bukkit.getOnlinePlayers().size()));
internalPlaceholderReplacements.put("%PLAYER%", player == null ? "None" : player.getName());
getFancyUpdateStatus(result -> {
internalPlaceholderReplacements.put("%UPDATESTATUS%", result);
});
return UtilManager.replaceFromMap(initialMessage, internalPlaceholderReplacements);
}```
at getfancyupdatestatus
it decides if the server needs an update
ConfigurationSection mainGuiSection = guiItemConfig.getConfigurationSection("gui-items.main-gui");
ConfigurationSection itemsSection = mainGuiSection.getConfigurationSection("items");
String guiName = mainGuiSection.getString("gui-name");
Bukkit.getLogger().info("Beginning loading");
for(String itemLine: itemsSection.getKeys(false)) {
Material materialType = Material.getMaterial(mainGuiSection.getString(itemsSection + itemLine + ".type"));
is this right??
this is a pita
idk try and see
i could just do it the long way but ppl recommended using variables lmao
for good reason..
I mean I cant figure it out soo
Either (a) do it once and cache it (which is more than likely what you should be doing. An update check every time placeholders are invoked is just kinda weird), or (b) you have to make that method return asynchronously. Use of CompletableFuture
how much of a learning curve is CompletableFutures?
Really not that bad once you wrap your head around them
hello the creativest of the spigot land
gimme plugin idea 🔫
id assume this mainGuiSection.getString(itemsSection + itemLine + ".type" would get me
gui-items:
main-gui:
gui-name: '#c35bfb⋯#b65ff8「#a963f6C#9c67f3a#8f6af0d#826eedi#7572eba #6776e8H#5a7ae5i#4d7ee2v#4081e0e#3385dd」#2689da⋯'
items:
hive-information-item:
type: book
``` my type
celebrity feet in minecraft
eyo what
yeah BlockDropItemEvent doesnt even get called with breakNaturally
sorry bro, you had a gun at me
xd
It doesn't, but it does for Player#breakBlock(Block)
no what
oh easy
you dont add configuration sections like that
someone earlier gave me an example that did 😐
?
Does anybody know how the minecraft auth works? im tryna figure it out so i can make a login system for my plugin, that actually uses what the minecraft launcher uses ig
why would this be needed
minecraft auth already handles it you don't need to touch auth
u need microsoft oauth
Ehm, yeah, that just kinda sounds like a bad idea. But if you want information on it, this is documented on wiki.vg
Let me guess to bypass chat reporting with offline mode
thats not the way to do it lol
when are they going to update finally iits been too long
To 1.19.1 you mean?
yea
They delayed it because of community feedback
i know lol
If minecraft stopped updating will the community be more satisfied
you don't think I was not mad about that, but for how little they cared about the feedback I'm surprised they even bothered taking a month
i hate microsoft for whaat they are doin with mc
minecraft made things complex lol
makes my life harder
mfw "how little they cared about feedback" but they literally took a whole month to fix issues from community feedback
They care about feedback ok
eyo finally saw choco agressive xd
You could just use online mode
That's not aggressive wat 
^
They even made the effort to say that they aint going to fix certain shit in bedrock
?
No need to auth the players yourself
:harold: emoji moment
Any proxy or server can do that for you
tbh not really much was changed other than the removal of profanity category which tbh doesn't do much. Then they added colors to the chat messages.
or i can just make life harder and auth myself
uhm no
They fixed numerous issues and exploits
^ they fixed an exploit that allows you to have the client sign something they didn't want to say
I don't really think that's listening to community feedback versus patching shitty implementation
This is why it was a snapshot/pre-release
With feedback from the communitu
That's what they're for
someone already linked
already sent (:
u think i read?
already linked
The only time you need that authentication scheme by the way is if you're making a custom launcher
Pretty much no other scenario
@compact haven got the previous part working now im stuck on...
List<String> mainItemLore = itemsSection.getStringList(itemLine + ".main-lore");
not getting
gui-items:
main-gui:
gui-name: '#c35bfb⋯#b65ff8「#a963f6C#9c67f3a#8f6af0d#826eedi#7572eba #6776e8H#5a7ae5i#4d7ee2v#4081e0e#3385dd」#2689da⋯'
items:
hive-information-item:
type: book
amount: 1
name: '&eHive Information'
main-lore:
- ''
- '&eThis hive currently has &7{BEE-AMOUNT} &ebees'
my lores
returning a blank list
Speaking of which now that I know the authentication is on wiki.vg I should get to making my custom client at some point
nice
In which case you should be using a popup window with the official login page
you know shit is bout to get real when it goes "Several people are typing"
maybe i want 2, maybe i dont
Well that's what the protocol documents anyways, so yeah. That's just oauth in a nutshell
no reason to be cryptic xD there are probably plenty of examples online if you wanna look
at applebees rn.... im gonna ask for the Bees.....
rip
No apples?
well google doesnt like me then
cause i cannot find much of any
I know of an open source console client you could probably check out
its in C# but thats basically just java with shittier conventions
i really want to use GUI kinda like lunar, but i also wanna use java. i can change my mind abt that tho
i found it
There are literally examples in most popular languages
i found that lol
if you want a nice GUI with java your best option is JavaFX otherwise use something like C# which I think personally is better for GUI's
no its probably just objectively better for gui's tbh
idk is lunar open source
Anyone got an idea for my issue...? it should be returning a stringlist but its not
syntax is valid
Does Lunar have a launcher? I thought it was a client
make the launcher in electron
system.out.print('Happy Birthday'){ cin>>n
Lunar's launcher isn't open source so who knows
They do have a legacy launcher forked, which is Java/Kotlin
hmmm ^ yep just saw xD
horrible gui though
how dare you suggest that, also electron is very insecure
you're the only insecure one
hmmm
But yeah, if you're going to write in Java, I'd advise JFX. If you want to do C# like Y2K suggested, WPF is great
no
u just don't know good tech when u see it
electron bad
Swing 
okay
Can I have a java project with some kotlin files mixed into it and still have it work fine?
but all jokes aside, I'm joking of course
no
or is that just a stupid idea
Banning
you only use electron if you really need it to be 2 platforms with a single codebase
yea kotlin and java work well together can just be a pain sometimes though
You should be fine but generally you want to stick to one language in a project
going to be migrating over to kotlin, just got a big project atm
^ as choco said i'd advise sticking too one language
I would totally learn kotlin but I would never learn kotlin just for spigot lol thats the only thing I've used java for
Yeah just don't use Kotlin :)
if you want to do android development and are interested in picking up kotlin go ahead and then you can write your spigot projects in it too other than that imo its not really worth the time or effort especially if your already profficent in java
no :) I love my kotlin
I've heard kotlin is better for android development 🤷♂️ so thats where if I were to use it android dev is where I would
but its pretty much preference kotlin doesn't do much other than incorperating some null stuff afaik
ok i need opinions...
main-lore:
- ''
- '&eThis hive currently has &7{BEE-AMOUNT} &ebees'
- '&eThis hive is currently level: &e{HIVE-LEVEL}'
upgrade-lore: #the below is information relating to what is displayed when a hive has upgrades available.
- ''
- '&eLevel: &7{NEXT-HIVE-LEVEL} &e - &a${NEXT-HIVE-COST}' #The variables will automatically increment and be assigned
- '&e- &7{NEXT-MAX-BEES} &eBee Slots' #{NEXT-MAX-BEES} is the INCREASE IN amount of bees you can have with the new hive level
- '&e- &7{NEXT-MAX-HONEY} &eHoney Storage' #{NEXT-MAX-HONEY} is the INCREASE IN amount of honey you can have with the new hive level
- '&e- &7{NEXT-REWARD-CHANCE} &eChance for a bee to return with a reward' #{NEXT-REWARD-CHANCE} is the INCREASE IN the chance for a bee to return with an item, defined in hive-rewards.yml
So, on my item I need to ALWAUYS include the main-lore, but the upgrade-lore will be duplicated and modified in place of the placeholders X amount of times
I separated them so it would make this easier, but its causing me issues. Id like to combine it just into "lore"
What would be the point of that
there isnt
Well Intellij has the same creators as Kotlin so expect decent integration
Intelliji epic
Kotlin has no language support on vscode lol
They want me to use there product hell no
Eh works for me has everything I need:P
VSC is great for web dev
I don't like intellij I spent like 4 hours configuring it to not be awful and still didn't like it
O:
The defaults are horrible imo but I'm coming from eclipse
Started with Eclipse too
I actually don't mind eclipse though the ui just feels old needs some work tbh
i mean i dont see them having it in malboge or brainfuck mfw
Be the change you want to see
^^^^^^^^^^^^^^^^^^^^
ey omw to write it for them
Oh is there rust
BRAH THEY CARE ABOUT KOTLIN, ily whoever made these docs
Damn they have rust I thought I found a job for imajin
i love rust
No rust the crab
how. dair. you
yes the cute little crab
When you writing the implementation in an ivm based language @quaint mantle
Its gonna take atleast a month before ivm is portable
Maybe at some point I could contribute but right now I'm too fucking stupid
whats ivm i wanted to ask
my first guess was intoxicated
Intoxicated whilst Vaccinating against Malaria
No
Malaria is still a problem in 3rd world countries imsjin doesn't wanna leave them behind
According to the latest World malaria report, there were 241 million cases of malaria in 2020
I forget where malaria is commin
africa
I'd have to look
so like he is programming a vehicle that makes men laugh?
C# is confusing as hell
man slaughter
LOL
mans laugh xD
Asia, Africa, South America in tropical area
ahahaa
yea thats what i m sayin, mans laughter
you are doing that rn
nono
manslaughter
slaughter
It's just java with shitty conventions
Not hard
yea thats what i m sayin as well
okay maybe not the code
also slower
a man who is happy with his life
visual studio is confusing as hell
Eeww
hell yea
True that
me and my homies use rider
By chance are you trolling back or non native english xD
Visual Studio
im actually confused now LOL
nah i m trollin
even tho i m not native english
oh okay xD Legit couldnt tell ngl
is it bad that my first lang is hindi and i hate it
- my english is better than my hindi
frick
nah english is good af when u start learnin hindi
tf is spore
Wow
^^
@noble lantern omw to make a love story movie named "Main class and you"
HAHA
i tried making it sound like those infomercials
like "Your colon and you"
shit
VS Moments
I HAVE NO IDEA what ANY of that MEANS
isnt that what programming is
its rly incomplete
still has a lot of work to do
system.out.print("My first program");
Generated an exception at line 4
Syntax error
Please help
sigh
@quaint mantle how useful is ivm actually
frolic werent you doing this in here a few weeks back
can yall stop asking about ivm
oofuz
that shits stressful
whats ivm
no
whats ivm tho
no
it's his own virtual machine (like what the jvm is)
Its still usable tho

proof or fraud
inventory API is rly nice however i need to add handling for the drag click event
you shesh your portfolio site is so good
WTFFFFF
oh
i read that as ||masturbating|| with harvested immature egg cells...
thx
one of the top 10 rappers from my list is named "vivian" xd
shit
same
ok so it turns out PlayerRespawnEvent is called when a player jumps in an end portal in the end and quits the end credits
is there a way to tell if the player is respawning from being dead or not
without caching dead players because im too lazy to do that
i honestly didnt, cause i found the weboage
that is messed up
ahh
webpage
wait i think i figured it out
i can check if the player's health is 0 or not
Yes
Cant it go under 0 depending on how hard the killing hit is..
i'll just check if its <= 0 then anyways
but i dont think the health can be negative
It depends on when you check
Because half the time you are checking before the damage is applied
If you are checking after, then what is the point of checking
@last ledge why arent the icons in the same positions :(
boxes are aligned just fine but not the icons
damn I just realised
leme fix it rq
why is setPlayerListName inconsistent
on one player's side it is updating correctly
but on the other it doesnt change
on one players side it looks like this
but on the other its this
it looks like when I use player#setPlayerListName, it's updating for everyone in the server except for the player whose tab list name is being changed
nevermind turns out i was calling it in a player respawn event, where the player is still technically dead
hi
https://cdn.discordapp.com/attachments/987742669172273242/1001345681258192916/unknown.png
my server kill when it start idk why
i think its my map but idk why the server crash
i create the map myself on worldpainter
Is there a way to change an Items NBT without it doing that cycle animation in the hotbar
Hey, I got a problem with skull items not stacking when added with PlayerInventory#addItem. Manually stacking works.
They got the same gameprofile set.
Is there an easy way to replace part of a string with something else if the part ur replacing has color...?
I know I could stripcolor but I need to keep the color.
String.replace?
dont think it picks up on colored stuff
Just replace the part without the color
?
You want to replace a part of a string without removing the color code right?
Then just don't remove the color code part?
the placeholders need to be replaced
they are colored so replace doesnt work on them
replace("{NEXT-MAX-BEES}", "lol") doesnt work?
thats want you want right?
unles im mixing it up with js
sometimes they might have butch but yah
typically colors dont matter
unless the configurator
does some cursed shit like
https://i.kawaii.sh/F-PbYGn.mp4
items:
special_sword:
id: Funky
name: Special Sword
description: The sword does stuff
material: DIAMOND_SWORD
components:
-
name: test
values:
data: 5
public class TestComponent {
public Integer data;
}
public class TestSystem extends ItemSystem<TestComponent> {
public TestSystem() {
super("test");
}
@Override
public void onCreate(ItemCreateEvent<TestComponent> event) {
event.getComponent().data++;
}
@Override
public void onInteract(ItemInteractEvent<TestComponent> event) {
var player = event.getBukkitEvent().getPlayer();
if (event.getComponent().data < 1) {
player.getInventory().remove(player.getInventory().getItemInMainHand());
player.sendMessage(Component.text("OH NO. Your ")
.append(event.getItemStack().displayName())
.append(Component.text(" broke :("))
.color(NamedTextColor.GRAY));
return;
}
player.sendMessage(event.getItemStack().displayName()
.append(Component.text(String.format(" has %s usages left!", --event.getComponent().data))
.color(NamedTextColor.GRAY)));
}
}
ecs api
rate the concept
i finished it
{NEXT&6-MAX&8-BEES}
the hell is a dangling metacharacter..
extraLoreLine.replaceAll("{NEXT-HIVE-LEVEL}", "lol");
is it just a highlight warning
you need todo \{\}
^
illegal escape character
i feel like
were not seeing the entire config section there
you do /iecs give special_sword to get the default item
wym effects and actions
r it just looks like a config to pdc storage container
ah right. When you mutate the component class it auto updates its data in NBT (not PDC)
im not talking about that
im talking about actual actions
eg right click
rn its just storing a variable in config
like how do i add actions via config like you have in the video
or is it only just variable storage rn
yeah even with Replaceall its still not replacing 🤔
https://safe.manu.moe/nQnyzaD0.mp4
how to fix addItem xD
I might just be stupid?
if(guiItem.hasExraLore()) {
ItemMeta currentGUIItemMeta = guiItem.getGuiItemStack().getItemMeta();
List<String> extraLore = guiItem.getGuiItemLoreExtra();
for(HiveLevel hiveLevels: cadiaBees.hiveLevelManager.getHiveLevels()) {
if(!hiveLevels.getHiveLevel().equals(hiveLevel) && hiveLevels.getHiveLevel() > hiveLevel) {
for(String extraLoreLine : extraLore) {
extraLoreLine.replaceAll("{NEXT-HIVE-LEVEL}", "lol");
}
}
}
currentGUIItemMeta.setLore(extraLore);
guiItem.getGuiItemStack().setItemMeta(currentGUIItemMeta);
}
if its wip then nvm, but for that part im confused
API is nice though
A1
as in how do you add functionality to an item? If an item has a component (eg "test") then the system corresponding to it will respond to events from the item
ItemStack shardItem = suit.getShard();
while (count-- > 0) {
player.getInventory().addItem(shardItem);
}
the config file
-
name: test
values:
data: 5
if you remove this, which is a component
So are your own component and actions creatable in config, or just hard code
that ysstem d oesn't run anymore
atm hard code, later on there will be some sort of yml scripting
ahh okay
its mostly for server owners who are doing stuff mostly custom anyway
yeah thats the part i was mainly asking about
and yeah its not really pdc, its direct nbt
serializes the component class to json and back and stuff like that
the stuff provided in values are the default parameters
onCreate event can modify all the stuff it wants 🤷♂️
eg entire pojo object into the item stack?
just set them stack size
ide be concerned for the meta data size of those items xD
Personal preferance i would much prefer a CLass<?> referance with its primitive value
Then initialize it with said primitive of said class
that method is just inefficient lol
Yea but the problem is still there. If you already have a stack and add a item, doesn't stack.
The only solution I come up is to write my own addItem method.
class reference wont persist after server reboot
yes it will
is getShard some static variable
its a data class with values filled from config.
ah. I mean nbt already stores everything in json though?
ofc its not an actual Class<?> its just a string referance to it
public static ItemStack getSkull(String base64EncodedString, String name, List<String> lore) {
final ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta meta = (SkullMeta) skull.getItemMeta();
assert meta != null;
GameProfile profile = new GameProfile(UUID.fromString("a6afa028-6087-472f-abc8-d89e96aed792"), null);
profile.getProperties().put("textures", new Property("textures", base64EncodedString));
Method setProfileMethod = null;
try {
setProfileMethod = meta.getClass().getDeclaredMethod("setProfile", GameProfile.class);
} catch (NoSuchMethodException | SecurityException ignored) {}
try {
// if available, we use setProfile(GameProfile) so that it sets both the profile field and the
// serialized profile field for us. If the serialized profile field isn't set
// ItemStack#isSimilar() and ItemStack#equals() throw an error.
if (setProfileMethod == null) {
Field profileField = meta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(meta, profile);
} else {
setProfileMethod.setAccessible(true);
setProfileMethod.invoke(meta, profile);
}
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException |
InvocationTargetException e1) {
e1.printStackTrace();
}
meta.setDisplayName(Utils.color(name));
meta.setLore(lore.stream().map(Utils::color).collect(Collectors.toList()));
skull.setItemMeta(meta);
return skull;
}
well its mianly for larger pojo objects
Thats basically im callign to create the item in the data class
stuff like ints and stuff its bitchin
it has to store the component in the item though. Since the system can modify the component for that item instance
dont see why its not stacking
but like if someones stupid and inserts a huuuuuge pojo class and doesnt transient certain fields debugging said item may be aids
yea feeling same xD
does anyone here know minimessage? i was wondering how to make a text with it since the docs are outdated
true
MiniMessage.build().parse()
what do i gotta do before that?
nah
basically you create a static constant named like MiniMessage in your main or somewhere else and build it directly.
example:
MiniMessage MINI_MESSAGE = MiniMessage
.builder()
.tags(TagResolver.builder()
.resolvers(
StandardTags.defaults()
)
.build())
.build();
with that yo ucan MINI_MESSAGE.deserialize("<red>My text is red</red>")
The docs are for 1.19
if you use 1.16, need to use version history
but its basically same with the exception to use parse instead
okay so i make a public static as Minimessage and then generate a getter and import that into another file to use it?
message = MiniMessage
.builder()
.tags(TagResolver.builder()
.resolvers(
StandardTags.defaults()
)
.build())
.build();```
wait so how would i send the message?
sender.sendMessage(EmbarkkCore.getMessage().deserialize("<rainbow>testing</rainbow>"));```
its possible yes
because i would have to recode half of my plugin
if yo uwant to have spigot support
So you would just write your own sendMessage method
as example:
public static void sendMessage(Player player, Component component) {
player.sendMessage(LegacyComponentSerializer.legacyAmpersand().serialize(component));
}
You could also be fancy
as example:
public static void sendMessage(Player player, Component component) {
if(check if its paper because every one uses paper) {
player.sendMessage(component)
}else {
player.sendMessage(LegacyComponentSerializer.legacyAmpersand().seriazize(component));
}
}
you need more information
Do you use 1.16?
a wait that doesn't matter if you include adventure yourself
mb
did you shade kyori inside?
i did not...
nice
thats your problem
yes
oops
yea but I think you added only for compileOnly
you can see it if you open your jar as zip archive
and check if you have net.kyori
i do have it
public static MiniMessage message;
// on enable:
message = MiniMessage
.builder()
.tags(TagResolver.builder()
.resolvers(
StandardTags.defaults()
)
.build())
.build();
// getter
public static MiniMessage getMessage() {
return message;
}```
4.11.0
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.11.0</version>
</dependency>```
I found something
here is aguide to add it to bukkit
because you only included the api
but the internal stuff don't exist because its spigot, so you need to add that
what i sent here
I don't know what im doing wrong with addItem.
Spigot uses ItemStack#isSimiliar for comparing
nope
I compared it with my item in hand
https://safe.manu.moe/BkaiHsHW.jpg
Could you try to use the same version also for platform?
what if i remove the spigot dependency and replace it with paper?
would that break anything? It probably would
which version you use?
if you don't use anything from paper
nop doesn't break anything
nah
it will mark a lot of methods as Deprecated tho
specifically anything involving text
they stopped with that on 1.19
try out implementation "net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT"
Is there a way to make a certain part of a message have a click event, then the other part not?
Yes
what is the checksum of credit cards? I'm asking for a project
As long as it's not a plugin lmfao
@wary wren ^^
okay xD
It's the final digit. You use the first 15 to determine that.
okay wait we try something else
okay lol
wait
i didn't add this to my pom
implementation "net.kyori:adventure-platform-bukkit:4.1.1"
a for maven its
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.11.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.1.1</version>
</dependency>
that was for gradle
mb
ye ik but i never added it to my pom either way
let me try it now
XD
mhm
okay
this.adventure.sender(Bukkit.getConsoleSender()).sendMessage(Component.text("Hey"));
does that work?
@quaint mantle
nope didn't work
yes
why do you have to cast it?
idk
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Location.html#distance(org.bukkit.Location)
Spigot alerts me this method is costly
What would be a non costly way to detect the distance between 2 locations then? distanceSquared?
its always costly
I need to efficiently calculate the location between two points every other few ticks is why i dont want to use it
Well yes, but theres likely a way that isnt as costly
Because we calculating the difference between two vectors
for that we need a matrix
thats the reason
Couldnt you just just subtract the z and z from each others locations?
that would be possible
are you sure you use the right thing?
this.adventure = BukkitAudiences.create(this);
this.adventure.sender(Bukkit.getConsoleSender()).sendMessage(Component.text("Hey"));```
and you get a ide error right?
nope
just when i reload the plugin
so said to me that you cast something
What would be the correct way to do it? Subtract the target vector from current location vector, or visa versa
how precise do you need it?
just within one block
1-2 doesnt need to be precise on a float
just precise on int
public static double distance(Location first, Location second) {
double x = first.getX() - second.getX();
double y = first.getY() - second.getY();
double z = first.getZ() - second.getZ();
return Math.sqrt(x * x + y * y + z * z);
}
Isnt it Component.textOf ?
idfk @wary wren is the boss here
I see thank you, i assume this would be safe to call on the main thread say, every 4 ticks?
The actually distances wont ever be over 50-60
as rn im async calling distance() and throwing results back to main thread
which is rly excessive
give me a second
I used something before where i check it every tick
let me check what i have used there
kk ty!
Wonder if there's some bit shifting hack for this
Yeah where is my Quake 2 algorithm
I checked and I can say from my experience calling that every tick with 50+ players is fine
That was on 1.8.8 too
what about per 50 players
as this is for npc pathfinding
so i need to calculate distance efficiently quickly to detect if the NPC is around a target range
for npc you can use it anyway async
Yes but the overhead of creating the new future is meh
I wanted to avoid it
just remove y
if you don't need it
kk ill take a look into it ty :))
hahaha
perfect
in the past using the old method, the block placing wasnt always instant due to the delay in checks
now he places block instantly at the feet 🙂
if i have like 20 projects that are interdependent to each other and i want commands for those projects, do i create another project that manages all commands, or do i add the commands in those projects?
So penguinz0 is now chasing people down with tnt?
its actually supposed to yell leeroy jenkins, but i did that sound for uhhh
"another test"
why is there 20 interconnected projects?
why is there a bomb in my bag?
exactly
that question is irrelevant
anyways its not 20 different projects
its like 3
sorry lol
Just saying it sounds like a design hindering/annoyance
Why not merge some of these together? Or create a core API provider, and then build plugins on top of that?
Like creating another project only to handle commands? Why are you creating so many differents projects for this stuff xD?
ahh
in that case, i would just have your "core" commands in your plugin
And your addon plugins could hook in sub arguments to said command
it would just be stuff your gonna constantly be reusing
so like util classes, command handler
etc
Its mainly there just so you dont gotta rewrite your code in each plugin ever time, just a convieniece thing
yep core libs would make it so all plugins have the utils class
And ofc your plugin can have its won set of utils too as it likely will need them
the core api utils would just have stuff like string transforming, maybe some meta data handling, just stuff like that
epic
how would I get a player's location in a different world? currently, when I teleport a player to a different world, I can only teleport them to specific coordinates, instead of their last positionjava Location loc = Bukkit.getWorld("ocm").getLastLocationOfPlayer(p); p.teleport(loc); // something like this
where does spigot store the data of players?
like inventory, location, etc
oh nvm
same question tbh
Attributes
@noble lantern did the walking strategy work?
hm?
You need to store data yourself
but every world has the player's XYZ data, right?
okay
lets say
you want to store the player location when they tp
so you can tp them back
like a back command
so you have a ConcurrentHashMap
no, just teleporting between worlds
player teleports to different world > later teleport them back to their original position in world1
Same principle
Make a OnPlayerWorldChange event listener
get a ConcurrentHashMap
with UUID Loc keys values
save when they change world
when they go back load from the hashmap
Pathfinder
i'm so confused, I know how to store stuff, why would I need to save it myself when it already exists in world/playerdata/UUID.dat?
player plays in world1, player teleports to world2, does something, and later teleports back to world1 with their last location
it does thooooo
files update either periodically
why would you need a ConcurrentHashMap
or on player quit
also
what method is .getLastLocationOfPlayer
that doesn't exist
xd
that's why I'm telling you
to do what I say
You need to save the player data
into a map in an event
when they change world
and when they type a command
they get back to that location
can I just save it to a file, just so it saves when I reload/restart the server?
but dont use a concurrent hash map
yes you can save it to a file
but working with a map while the server is onlinw
is way better
the idea is that
while the player is online you interact with the map
and if they go offline you save their data into the file
and then when they join you load the data from the file into the map
if that makes sense
think of it as when you want a drink
you place a bottle near yourself
so when you want to drink you don't have to walk to kitchen for water
alr, does the plugin's onDisable fire when I stop/reload?
just so I can save the map to a json file, and then onEnable just load it back
I'm not sure
no you wouldn't use onEnable
you would use an event when player joins
It's useless to load data from player that isn't on the server to the map
i know, just save the whole Map to .json, and then onEnable just load the Map back, and when the player joins just get the location from the Map
Heal if player not near
noo
or is it just easier to load somefolder/UUID.json?
listen
make a new class for the listeners
both onPlayerChangeWorld
and onPlayerJoin
and onPlayerQuit
then
so like onPlayerJoin = load json file, onPlayerChangeWorld = teleport with location+save json file, onPlayerQuit = save json file?
onPlayerChangeWorld -> save the player uuid and location to hashmap
onPlayerQuit -> save the UUID : location pair of the player who left to json
onPlayerJoin -> check if the player has a file with their uuid if yes load it into the map
something like that
okay
Is there a plugin where you can add when join a server, you will automatically be in a lobby of some sort, then type the password of the users account then you'll be tped where you last left off?
Sorry if im interrupting something
does anyone know how do I check if player is near
Sorry, but I got a rather short question. I made an object called Homes for some reason though, H2 won't let me insert it into the db, even though that column is an object. I tried finding it on the internet, but didn't seem to find anything specific. Do I have to add a Serializable interface to my class?
getNearbyEntities
thanks
wrong channel
I'll get on pc and try to show u
nah we already finished, I did it this way: java @EventHandler public void onJoin(PlayerJoinEvent e) { Player plr = e.getPlayer(); plr.teleport(Bukkit.getWorld("something"), 0, 0, 0); }and then teleport them to a different world when they /login or something
thats because your object doesnt implement Serializable yes
Thank you.
okay, thanks
could've just http://tryitands.ee
exactly
also if you have some sort of /teleport or /hub or something, make sure to disable the usage before the user actually logs in
@opaque sinew **
let him figure this out himself
we dont want to help a cracked server
true, I had to switch to an offline server because of geyser (JE+BE crossplay)
mojang does
I don't think you telling them how to do something
will make bill gates come to your house
and break your arm
yes
spigot is subject to mojang
ill keep this in mind
i honestly hate cracked servers because I actually bought minecraft, but a lot of my friends still have tlauncher
same\
You're not supporting it
i was thinking about turning off tlauncher due to people able to access account simply by changing their user
and?
Some people just want to play the game
The fact is the game costs 20$ and for someone that is a lot of money
doesnt matter
especially when target audience of Minecraft is kids
i dont steal clothes just because i cant afford them
Well you can stop being arrogant about people who cannot afford it
?
It's not your job to be angry about someone who cracks it
If you want to
get hired by mojang
that's literally piracy
Ah yes
thats nothing opinion based
So you are the guardian of the righteous
i would love to only allow bought JE and xbox accounts on BE, but that just isn't possible
I'm sure jeb_ won't be able to buy bread because of someone pirating Minecraft
how old are you?
I'd gladly ask the same of you
You're not affiliated with Mojang in any way
so why does it matter to you
so either you are ridiculously young or didnt went to school
Talk about school and fuck up grammar
lmao
lmao
go steal some clothes you cant afford
My bad
Mister Lucifer
How cringe is it naming yourself that on 3 platforms
Surely you don't wake up every day feeling like anime mc
alright at this point i go with the first
same
good to know that you prove yourself to be ridiculously young
ok
yes but how exactly can I check if player is not near
Im working on a new one rn actually
loop over the collection returned by getNearbyEntites and check if its a player - if every entity returns false on this there is no player in near

