#help-development
1 messages · Page 1485 of 1
Anyways new ItemStack[]{one} <-- is the correct syntax for declaring an array
how can I set position in inventory
ok so for some reason there is no way to get rid of the sound?
dope
zzzZ
i only want those black potions particles
is spigot down again?
yep
bruh
can someone help?
The method setOwner(String) from the type SkullMeta is deprecated
Note: Play an effect is not the same as spawn a particle
Then spawn the particle
do I need to get verified to get support?
nope ;p
which version?
okay so tell me how i spawn a ption particl with color ?
you may have to use packets for this :/
1.12.2
to avoid the sound
yes i think to
prolly mess with the speed values
and that
I am getting ignored ;-;
Alright so I appear to have just fixed this issue by removing a passenger on the armor stand (It was a dropped item [Barrier Block])
Is there any way I can still get it to teleport upwards with that dropped item as a passenger on the armor stand
sorry, I haven't seen your message ;p
What's your question?
I made an Inventory and added items, now I want to set position in inventory
Inventory gui = Bukkit.createInventory(p, 27, color("&8&lGUI"));
ItemStack one = new ItemStack(Material.FEATHER);
ItemStack[] menu_items = {one};
gui.setContents(menu_items);
ItemStack one = new ItemStack(Material.FEATHER);
int slot = 3;
gui.setItem(slot, one);
basically sets the item at slot 3
needs to be an offlineplayer in paramter of setOwningPlayer
The method setOwningPlayer(OfflinePlayer) in the type SkullMeta is not applicable for the arguments (String)
yeah, needs to be an offlineplayer object
wait
If you want to set the item in a specific index use the Inventory#setItem(int, ItemStack) method
you may be able to get away with this
but i need to get one form list and assign it
is the list a list of usernames? or uuid?
don't work
usernames
wait nevermind it got removed hm
then use packets
Bukkit.getOfflinePlayer(UUID) or Bukkit.getOfflinePlayer(nickname) (deprecated)
you should totally do UUIDs, which version are you developing for?
1.12.2
@quaint mantle try this:
public ItemComposer(String url) {
ItemStack skull = new ItemStack(XMaterial.PLAYER_HEAD.parseMaterial(), 1, (short) 3);
if (url == null || url.isEmpty()) {
this.item = skull;
return;
}
if (!url.startsWith("http://textures.minecraft.net/texture/"))
url = "http://textures.minecraft.net/texture/" + url;
try {
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
GameProfile profile = new GameProfile(UUID.nameUUIDFromBytes(url.getBytes()), null);
profile.getProperties().put("textures", new Property("textures",
new String(Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes()))));
Field profileField = skullMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(skullMeta, profile);
skull.setItemMeta(skullMeta);
} catch (Exception e) {
e.printStackTrace();
}
this.item = skull;
}
I'm trying to get first person from the list of admins and assign him this head in gui
no, its down
Check, thanks!
its up
yep just noticed
its up again oaskdoask
Now I'm here, curious what you guy's opinions are on plugin metrics, in general, not the Plugin mcstats plugin etc
oh, i dont know if Bukkit.getOfflinePlayer(nickname) is still supported in 1.12
but try this to convert them to players (assuming they're online)
staffs.stream().map(Bukkit.getServer()::getPlayer).collect(Collectors.toList());
i have a list of names
I've worked on a metrics implementation over the weekend, curious what you guys would say for what to collect etc
wait
https://github.com/Pace1337/StaffChat/commit/712f2db01298cd7f5e054a8b58b43350fb4739de Is this alright? I was mid checking that on spigot but it went down now
By is this alright I mean would it work
this works but it just isn't showing that it works: metaSkull.setOwner(staffs.get(i));
you can still use what I sent and then it would still work and the error is then removed?
can you hover over it and tell what the error message is
it's just warning: The method setOwner(String) from the type SkullMeta is deprecated
@quaint mantle try setting by the texture
.
it works dont worry
ok so either use what I sent, which is not deprecated. or add @SuppressWarnings("deprecated") to your method
Is there any way to teleport an armorstand with a passenger,
eg.
ArmorStand armor = (ArmorStand) Bukkit.getWorld(p.getWorld().getName()).spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
ItemStack item = new ItemStack(Material.DIAMOND, 1);
Entity en = p.getWorld().dropItem(LocationB, item);
armor.addPassenger(en);
armor.Teleport(LocationC) // Not Working
//The above however works without the armor stands passenger
thanks for help
not with a passenger
have to set velocity for that
Ah alright, thank you
PacketPlayOutWorldParticles particles = new PacketPlayOutWorldParticles(Particles.EFFECT,true,x+0.5,loc.getY(),z+0.5,255,0,0,0,0);
((CraftPlayer)player).getHandle().playerConnection.sendPacket(particles);```
well still have white particle
any color
double register a listener ?
You're looking to spawn particles with nms? I might have just the thing
yep
Give me a sec to find the file 😄
because i can't change color particle with bukkit
This one should help you
I use it to spawn coloured particles clientside
huuu not really
How so?
public void registerListener(Listener l, Plugin p) {
Bukkit.getPluginManager().registerEvents(l, p);
}
// registerListener(new InventoryClickEvent(), this);
```A bit cleaner. Also I might be wrong on the instance of listener.
Since it does spawn coloured particles, which you were looking for right?
bro, use:
PluginManager manager = Bukkit.getPluginManager();
manager.registerEvents();
avoid repeated code.
i'm just trying to spawn a colored particle and don't even see in the code where it create the particlePacket
Im on mobile, so I'll search for it but it might take a sec
It does help to look in the right place, this is the file you need https://www.github.com/TheDutchMC/HaroTorch/tree/v2/src%2Fmain%2Fjava%2Fnl%2Fthedutchmc%2Fharotorch%2Fcommands%2FtorchSubCmds%2FHighlightAreaOfEffectExecutor.java
Sorry 😄
Keep in mind that I use reflection, so it might look a little different but the idea is the same
huu still don't understand
You want the getParticlePacket method
Ill be able to help you more once I'm back at the desk 😄
i don't understand all your input
Which ones have you got questions about?
I tried to model it at Bukkits spawnParticle
oX... extra & DustOption
oX is offset X
i don't understand what difference with the NMS classic method
extra I dont even know what it does, look at the bukkit docs for that, under World#spawnParticle or Bukkit#spawnParticle, not sure which
Hi everyone, does anyone of you know if there is somesort of "pre-made" jenkins ci file to compile maven plugins ?
DustOptions, check spigot docs for that
nop sry the question is how do you put DustOption inside a nms packet
and how can it apply on potion particle
and not redstone
If you're using dust options... just use the world.spawnParticle method.
Keep a reference to the BukkitRunnable
I get the nms particle data in the method particleDataToNms
Then just call Runnable#run
tell me how do you spanw a potion particle effect with color so ?
Cannot do that when you want to have the particles only on 1 client, like me, and maybe Zelytra
You might wanna show us how you did it
better if i can send it to the player directly
That's what I do yup
Sure and what is runnable declared to?
And that’s in onEnable?
It won’t run until the server is done loading
so can you not just do runnable.runTaskTimer(this, 0, 20) again?
Might throw IllegalStateException
If the task is already scheduled that is
PacketPlayOutWorldParticles particles = new PacketPlayOutWorldParticles(Particles.EFFECT,true,x+0.5,loc.getY(),z+0.5,255,0,0,0,0);
((CraftPlayer)player).getHandle().playerConnection.sendPacket(particles);```
haaaaaaaaaaaaaaaaaaaa
but i wanna send block particle
so 0 everywhere and still send white particle
0.0 ?
Hmm Idr exactly how the CraftBukkitScheduler handles Runnable identities
But I know it’s only safe to schedule a BukkitRunnable once
Yeah it won’t repeat
package index
?
and which one ?
can't find any way to spawn colored potion particle
POTION
not redstone
if you want repeat you have to use that
I dont think DustOptions works for potion?
on the javadocs
it said its for redstone specific
particles
Options which can be applied to redstone dust particles - a particle color and size.
runTaskTimer 
morice a solution would be to create a Runnable and delegate that one instead
is GSON (https://github.com/google/gson/blob/master/README.md) worth it or should i just use yml files and sql?
Lucas what is it for?
I forgot about the delay
Gson is amazing, and included in spigot. But whats your end goal?
dunno just found it and i was wondering if its worth it
i guess to storage data
like a buffer
For data storage id use sqllite
oh what
Just a quick question, how long does it take for this to update? https://api.spigotmc.org/legacy/update.php?resource=92585 My plugin is already at 1.0 but it still shows 0,9
it says 1.0 for me
same
huh
lol
For a buffer, depending on how long you're intending to store it for, I'd keep it in memory
Really weird
Am i right in saying that a HashMap can return null, but won't throw an exception if the key doesn't exist
Even if I refresh
but json (or gson) are like yml files right?
Yep. Hasmap returns null for a non-existent key
does it have any pro or cons i should know?
thank you
No, gson is for json, snakeyaml is for yaml. I use both
do ctrl+shift+r maybe its just cached
Both are included in spigot
Still same
wait snakeyaml is the yml file api to add docs and shit?
Okay so basically you’d have this instead:
class MainPluginClass is extends JavaPlugin {
Runnable runnable = new Runnable() {
@Override public void run() {
//put the stuff that was in the BukkitRunnable run method
}
};
public Runnable getRunnable() {
return runnable;
}
@Override public void onEnable() {
this.getServer().getScheduler().runTaskTimer(this,runnable,0,20);
}
}```
@last temple I believe that should fix it, key here is to use the BukkitScheduler
Also that code is crappy so don’t copy it literally
Snakeyaml is the library to interact with Yaml files, not sure which docs you mean but if its a yaml file, snakeyaml can do it.
Gson is for json, and the gson team have explicitly noted it will never support yaml, as its not ment for it.
Personally I use both in conjunction. I parse a config with snakeyaml, convert it to and from json with gson, then validate it with classvalidator and then use it
I like yaml because it’s practically supports json also since it’s a superset of json
how to close inventory?
ah sounds intereseting, i will look into both
thank you
p.closeinventory
Player#closeInventory
thanks
declaration: package: org.bukkit.entity, interface: HumanEntity
I believe it’s a HumanEntity method but yeah 🤡
If you want the classvalidator, dev.array21:classvalidator:1.0.0 on mavencentral
but doesnt it just get passed down anyways
Oh yeah right there
wait how do you have discord helper tag? i want one
Yeah true true
borrow me your tag so i feel important for once in my life
lol
Uh but yeah use Runnable instead of BukkitRunnable and then use BukkitScheduler @last temple
right click and replace with lamba
() ->
you can use lambda
() -> { }
you could store the schedualer as a BukkitTask
then call cancel on that
loc.getWorld().spawnParticle(Particle.SPELL_MOB, loc, 0, dot.getColor().getRed()/255D, dot.getColor().getGreen()/255D, dot.getColor().getBlue()/255D, 1);
huu it really work ?
thats what the divide is for
okay thx
not for my use
wait how did you do that
thats insane ahahhah
Magic lol
show me :c
Nah JK I convert a string to an image then convert the pixels to particles
it to warn a player of a toxic area
haah thats kinda cool
just assign it to some variable
Works with any font to
as long as its installed lol
No
if i change the amount did it create problem ?
like when you schedule the task
this.getServer().getScheduler().runTaskTimer(this,runnable,0,20); this part
shouldn't
is it a private oroyect?
Ummm kinda both
cani have the code :D
Thats an interesting one Yapper. You're converting a String -> Image -> Particles? I'm guessing spawning the particles based on XY positions in the image?
No lol. Plus its not directional. Never got that far. So only shows in 1 direction.
Yeap
Thats pretty interesting, definitely looking into that one soon
Uggg fuck that damn bot.
loc.getWorld().spawnParticle(Particle.SPELL_MOB, new Location(loc.getWorld(), x + 0.5, loc.getY(), z + 0.5), 2, 0, 0, 0, 1);
If I may ask, what library are you using for Stirng -> image conversion? Or is it handmade code?
aha ight nice plugin tho
gl
Would be a fun project to make a library for this tbh
code. I use the 2d graphics in java.
Damn! that's sick!
Its been done alot. I just made my own
Damn, thats pretty impressive.
uhh guys for some reason if i export my plugin plugin.yml suddenly dissapears in the jar file
Look up "particle effect"
First time I've seen it done with particles--Not that i've searched much but, interesting nontheless
Try try just using the code I sent and only adjusting the ints for red green and blue.
but there is not enough particle
That's going to be some heavy maths to get that to work for every degree 🤔
Definitely putting that on my TODO list
I think he used a 2d lib and then translated the coords
public github or lib?
yeah I hate math lol and it would be a bitch to do z'ed direction
Yeah same story here, though it'd be fun to do for my final project for maths I think 🤔
is there a way to keep inventory but only for potion effects?
Hello, I would like to update my scoreboard every second with a runnable but I don't know what to put in it. Can you help me please ?
https://hastebin.com/zonelobunu.java
damn nice job
Its a gif so its slow AF
i can feel the frames
Use the player death event
ah try speed it up
Cant with how its coded... I would have to recode it
how do i get the player from that tho, is it event.getEntity()?
couldn't you do it in a runnable
yeah
thats the issue
and check if entity is instanceof Player
? how so
?paste
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
Your limited by 50ms per frame aka 1 tick
maybe im missing something but couldn't you turn down the period?
can some one explain how send a pastebin into discord?
copy the link
ok
Its already set to do 1 frame per tick which is the fastest a bukkitrunnable can go. I would have to make my own runnable to make it go faster which would require me recoding it
i am getting this error Not annotated parameter overrides @NotNull parameter with this code https://paste.md-5.net/kawopemowe.java#
could someone help me? for some reason this doesn't work:
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
PersistentDataContainer p = player.getPersistentDataContainer();
NamespacedKey key = new NamespacedKey(Origins.getPlugin(), "Origin");
if (p.has(key, PersistentDataType.STRING)) {
switch (p.get(key, PersistentDataType.STRING)) {
case "Burger":
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(24);
player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 1000000, 9, false, false));
}
}
}
``` i don't get any errors, it just doesnt work
can some one help me?
What line
13
that cause my hole get command to not work
Can you add breakpoints?
I need to broadcast a message, however i need to dynamically exclude one player, is this possible?
wdym?
Because “does not work” doesn’t give us enough info
like sysouts at certain points to check if they reach it?
Yes
ok
is it possible to send a message from another player?
wdym
as in as if they were typing it in the chat box
or do you just have to do the <name> hello
manually
you could set a command that takes a player name to send with
and then just send it with this
all of the breakpoints (one when event is called, one when first if statement is passed, and one when first case is passed) are reached
So the player has the PDC value, and the switch statement executes
What is not working then?
uh you cant
the potion effect part
you could use System.currentMillis (thats what I did)
then check the time between each frame to send
does some one now have a idea why this https://paste.md-5.net/kawopemowe.java# gives me a Not annotated parameter overrides @NotNull parameter at line 13?
Again though would require a recode lol
this:
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(24);
player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 1000000, 9, false, false));
Its an old project I never finished
still cool concept
just fun to play with
One of the variables in the method you're implementing is annotated @urban grotto and in your code it isn't.
It's purely indicative and won't have effect on code function but IntelliJ should also show you how to auto fix it.
Hmmm seems alright to me
?
what can I help you
nothing
I'm real tony stark
yeah it works elsewhere in the code
Hey there, is it a right way to get a skull item with a specific skin in 1.8 api? i tried but it didn't work
private ItemStack getPlayerHeadItem(Player player, int count, String title) {
ItemStack item = new ItemStack(Material.SKULL_ITEM, count);
SkullMeta meta = (SkullMeta) item.getItemMeta();
meta.setOwner(player.getName());
meta.setDisplayName(Utils.colorify(title));
item.setItemMeta(meta);
return item;
}
it works in the playerjoin event
are you 100% sure the potion effect is not there
yep
is there a way to schedule events? maybe i could schedule it to occur a couple ticks later
everything is right
can you send error message
Wait I know the issue, that event probably fires before you can add a potion effect
Delay it by a tick or two
no error, it just doesn't change the skin and shows the default skeleton skull
k
than no one is premium in this nickname
yeah like this your plugin instance.getServer().getScheduler().scheduleSyncDelayedTask(BWHandler.getInstance(), new Runnable() { @Override public void run() { // Your code here } }, 60L);
60L are 60 ticks so 3 seconds
60L 60 SECONDS
there is
YAY
anytime after the respawn event is fine
IT WORKS POG
Ty!!!!
i dont thinks for me it executes after 3 second
yeah you are right 3 seconds I just kidding
@paper viper
thats so cool
is this your plugin that converts pictures and gifs?
yeah
really nice
I would have to change alot of shit to make it work better today cause when I originally coded it, I wasn't carrying about performance xD
Literally just spams a shit ton of particles
yw
does someone knows a good tutorial on how to get customHeads from minecraft-heads without theire database or should i use the data base?
Could just use base64
Or minecraft-heads api lol
ok i just use the api(database)
What does that even mean?
Why would you not use the API?
It's a literal web API doesn't get easier than that
the database(how i learnd it) is just a set of data that i can acces with pw and account name so my data is secure but for this i think its just to organize the heads
What????
I'm lost
The web API makes database backend calls for you - you're never connecting to the database
Anyone experienced with https://api.spigotmc.org/legacy/update.php?
It's as secure as can be and you don't even need a key
sry they even dont use a db its just calld database
??? you're so confusing
Explain why you'd rather not make calls to their web api to get heads
but to explain it to you if you have a website where someone can login and register an account you need to save their password and name somewhere where it can not be accesd easily
Databases do a good job of that? Not to mention, passwords aren't stored as plain text they're hashed
I don't understand how that relates to you calling a web api
i know mdn5
because the minecraft-heads api does not need you to sign in
sry i thought they use a database on the server where all heads are saved beacause there api name contains database
They do use a database on the server where all heads are saved
Why wouldn't they and why is that a bad thing
ok hi guys, does anyone get what value does this want? can i give it a list of itemstacks?
Hopefully salted as well
a list is a collection so yes
mhm
oh okay
there must be miss understanding the they probaly use a database on there server
ty
They definitely use a database - what's wrong with that?
@deft geode nothing i knwo your right i just miss understood something
What did you misunderstand? I can probably explain it
can we talk about it maybe because typing is really hard
is there a way to run something every x ticks?
yeah, use a scheduler
lord
Its fun though because I made it all configurable.
Does anyone know what getServerName return to
The name of the server
Javadocs exist
I mean like
Is there a name for a server lol
Bungee?
What getServerName method is this?
do you mean Server.getName
it returns a string of the server name
player.getserver.getservername
aKa the implementation
Same thing
ye
is it from server properties or smt
as if I didnt knew that, I am just confused where do we input the server name
No it's the implementation name
aka spigot, bukkit, paper
yeah like this ```
private BukkitRunnable runnable;
runnable = new BukkitRunnable() {
@Override
public void run() {
// your code
}
//and than start it with
runnable.runTaskTimer(your plugin, 0/delay between/, 20/how long you want the period to be/);
ye
Let me just zoom in further
@quaint mantle where did you go?
I'm attempting to implement a custom Entity but the entity stops moving after a moment of holding down a movement button. 1.16.5
https://sourceb.in/pFKRMC5MLo
https://cdn.discordapp.com/attachments/403990935534567426/850782648808243270/Base_Profile_2021.06.05_-_18.04.33.01.mp4 (to see whats happening)
Kotlin is far superior
A lot more pragmatic
Not massively different. ```java
public class Main extends JavaPlugin implements Listener {
@Override
public void onEnable() {
this.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {}
}```
class Main : JavaPlugin(), Listener {
override fun onEnable() {
this.pluginManager.registerEvents(this, this)
}
@EventHandler
fun AsyncPlayerChatEvent.onChat() {
// this is an extension function. P.S these are amazing
if(this.message.content.equals("poo", ignoreCase = true)) isCancelled = true else isCancelled = false
}
}```
looks like a lot of fun
Anyways if anyone has any ideas for #help-development message please ping me, been trying to work this out for a few days now, looking into EntityHorseAbstract & EntityPig has not helped much
For events I rather create a:
fun Event.register(priority: EventPriority = EventPriority.NORMAL, ignoreCancelled: Boolean = false, consumer: Event.() -> Unit) {
// Do stuff to register them
}
Realistically you'd just create a new EventBus system that is wrapped nicely over Spigots
Is worth learning it
anyone know how to use the minecraft-heads api with bukkit?
Any benefits for using packets and nms to create scoreboards?
Packets & NMS tends to be messy avoid it where possible
i dont know exactly but as far as i know nms is not really compatable with viaversion
if you use it
I get it that it’s pain in the ass but why do developers use it? Like FeatherBoard
so does anyone has an idea or answer to my question
Do you know how apis work?
yeah sort of
i mean i know that i probaly can get the heads from there api site with every name but i dont know how
Learn how to use apis, and your question will be answered by yourself
ok i geus i have to do it that way ty
Advice: do it async, you wouldn't want to stop your whole server when retrieving info
ok
If I do java if (args[0].equalsIgnoreCase("test") && args[1].equalsIgnoreCase("no") || args[1].equalsIgnoreCase("yes")) I would get a out of range correct?
bungeecord's chatcolor has support for those
tho hex will only be available in TextComponents afaik
i am using the bungee cord one atm cause i am using textComponents
but you need to use bungee ChatColor.of
ah ok
the legacy strings allow for hex colours ?
yes
would it be like this?
net.md_5.bungee.api.ChatColor.of("#c999ff")
That works
ok thanks
In regards to this; I also have another problem where if I set mot it moves but entity rotation doesn't IE (if camera turns right entity doesnt follow that movement)
Is there any classes I can look into that arent EntityHorseAbstract to see what my problem could be?
Odd the args are there and correct caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1 java if (args.length > 0) { #this line if (args[0].equalsIgnoreCase("test") && args[1].equalsIgnoreCase("no") || args[1].equalsIgnoreCase("yes")) { // Other stuff } }
I'm doing /mycommand test yes
If you use args[1] then you should check args.length >= 2 before
the args[0] must work
I have a map of String : String, how can i load this everytime (it does not need to change )
Elaborate
so make another if statement?
ye
so, for testing atm i am doing this:
just it is ugly so i reckon i should load it from file, or do i just init with these?
https://paste.md-5.net/unoyutosik.coffeescript
sorry, should have pasted it
I mean you could do it with code
The java Locale class is crying
hahaa
but then it's just gonna look messy
Although if you wanna cutdown verbosity might wanna use ImmutableMap.<String,String>builder() which would cut down verbosity somewhat
Thats not our problem 😄
yeah, but idk if this would work here.
it is to interface between two apis, one which returns words and the other that deals in codes
Anyone experienced with https://api.spigotmc.org/legacy/update.php?
I need small help
You need to add the resourceId
I know that
store your map in a yaml then you easily load it
yeah thats what i was planning
My current plugin version is 1.0, but it only says the plugin is up to date if I put 0.8 in plugin.yml.
So that's like weird
they aren't equal
thats all it checks for
wait hang on
i just read it properly
getConfig().set("language", languageCodes);
languageCodes = (Map<String, String>) getConfig().get("language").getValues(true);```
i have found in the past that the api is slow to update
oh cool! thanks
im getting this error but im not sure why:
java.lang.IllegalArgumentException: advancement
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122) ~[patched_1.16.5.jar:git-Paper-714]
at org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer.getAdvancementProgress(CraftPlayer.java:2023) ~[patched_1.16.5.jar:git-Paper-714]
at com.defiantburger.origins.Origins.lambda$onEnable$0(Origins.java:40) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Paper-714]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Paper-714]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1426) ~[patched_1.16.5.jar:git-Paper-714]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:419) ~[patched_1.16.5.jar:git-Paper-714]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1341) ~[patched_1.16.5.jar:git-Paper-714]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1129) ~[patched_1.16.5.jar:git-Paper-714]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:290) ~[patched_1.16.5.jar:git-Paper-714]
at java.lang.Thread.run(Thread.java:831) [?:?]
the lines it has issues with are these:
NamespacedKey adkey = new NamespacedKey(Origins.getPlugin(), "husbandry/balanced_diet");
Advancement a = Bukkit.getAdvancement(adkey);
AdvancementProgress aprog = player.getAdvancementProgress(a);
Pace I think it works all good but as Jeff said the web api might not be the fastest
i wrote this method a while back (its not great) to check it in more detail
pretty sure that exception is thrown if the advancement is null
yeah, thats the issue, but i dont think it should be null
dunno what to tell you there xD ¯_(ツ)_/¯
hmmmmmmmmmmmmmmmmmm
@glass mica , use the method like this:
new updateChecker(this, VERSION).getVersion(version -> {
if (!this.getDescription().getVersion().equalsIgnoreCase(version)) {
boolean isold = isOutdated(this.getDescription().getVersion(),version);
if (isold) {
getLogger().info(ChatColor.LIGHT_PURPLE + "There is a new Update Available for Plugin: Version " + version);
}}
});
That’s practically equivalent to what he did
yeah, but it breaks the string up into all the sub versions
huh
The API caches values for up to 6 hours
well there you go
So I'm guessing in 6 hours it should be fine?
Yes
Thanks
(It might be 8, but I think it's 6)
Surround the cast appropriately, but don't you want getConfigurationSection()?
What's your config look like? I missed your earlier question
(at least the relevant part of it)
tryna store a (constant) hashmap of String : String to be able to load it each time
instead of just a verbose setting each load
the map^^^
gotcha. I'm not positive what the result of set(Map<String, String>) does, but if it does manage to miraculously return a Map<String, String>, you want to cast the result of get(), not getValue()
((Map<String, String>) getConfig().get("language")).getValues(true)
LivingEntity#getTargetBlock()
Or getTargetBlockExact() which takes into account bounding boxes
If you just added to the config and saved without reloading, the Map will be in the config. If you reload the config ti becomes a MemorySection.
So if you have not loaded yet it is still a Map so your get will return the map.
If you Have loaded it will be a memory section so you then need .getValues(true)
config.load
FileConfiguration converts Maps into MemorySections upon loading
So if you added your Map to the config and saved, In memory it will still be a Map
so getConfig().get("language") would return a Map.
ah
However, if you restart or reload your config it is converted into a MemorySection, at which point the get returns a MemorySection and you have to get the Map from it with getValues(true).
one sec I did write a simple wrapper
oke
/**
* If loading from file the Maps in the data
* will be stored as a MemorySection not Maps.
*
* @param entry MemorySection or Map to check.
* @return Map containing the serialised data.
*/
@SuppressWarnings("unchecked")
protected Map<String, Object> castToMap(Object entry) {
if (entry instanceof MemorySection) {
return ((MemorySection) entry).getValues(true);
} else {
return (Map<String, Object>) entry;
}
}```
just throw your get("language") through that method
any idea how to check if the item has no enchantments? since im doing some weird stuff 🥴
since null doesnt work, neither does str as "{}" or ""
does Bukkit#getPluginCommand only include commands from my own plugin, or minecraft commands like /gamemode too?
pretty sure you just check if the ItemStack#getEnchantments map is empty
to figure out if an item has enchants
test the return .isEmpty() https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemStack.html#getEnchantments()
ok thx
tysm great
Anyone know a way I can simulate uuid spoofing, but in a plugin? Just set a players uuid to something else
Why? I ask as we will not help write trojans
i will not
lol
xD
This doesn't fit the definition of a Trojan
Also, I want to fool around with it lmao
It would emable you to spoof any player on any server with yoru plugin. Thats a backdoor/trojan
Ah yes, it would be if I was planning to do that
Which is why I asked.
👀
Also, if I wanted to write a trojan I could literally just get one to op me, why would I need a uuid spoofer
what is the method of loading a resource from the jar?
to make it less obvious
How is it less obvious
than opping you? a lot!
You are unlikely to get help to learn how to do that without a solid reason, other than curiosity.
You say "a lot" but never list any actual reason
ok
being oped would appear in the logs, and notify other ops
I literally just want to fool around with it, also it would be helpful for videos and stuff ig ¯\_(ツ)_/¯
so if a server owner acts funny that is less obvious than a random guy going round and blowing shit up
well, there is this ig
Not if you just setOp(true)
true ^^
Sorry, I'm out I'll not teach possible exploits with a good reason for need to know it.
- can check my ip, see its not the owners
- pretty sure they would see my account logging in lmao
I said my reasoning for wanting to know, if you weren't going to bring anything to the table don't respond
I mean GeometryPro if someone’s willing to help you then they will, just be patient 🙂
Im being patient, just responding to this random guy telling me I'm writing Trojans lol
There was a guy a while back asking for the same info
lemme find him
ok
its Pixel#5000
ask him about it and if he got anywhere
but don't be spammy / annoying
random guy 🙂
ok so this is probs stupid but i have never done async b4
Didn’t you mess with that the other day?
soooo, i am listening to the AsyncPlayerChatEvent - how do i make the other stuff async
yuhuh
still going
Other stuff?
I need help on a type of verification system. The plugin I'm doing at the moment, itself consists of an enchant system. When the player types /enchant, it will open a menu that he will be able to choose the enchantments. But I want the player to only be able to use the system if in his inventory he has some certain items. So far I've made a Class with all the items I want to appear in the verification, but I don't know how to continue.
[Google translator]
Inventory#contains
yes, this i know. but how i make to verify all the items?
well, it makes an api request using a method and that api request method uses a different class to make the parameters
but how do I do with super simple codes (if possible).
i can show the method
I mean usually methods are call sensitive, but what was the issue Jeff?
i just needed to know that it was actually working async, cause some1 moaned cough cough LEOcab about it not being async
and idrk if it is - tps effect and all
ok, do i literally need to write contais (item1) && blablabla, or can i do it more efficiently?
send the code (:
?paste
you want efficiency? use Bukkit.shutdown()
https://paste.md-5.net/ibeteguxud.js
Param builder VV
https://paste.md-5.net/epipayepal.js
this is the method i use to get the translation - i just call it like:
String translation = getTranslation(message, getConfig().getString("targetLanguageCode"));
Checking contains for n number of items will have the time complexity O(n) inevitably so you probably can’t optimize it however that would be diminishing optimization anyways
Jeff where’s getTranslation called
In the async chat event listener - sorry
Then everything is async
Or at least what you sent me is being executed on another thread than the server thread
99%
I believe it might be called synced if and only if a plugin triggers the chat event synchronously
oh ok that makes sense
But that would be a trivial fix
it doesnt matter to me tbh
Aight
i just wanted to check that with a large player base main thread wasn't gonna get bogged down
with api requests
Nope although I guess it might delay chat
So implementing a cache system could be beneficial here
yeah, not too much tho
O nice
intellij says that it cant find net:
import net.minecraft.server.v1_11_R1.EntityZombie;
you are using the wrong nms version
what version spigot api are you using?
1.16
.5?
yeah
import net.minecraft.server.v1_16_R3.EntityZombie;
still couldnt find it
Using maven?
wdym
does your project use Maven or Gradle to build?
are you depending on spigot or spigot-api?
look in your gradle build?
spigot-api
change that to spigot. the api has no nms classes
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
so do i drag the folders running it made into my dependencies?
no
what do i do with them then?
Nothing, running BT will have installed spigot into your local maven repository
so what do i do to get them functioning in intellij cuz they arent atm
You should now be able to change the entry in your maven or gradle build script to use spigot instead of spigot-api
ok
Fetch the first index character from the string and capitalize?
ye, i found a StringUtils Method
Hello. I'm working with the Text class to set my HoverEvent. How would I add colour to the Text class?
// TextComponent broadcast = new TextComponent("Broadcast");
broadcast.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("") /* <- How to add colour with new Text()? */));
Because new HoverEvent() with BaseComponent/new ComponentBuilder("Text").create() is deprecated.
@rotund ravine It's deprecated use of it
And text doesn't let me set colour by default
Maybe it's not possible? If that's the case, then why is it deprecated? Does it mean that HoverEvent text can't have colour anymore?
oh you're redoing that translation plugin huh
i remember there being one that used google's translation api but that requires api keys and shit now so that died
it was pretty nice
@opal juniper
make it public
it gives you 500k chars a month free
half of my playerbase is from like east asia for some reason
does it translate everything to a global language
atm yes
or everything on a per-player basis to each player's own language
russian to english example
i would like to add per player but the amount of api requests would get pretty high
also, deepl has this weird issue with capital letters
neural networks are dumb
so i am having to lowercase everything and then uppercase it
but it screws up things like shouting
mmm
per-player should still be fine as long as every player doesn't use a different language
exactly tho
also, it doesn't work if you were to type hola
it just translates it to english as hola eventhough that is definitely not english
i'd just use the player's selected locale instead of some enermous language detection library
Player::getLocale
i didn't realise that was a thing
i thought you said "you don't want to use api for it"
so I assumed you knew about it
yeah - detecting the language of the text incoming
but basically, the client sends some of its settings to the server
render distance and locale are few notable examples
the server can see the language the player has selected
yeahhhh, i get you
what, and then for each language being used, ->
translate it
send it to all players with that locale
??
something along those lines
thats an interesting idea
That is a really good idea
what do they do when the client has selected a lang that isn't supported
nothing, I suppose
makes sense
huh, i may add that
like, either global or per player (locale)
when i was talking about not using an api - i was talking about the detection of the language i am using in order to save on requests
ie - if it is already in the correct language dont change it
just making sure - can you translate without an api?
the server only bundles in the en_us language mappings
we'll all speak chinese natively eventually
lmao
well, thanks for the idea then. i will try that at some point
i think that a global language is still good for smaller servers who want to preserve their api requests
but, if you are gonna pay for it, why not go all out
have a setting to cycle through several free api keys
why pay anything when you can just have 10 keys
i'll fork it and add that functionality
lmao - the large corperations have too much money anyways branch
imagine paying google a single penny
fucks are already making money off of my private data
https://www.youtube.com/watch?v=FcJ0ID9B7xQ this is the mod i was playing before my font went weird XD
i mean, afaik i don't let them take my money
but yes, my data is a different story
they just take it
ElgarL showed me the other day
its really cool
looks useful
and produced this ^
still salty that we do not have a way to load any type of jar 😭
"muh security"
i mean, i have to use it for the lang detect lib cause that shit 120 MB
but, i can see it being adopted fast
I mean, it works well still with just your own URLClassLoader
Certain ones might need initializing of some kind or something along those lines @wraith rapids
I mean, libraries should be initialised by the user no ?
or that actually
I mean like field's and stuff @eternal night
how does initialising fields etc justify it being a plugin o.O
lmao
certain ones are dumb @vagrant stratus
well of course you should 👀
overloaded blob xD
'Please, don't execute this'
uh
nvm
add a log handler i guess
when a user runs a command
i don't think there is a better way
please make command named "hello" and set executor to commandHello
please make executor commandHello with permission "command.hello" that executes:
if player is not a instance of console do:
please say hi to player
please end executor``` imagine this was a language
lol
Set the log to false
lolcode
Then restart the server or do /spigot reload
no
Any help here??
dont use /reload /spigot:reload /reload confirm /bukkit:reload or neither
only restart the server
dont use the commands
Spigot reload just reloads the spigot.yml
but that doesn't help that much
It helps me alot
ohk
spigot.yml is not the developer's place to toggle settings arbitrarily
I use commands.yml so much so when i want to reload it i just use /reload commands
that's the end user's configuration file
Doesn't reloading reload the entire server though?
i haven't heard of bukkit having subcommands for reload
so, Player::getLocale() returns a string of the currrent locale, is there a list of all of the codes?
I think /reload by itself does the whole server
commands.yml doesnt even let u make actual real commands it only lets u make commands that does other commands
Im not sure
/bukkit reload is a thing
Yea i know /reload does it, so i assume /spigot:reload would as well
Just using it for disabling useless commands
lol
why would u disable default mc or bukkit commands
Not spigot:reload i meant spigot:spigot reload
https://minecraft.fandom.com/el/wiki/Language
shiiiiit why are there so many
links inside <> will not do the preview
god damm you NNYaKNpGms0eUVpiSdHx, i gotta sort thru these
the preview is fine
Bc i have my own plugin that has this commands and the messages are nicer than this ugly white lines
i don't understand why everyone is sperging out about the embeds
i just either leave them or delete them
hahahaa
idm them, but they can be a bit big
like that one was too big so i deleted it
cause it just clogs up the chat
cuz there is
nahhh really
minecraft wants to be for every language
and some of the languages are jokes tho
mf pirate is not a joke
like the pirate lang
yes it is
i unironically use pirate speak
why
shiver me timbers
lol
oh so the first bit is the lang and the second the dialect
so i just need to sort by the first bit
wait minecraft doesn't do japanese?
idk
idk maybe they're raycist
spelt it wrong ><
cool
now i need to make a method that takes the locale, translates it to the api version or nothing
what does the api use for language codes anyway
you'd think they'd use the standard country language codes as well
isn't that the iso country code
idk
yes
yes it is
DeepL API Documentation - everything you need to get started with the DeepL Application Programming Interface. Integrate DeepL functionality into your CAT tool or your own application with ease.
there ya go then
its just plain ISO 639-1 codes
what kind of language API would invent their own xDD
yeah i was thinking google surely wouldn't be such a noob
🤷
oh I thought they were using deepl
yuhuh
why regex for that o.O
I mean, the string will be compiled to regex internally I believe
but what is the issue o.O
new HashSet
powerpoint is a game engine :)