#help-development
1 messages · Page 2053 of 1

public class PrestigeTeleport implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
return sender instanceof Player&&args.length>0&&Bukkit.getPlayer(args[0])!= null?((Player)sender).teleport(Bukkit.getPlayer(args[0]).getLocation())||true:false;
}
}
shortest one i can make that syntax allows iirc
????????
why th
tho
yeah we are competing on the shortest one
._.
i don't actually write my code like that
it will
Except we lose the error message which you'd need to let the player know the name is wrong 
There is no method for Bukkit.getPlayer(Location)
Use OfflinePlayer or getExactPlayer
oh shit
no need for that
I write mine like this:
{
}
/* What Does Bracket Mean?
Brackets, or braces, are a syntactic construct in many programming languages. They take the forms of "[]", "()", "{}" or "<>." They are typically used to denote programming language constructs such as blocks, function calls or array subscripts.
Brackets are also known as braces.
Techopedia Explains Bracket
Brackets are an important syntactic element in most major programming languages. They may take several forms. The most common are the "{}", "[]", ()" and "<>" brackets. There are several other names for these characters. The "{}" are referred to as curly brackets or braces while "<>" are often called angle brackets or braces. The term "curly braces" is more favored in the U.S., while "brackets" is more widely used in British English. The "()" are also frequently abbreviated as "parens" since they are parantheses characters. These characters are encoded in both ASCII and Unicode.
These brackets define important constructs in a programming language. For example, in C and languages influenced by C, "{}" denote a code block while "[]" refers to an array subscript. In Perl, the "<>" is referred to as the filehandle operator for reading from and writing to files. */
._.
never hurts to add a little comment
not adding comments hurts turtles and puppies
facts
im gonna go sleep now
satisfied with the amount i learned on plugin making
thanks to everyone who helped
gn
@Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {return sender instanceof Player && args.length > 0 && Bukkit.getPlayer(args[0]) != null && (((Player) sender).teleport((Bukkit.getPlayer(args[0])).getLocation() == null ? (Bukkit.getPlayer(args[0])).getLocation() : ((Player) sender).getLocation()) || true);}
with location check
Still lacks an error message for warning the player
how no :C
not shortest in total
public class PrestigeTeleport implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player player) || args.length != 1) return false;
if (Bukkit.getPlayer(args[0]) == null) player.sendMessage(ChatColor.RED + "Unable to locate player" + args[0]);
else player.teleport(player.getLocation());
return true;
}
}
still not shortest readable
public class PrestigeTeleport implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player player) || args.length != 1) return false;
Player target = Bukkit.getPlayer(args[0]);
Optional.ofNullable(target).ifPresent(t -> t.teleport(player.getLocation())).orElseRun(player.sendMessage(ChatColor.RED + "Unable to locate player" + args[0]));
return true;
}
}```
3
Does anyone know some artifact that has a seperate jar where the IntelliJ annotations are stored? I'm writing a maven resolver and I'm interested in how the files are laid out. Reading the documentation did not make me much smarter
Thought so
You could've just splitted the string now that I think about it
eh, you probably did that
ah, just got rid of allowing whitespaces altogether huh
yep. i had gotten help from one of my friends though just to not take credit
\$\{[a-z]{1,}\} he gave me that
which is pretty much the same thing except i just added the capital letters thing
tbh i should have done that in the first place but i was just very blind somehow lmao
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
Optional.ofNullable(Bukkit.getPlayer(args[0])).ifPresentOrElse(player1 -> player1.teleport(((Player) sender).getLocation()), () -> sender.sendMessage("No player for name" + args[0]));
return true;
}
@rough drift
Where do you check for the player being a player
it will
player1.teleport(((Player) sender) the cast will just throw an exception
yeah...
Probably can ignore though
public class PrestigeTeleport implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if((!(sender instanceof Player) || args.length != 1)) return false;
Optional.ofNullable(Bukkit.getPlayer(args[0])).ifPresentOrElse((p) -> p.teleport(((Player)sender).getLocation()),() -> sender.sendMessage(ChatColor.RED + "Unable to locate player" + args[0]));
return true;
}
}
``` the shortest you can get while keeping integrity would be something like this I imagine
Omggg it’s still going on
I figured the spacing issue out
And it's disgusting
One bold space and one regular space
Per pixel
Oh you were trying to do that the whole time
hey guys, how would i go about making a lava rising plugin?
is there a teleport method which doesn't return a boolean?
check the docs but I assume no
It doesn’t look too bad
It's not, but it's optimized very poorly
Every pixel is its own component, and every empty pixel is 2
Bump
What do you mean by entity ID? The unique ID or
Yea he’s spawning an entity but trying to cancel it for the player who is using the disguise by listening to the packets
But he can’t cancel it cuz he doesn’t have the id cuz it doesn’t exist yet
I assume you'll need to apply a runlater or something if you can get the entity.
meh
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
return ((Runnable) () -> Optional.ofNullable(Bukkit.getPlayer(args[0])).ifPresentOrElse(player1 -> {
if (sender instanceof Player player) player1.teleport(player.getLocation());
else sender.sendMessage("Imagine being console, i would prefer to die");
}, () -> sender.sendMessage("No player for name" + args[0]))) == null;
}
Technically it's one line
imagine
Then I would be cancelling an event after it's called...
So
why is rotating
so difficult
location.getDirection is not even correct
i just have like 3 armor stands
and i need to rotate them on themselves
(so middle stays middle)
and for some reason or another i am too dumb to figure it out
Is it possible to generate vanilla structures like mansions, villages or just the simple ones like boats without using minecraft packages?
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String @NotNull [] args) {
return ((Runnable) () -> Optional.ofNullable(Bukkit.getPlayer(args[0])).ifPresentOrElse(player1 -> {if (sender instanceof Player player) player1.teleport(player.getLocation());else sender.sendMessage("Imagine being console, i would prefer to die");}, () -> sender.sendMessage("No player for name" + args[0]))) == null;
}
1 line !
😛
Does that even execute though?
I'm guessing it does not
I think it will work
but it will have performance issues
beacuse of runnable casting -/
you know that in onCommand return doesn't effect anything?
it will run even it's called on return false
and this will always return null because you compare runnable to null
._.
you can change == to != ._.
The runnable still doesn't execute
eh
it's one statement tho
But it's still wrong
we should compare statement lines not lines
That's not what we're doing lol
eitherway this looks way cooler
guys give lib ideas
Except it's functionally useless so 
no
its cool
functionally = function = fun in kotlin = fun = cool
fn
Can you access vanilla structures with the Bukkit#getStructureManager?
getStructures and getStructure with namespace key doesn't seem to work with vanilla ones
Is there a way to get the enchant level from an instance of Enchantment?
No.
how would I get it then?
declaration: package: org.bukkit.inventory, class: ItemStack
java. lang. NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor (org.bukkit.command.CommandExecutor)" because the return value of "main.main.getcommand (String)" is null
What is wrong with the plugin?
register the command in your plugin yml
maybe try "minecraft" namespace
not sure
nope
- register the command in plugin.yml
- never name your plugin main classs "Main", since your "main" class isnt main, its an addon to the main software running which is bukkit
Die it
show us ur plugin yml and ur class
getStructures map ist completely empty and getStructure with any vanilla namespace is null
producing the error
i wont die
im god
this dude is a machine
Sorry
Assuming you're at least 10 years old, there is a 0.0000002% chance you will live 100 more years, and if you do, you're called a Supercentenarian
Wait i make some changes
i have a quick kotlinx serialization question
I want to parse a list of objects with the properties id and level
They will be parsed into the same object, but id is now an key of Enchantment
this is based on numbers that will not be up to date in 100 years
name: VaroManager
version: 1.0
author: ITM
main: main.MainClass
commands:
vmwhitelist:
vmoverview:
vmrestriction:
vmrestart:
vmfastrestart:
thats invalid yml too
making an object that implements KSerializer<Array<ItemEnchant>> gives a warning
What warning?
if you dont want to provide a description and such do ```yaml
commands:
- vmwhitelist
- something
Serializer has not been found for type 'Enchantment'. To use context serializer as fallback, explicitly annotate type or property with @Contextual
waitt
lemme do some stuff
what ? is this since the newer versions ?
nvm
The yaml may be valid, but the bigger question is whether spigot will accept it
~
mye
is that like an empty object?
checker added that
thank you. can you copy the text in discord ?
the plugin doesn't works if there is just one wrong space
author: ITM
commands:
vmfastrestart: ~
vmoverview: ~
vmrestart: ~
vmrestriction: ~
vmwhitelist: ~
main: main.MainClass
name: VaroManager
version: 1.0```
why is there stuff under the commands list
people usually put it somewhere above
hmm idk
would this work??
@EventHandler
public void joinServer(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.setDisplayName("Steven He");
}```
It's still the same error
it's sorted alphabetically
smh
Which error is it even?
this one
i think you need to provide a desciption
as bukkit wont be able to generate the help page otherwise
i don't think so i have programmed some plugins for 1.13.2 and it worked without a description
question
how can you replace text in a component
component.replaceText gives you a builder, so i tried .matchLiteral .replacement, that works no?
thats the name in chat
(don't have access to my testing server atm)
can i make their name change
packets or scoreboard api
like in tab and above their head
dont ask me how
how is this code unreachable . _.
pretty sure there's an easy way @tardy delta
you cant return a try
Are you sure that you didn't make a typo or anything like that?
kotlin m8
yes
REeeeeee
btw quickly this?
uh no its readable
maybe intelli messed up
try restarting it
then intellij is on some weird shi
reachable*
lmao always
The return is unreachable, not the try-catch block
In the try-catch block you either throw an exception or return outright
As such you never exit the try-catch block without also exiting the method
the dataclass has to be annotated with @Serializable, the thing is, the serializer only serializes arrays..
and you gotta parse the json before using forEach on an array
DataOutputStream goes brrr
I mean if y ou really wanna do it
return ((Supplier<Boolean>) () -> {
Optional.ofNullable(Bukkit.getPlayer(args[0])).ifPresentOrElse(player1 -> {
if (sender instanceof Player player) player1.teleport(player.getLocation());
else sender.sendMessage("Imagine being console, i would prefer to die");
}, () -> sender.sendMessage("No player for name" + args[0]));
return true;
}).get();
be dumb and abuse functions
actually
use a supplier
if i apply PDC data to an EntityPlayer
👀
how can i get rid of this warn tho
ehm
PDC is an API concept, idk how/why you'd interact with it on an EntityPlayer
I think it will be stored to NBT either way
yes the PDC ends up as playerdata
cuz i want to parse the list but the dataclass is not of type Array<LemonItem>
but like, EntityPlayer has nothing to do with it o.O
However PDC would not be persistent if it is stored in NBT, so aah
uhm
what about this snipped
String surname = "Alex";
PersistentDataContainer pdc = player.getPersistentDataContainer();
NamespacedKey surnameKey = new NamespacedKey(myPlugin, "surname");
pdc.set(surnameKey, PersistentDataType.STRING, surname);
because a try catch does not return anything
from this site ppl here been advocating
thats the page ppl on this server kept advocating
What are you asking?
In the player data file
in the main world
?
so if i delete the playerdata file
i delete any to that player associated nbt tags?
Well yea because you deleted their data file…
kk ty
So yes it’s all gone
Yea it would be like they first join the server again
hm?
When Player.getDisplayName() is deprecated how I should get string value of user's "friendly" name? displayName() returns Component and .toString() does not return the display name but string representation of Component.
okay cool just tried pdc, apparently its nullptr safe
ok so that crashed
where is it deprected?
unless it deprecated since 1.18.2
im using 1.18.1
object ItemEnchantSerializer : KSerializer<ArrayList<ItemEnchant>> {
override val descriptor: SerialDescriptor = ItemEnchant.serializer().descriptor
override fun serialize(encoder: Encoder, value: ArrayList<ItemEnchant>) {
value.forEach {
val itemEnchant =
Enchantment.getByKey(NamespacedKey.minecraft("minecraft:${it.id.toString().lowercase()}"))
?.let { it1 -> ItemEnchant(it1, it.level) } ?: throw InvalidItemFormatException("The id of one of the enchantments is not valid")
encoder.encodeSerializableValue(ItemEnchant.serializer(), itemEnchant);
}
}
override fun deserialize(decoder: Decoder): ArrayList<ItemEnchant> {
return decoder.decodeSerializableValue(ItemEnchantSerializer);
}
}```i know something is wrong with `deserialize`, but idk what
if you meddle with vanilla methods
you cant throw exceptions
if you do you crash the main thread
thats one bullet point why ppl say stick to the api
no errors allowed
how would i do it then?
Hello, I got an error when I try to reload my config
https://paste.md-5.net/ereqejemib.rb
(my only world is named "world")
why do you bypass the api for enchants anyway
use unsafe enchantments
it's not above the ench limit
if i get it right
val itemEnchant =
Enchantment.getByKey(NamespacedKey.minecraft("minecraft:${it.id.toString().lowercase()}"))
?.let { it1 -> ItemEnchant(it1, it.level) } ?: throw InvalidItemFormatException("The id of one of the enchantments is not valid")
```checks if its a valid ench?
what the hell
that won't fix everything
kotlin
not my code
its amazing right?
i think his code is just messy
also please rename it1 to enchant
it is
i didnt write that piece of code
yeah not the best formatting
@modern vigil check wheter or not your returned value is null first
before you compare it to anything else
not my code XD
but ppl told me im a terrible human being for this too
look at this code
public IniParser()
{
try
{
ptr = (Object) IniParserPtr.invoke(IniParserClassPtr);
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
{
e.printStackTrace();
}
}
xD
val itemEnch = Enchantment.getByKey(NamespacedKey.minecraft(it.id.toString().lowerCase)).takeUnless(ench -> ench == null).let { enchant -> ItemEnchant(enchant, enchant.level) }
taking advantage of the fact that the JRE actually passes pointers when you pass an object*
no need to add minecraft:
i removed that
as NamespacedKey.minecraft already does that iirc
most important part @modern vigil is
to check if its null or not
if its null and u compare it to anything else
u throw an exception
and meddling with exceptions in vanilla methods 😉
object ItemEnchantSerializer : KSerializer<ArrayList<ItemEnchant>> {
override val descriptor: SerialDescriptor = ItemEnchant.serializer().descriptor
override fun serialize(encoder: Encoder, value: ArrayList<ItemEnchant>) {
value.forEach {
println(it);
val enchantment = Enchantment.getByKey(NamespacedKey.minecraft(it.id.toString().lowercase())) ?: return;
val itemEnchant = ItemEnchant(enchantment, it.level);
encoder.encodeSerializableValue(ItemEnchant.serializer(), itemEnchant);
}
}
override fun deserialize(decoder: Decoder): ArrayList<ItemEnchant> {
println(decoder.decodeString())
// return decoder.decodeSerializableValue(ItemEnchantSerializer);
return arrayListOf();
}
}```i refactored it now
it's not the best code, ik
ive learned that when i wrote custom mobs and wrote custom pathfindergoals
cause that crashed my server xD
always read the stacktraces
the thing is
minehut lets you go to a certain point
like u can only see a part of the error
kek
the problem with bypassing the api is not that its ineffective
it is that any mistake crashes stuff, hard to reverse engineer, manual updates required etc
how do i make an event
whats the taggg
maybe give more information?
?eventapi
ther
thx
i thought he meant runables
btw are runables actually multithreaded or are they just splitting computing power of one physical core?
xD
yeah I got the error i imagined
nullptr exception?
Unexpected JSON token at offset 123: Expected beginning of the string, but got [
nope
attempting to serialize a plain obj instead of an array of objects
serializing is something i have to get into soon
when building an admin system to view offline players invs
then u gotta dig into the .dat files
are there json files for that?
ah
the team wants it because they want mods to have access to the function without mods having direct access to player files
check inventories
i want mod 👉👈
yes?
@Serializable
data class LemonItemData(val id: String,
val name: String,
@EncodeDefault val lore: List<String> = listOf(),
@Serializable(with = MaterialSerializer::class) val material: Material,
@EncodeDefault @Serializable(with = ItemEnchantSerializer::class ) val enchants: ArrayList<ItemEnchant> = arrayListOf(),
@EncodeDefault val unbreakable: Boolean = false
)```
i need to serialize an arraylist of these
is that java?
kotlin
xD
i need to do this
tbh
i have almost no knowledge in serializing yet
all i did was copying an 8liner and translating it so i can use it as pagefile
basically
{
"id": "RAIDERS_AXE",
"material": "IRON_AXE",
"name": "&f&l&k??? &c&lRaider's Axe &f&l&k???",
"enchants": [
{
"id": "sharpness",
"level": 250
}
],
"unbreakable": true
}```this needs to be turned into an ItemStack
the only issue is with the enchants
the rest works
hey how do i prevent this happening?
java.lang.NullPointerException
at com.clonkc.vlands.kitpvp.vlandsutils.utility.utils.ServerUtils.sendMessage(ServerUtils.java:53) ~[?:?]
at com.clonkc.vlands.kitpvp.vlandsutils.utility.cooldownlib.Cooldown.removeCooldown(Cooldown.java:57) ~[?:?]
at com.clonkc.vlands.kitpvp.vlandsutils.utility.cooldownlib.Cooldown.handleCooldowns(Cooldown.java:69) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) ~[core.jar:1.8.8-R0.1-SNAPSHOT]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:352) [core.jar:1.8.8-R0.1-SNAPSHOT]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:786) [core.jar:1.8.8-R0.1-SNAPSHOT]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:380) [core.jar:1.8.8-R0.1-SNAPSHOT]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:716) [core.jar:1.8.8-R0.1-SNAPSHOT]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:620) [core.jar:1.8.8-R0.1-SNAPSHOT]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]```
Heres the cooldown manager code:
```java
public static void handleCooldowns() {
if(cooldownPlayers.isEmpty()) {
return;
}
for(Iterator<String> it = cooldownPlayers.keySet().iterator(); it.hasNext();) {
String key = it.next();
for(Iterator<String> iter = cooldownPlayers.get(key).cooldownMap.keySet().iterator(); iter.hasNext();) {
String name = iter.next();
if(getRemaining(key, name) <= 0.0) {
removeCooldown(key, name);
}
}
}
}```
any good libraries that I can implement to make a costum gui in code or should I do it all by myself
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, Cooldown::handleCooldowns, 1L, 1L);```
my main class
I only need to parse the array to another array
. _.
the dataclass needs to be an arraylist
for (NamespacedKey s : pdc.getKeys())
{
pdc.remove(s);
}
```does this work to remove all keys from all plugins from an object or entity?
Persistant data containers*
u cant remove in a foreach right ? idk i thought u had to use iterator to do thay
thats an iterator
There are many GUI libs. Here are some that I've used in the past: Inventory Framework, InventoryGui and Triumph
its iterating an iteratable
and for each match of the specified data type
it loops
i seem to remember one threw and concurrect modification excpetion or sum
why dont u use the vanilla cooldown
u can set a cooldown like for enderpearls on any item
so?
yes
aighty
that basically clears the entire PDC
kk
ty
just threw this in 10sec but wasnt sure enough of that api, like if it works like this xD
What am i doing wrong that I can't have more than one type of item in my shop? ```java
FileConfiguration config = Main.getInstance().getConfig();
ConfigurationSection section = config.getConfigurationSection("shop");
List<ItemStack> stacks = new ArrayList<>();
if (config.getInt("inventory.size") > 0) {
Inventory shop = Bukkit.createInventory(null, config.getInt("inventory.size"), format("&6Shop"));
for (String key : section.getKeys(false)) {
String displayname = config.getString("shop." + key + ".name");
int price = config.getInt("shop." + key + ".price");
boolean unbreakable = config.getBoolean("shop." + key + ".unbreakable");
ItemStack configItem = new ItemStack(Material.matchMaterial(key));
ItemMeta meta = configItem.getItemMeta();
List<String> lore = new ArrayList<>();
lore.add(format("&eCost: &a" + price + "&e points"));
meta.setLore(lore);
if (displayname != null)
meta.setDisplayName(format(displayname));
if (unbreakable) {
meta.spigot().setUnbreakable(true);
}
configItem.setItemMeta(meta);
stacks.add(configItem);
int slot = Main.getInstance().getConfig().getInt("shop." + key + ".slot");
for (ItemStack is : stacks) {
shop.setItem(slot, is);
}
}
((Player) commandSender).openInventory(shop);```
my eyes
Well technically bukkit is just an API and spigot implements it
it must be at the for loop that loops through all itemstacks but shouldn't it add the new itemstack as well?
craftbukkit does
There are some non-spigot bukkit implementations but those are rare
Thank you.
Good luck obtaining CB these days without using shady websites
spigot is a superset of bukkit
you can use buildtools to compile craftbukkit without spigot patches
yea but why
most modern methods are from spigot since bukkit died a long time ago
i was responding to #help-development message
oh nvm
It actually uses spigot patches
xD
Md is increasingly cracking down on cb
Not sure how long it will remain buildable seperately.
theres no proper ac in spigot
the only thing is impossible velocity warnings
"<player> moved wrongly!"
Which uhm is kinda broken
Especially tp plugins are prone to triggering it
huehuehue triggered by admin teleports
ik
its silly
.
im writing my own lightweight anticheat rn to counter those your grandma hacks
I should really make my own actually leightweight ac
Making use of 0 short-lived objects. Would be a pain to create but defo worth it
i should prob put as much effort in my anticheat as they put into their hacks
so ill hardcode everything
hell jea xD
ive put like 2 months of time into writing a modular plugin that gurantees EU data protection law compiliance
Sadly modding other games takes a lot of time so I don't really have much time to spend on such pretty useless endeavours
now lets throw this in 1day
What's the easiest way to make configurable guis?
cant?
cause GUIs are managed by the client
or do u mean
I mean from config
with clickable items
Like when you run /command and it pops up with your own gui with items in
It's mainly the getting the things from config is the worse part unless I make it static.
TextUIs are kinda nice and take a bit less time to write
- create a new inventory
- set ur items up
- whenever player clicks any item in any inventory
-> check if its ur custom inv, if yes cancel event and trigger effect
I don't think you understand where I'm coming from :/
I recommend using inventory gui libraries however
I know how to make the gui's, it's just how to get it from the config
he wants to know how to read from files
xD
either get an existing file paresr
parser
I want it to be configurable via config.
or write ur own
You can serialize ItemStacks and then read them back in.
ive hated all solutions so ive written my own ini parser
anyone know how to make the red border thing
ini parser based for what? Itemstacks?
its like the border but red all the pvp servers have it
image?
ini parser for parsing ini files containing the information about your inv interface?
no
Make the client believe that it is outside the world border
no I'm asking for a image
I think that is how it works
I think it's just a normal WorldBorder that's shrinking at basically no speed?
no its like they have a blue one and then when its shrinking its red
there's a blue one but idk about red
Cause I think the WorldBorder turns red when it shrinks and green when it's growing.
but how
is there some kinda builtin thing i dont know about?
is that a texture pack
looks more red
lol
It's not my pic
oh
I'm just trying to get a idea what you're after
cuz the one im talking about is semitransparent like the normal border
wrong person pinged
can you get a picture of it?
@next stratus you can either create your inventory in memory and if everything is serializeable serialize it and write the bytestream to the harddrive, or make your own json, ini, whatever file format and store information from which you can create the inventories instance
it turns red when shrinking, but idk if theres a builtin function
not rlly id have to be in the middle of pvp
video?
if u dunno how to do either of them, you better start learning how to do those first
https://www.youtube.com/watch?v=yq3BAdgh1Mg smth like the thumbnail
15 minutes or bust
Thanks for Watching! :D I appreciate all feedback and support :L!
Twitter → http://twitter.com/TapLHarV
Discord Server → http://discord.gg/TapL
Instagram → http://instagram.com/taplharv
Twitch → https://twitch.tv/tapl
Snapchat → itstapl
Server IP: tapple.world
Tapple Twitter: https://twitter.com/OfficialTapple
Tapple Discor...
thats just setsize it keeps it blue
the red one moves smoothly
in the vid its blue while its not moving
but its red when it moves
That's why you give it the 2nd argument for "over time".
oh
Just give it a big ass number that it'll never reach LOL
lol
Should always been red, atleast, I think.
yo can anyone help one of the plugins in my server was generating an error and I need to fix it but I dont know how. I dont code java but I can understand the basics. Can anyone help me fix my problem?
so it is a builtin thing
Should be, yes.
?paste the error
help you reverse engineer and violate the intellectual property of someone else?
rather not sorry xD
still doesnt make decompiling legal
ive tried looking everywhere but nobody posted the same problem about this specific plugin and all the solutions I could find included coding which I didnt know how to do
so can anybody please help me?
it doesnt say what failed
it failed to path player death event to the plugin
only that the problem is with the PlayerDeathEvent of the fr.neatmonster.nocheatplus.compat plugin
but
it could be so much
maybe its using vanilla methods and ur using a different server version
or the data is being handled incorrectly
the server is on 1.8
Is there more to that error? Perhaps under it.
there is nothing under it but above when the same error happened it gave a bit more info
Yeah send the one with more info.
Send the Caused by that you cut off NoSleep
and its caused by
what location within the chunk does chunk.getz() get
KitPvP
??
wdym
it gets the lower point
the corner?
like coords are always 0,0,0 to 1,1,1 for a block
so it gets u the lower corner
ok thx
wdym vanilla cooldown btw timinator
thought you've meant cooldown for item usage
no im making custom abilities
By any chance does that plugin allow you to have a configurable scoreboard?
linked to items?
yes it does but that scoreboard doesnt work because the title i put was too long so i just used another scoreboard plugin
You just sent the error for that though. We need the error for onDeath 😄
The full one, including the Caused By
nevermind
i posted the wrong error even
the actual error is some concurrent hashmap modification thing
how do i fix that
The 3rd link you sent was the wrong error. It was PlayerJoinEvent because the scoreboard title was too long. We need the PlayerDeathEvent one
currentlt im using an iterator<string>
how do you check if a liquid is flowing
look in DMs ill send a picture of the console
i didnt cut the error off
it just
ended there
since stationary is deprecated
I have a feeling it is still trying to set that scoreboard.
And it can't, so it's throwing errors.
If you're using another scoreboard plugin, just disable the KitPvP scoreboard, or replace the lines with something that isn't 32 characters
okay ill disable it and see what happens
1 second
i did /kill and my name and there was no error
but
im not sure if thats because im owner and op
my member player died
and it threw the erorr
ill log on an alt
and die
and see what happens
dont the remapped jars contain those imports anymore? ```java
import com.mojang.authlib.GameProfile;
import org.bukkit.craftbukkit.v1_18_R3.entity.CraftPlayer;
how do i check what type of Fluid a block is?
i dont think so
im trying to see if its flowing
but the only thing i can find is the fluid enum
that has flowing
check to see if the .getData() of the block is equal to 0
If the liquid is a source block then .getData will return 0
anything else is flowing
if you get me
my man
you literally
thank you
i dont know how
but that was the issue

getdata is deprecated
blockdata doesnt return 0
Whats the best way to store lots of information about the player? I know you can just do yml files but is there any other way of doing it thats safer?
using a database?
what would be the best one tho
ah
Is there any way to check if a block is breakable by tnt?
is yaml slower or faster than a database
like setring a value and changing it, maybe using it to store stats
You really want to avoid loading/saving db values all the time. Either async saving, occasional saving, or using something like redis
YML stores everything in memory
I mean yaml/yml is just a format language/syntax
I assume most people are using the bukkit impl for it
It's disk read/write speed more or less
is there a blockstate for flowing?
how can i import craftbukkit methods now that the shaded version must be used
nvm
Use maven
so how do i distinguish between flowing and source liquids
mhm
?1.18
You can build 1.18.1 using BuildTools https://www.spigotmc.org/wiki/buildtools/
java -jar BuildTools.jar --rev 1.18.1
Hm no
there is a Fluid enum with FLOWING_LAVA and FLOWING_WATER but i dont see a way to check using that enu
Read the 1.18 release post on what to put in your pom
idk yml sucks
i wrote my own parser
xD
i mean mine is bad too but it does what i want at least
Is there not a getLocation(path) method in the config object
totally agree
I mean it doesnt totally suck
but they're definitely too ambitious in the aspects of flexibility
Except better
the problem is that they get bloated
myeah a little bit
and most of the time u dont even know whats representing waht
like ive said my ini parser is also far from perfect
but it does what i want at least
xD
I wouldn't totally agree with this
I mean you can make its ability to represent something as good as in json, or toml or even hocon
i mean i love
how most vanilla stuff is stored in json
then we have the server.properties written in ini
spigot using yml
xD
databases require an own dedicated server
SQLite config 💀
Yes they do
but if you can't afford to run a database then you can't exactly afford to run an MC server either so 
I mean even certain dbs for instance mongo uses json
how exactly do you run SQL which is written in C
on a server of a host provider
blocking all binary code execution
they might provide a db for you?
Host providers usually give you a db. At least if you're using a decent one
Then it sounds like the hosting provider is trash
honestly about storing configs
i was always worried to store it wrong
until ive noticed that the server is using like 5 different formats anyway
myeah nbt and snbt, then just properties and json which is from the default server jar, additionally bukkit chose yml, subsequently spigot, paper and all other forks use it
dont forget that even it doesnt say it
server.properties is using the "default" ini format
although there is no real ini standard ofc
dont u use
this.getInstance() ?
I mean he's probably accessing the plugin instance from another class
share more code
thats too little to go, we need the entire class principally
this works guranteed
sec
private static void hellfireDamageSheduler(Entity e)
{
if (e instanceof LivingEntity)
{
new BukkitRunnable()
{
int i = 0;
public void run()
{
i++;
if (i >= 20 || target.isDead()) this.cancel();
}
}.runTaskTimer(Main.getPlugin(Main.class), 0, 5);
}
}
ive just removed all the stuff u dont need
almost
that presupposes their main plugin class is named Main but sure
also spoonfeed bad bad
that the namespace is main
sorry i mean
nvm
xD
that snipped is like 4years old
havent touched it in ages
fair but ye
fair xD
i like to run my shedulers that way
so i can make it tick dependend
and end it on condition
at the same time
hmm yeah, I don't see any overall issue with what it does tbf
iirc bukkit shedulers timing is set in ticks?
so 5 as param = 250ms?
xD
like ive said havent touched it in a long time
So i need to create a Component to use with click events and stuff, however ComponentBuilder returns BaseComponent[] and that's deprecated, what other way can i do this?
mye, Idk I distance myself from the BukkitScheduler since its a bit limited but ye
observer pattern?
like independent operating things like
firewaves
require multithreading
altough im not really sure the sheduler does actual multithreading
feels more like splitting cpu power
and creating virtual threads rather than real
because you have the async variants
which basically send the task to a cached thread pool
nope
^^
you cant ensure that
is it capable to?
ik
yes Java might opt in to use more than one core
altho the developer afaik cant explicitly specify that
not with the given std api at least
ru using paper?
cuz then yes, a ton of stuff is gonna be deprecated
but yes Timinator
this is also why testing multithreaded designs is excruciatingly painful
^^
How do I get a list of materials from the config and allow duplicate materials?
like the way I have it is to just use 200 threads (Java threads) and repeat the test like 5 times
I'm making a shop
the guys asked me why i outsource some stuff to the global scale rather than local
but thing is
ram can be extended
how does your config look like?
x)
stuff like who has signed the data protection compiliance, cause anyone who hasnt isnt allowed to interact differently than to agree/disagree(and get banned and data wiped as required per law)
shop:
'1':
LEATHER_BOOTS:
name: '&7Leather Boots'
price: 2
slot: 0
'2':
LEATHER_HELMET:
name: '&7Leather Boots'
price: 60
slot: 1
inventory:
size: 36
ye, well I just do whatever licenses, laws and rules tell me to, better not fuck with that shit
we arent required to do that actually
and you wanted a list of the materials?
cuz it looks like you want an Int2ObjMap czkn
mye the laws isnt my field of expertise
neither is it mine
im getting this compilation error with this pom https://paste.md-5.net/sapivibixa.xml
my name doesnt stand under the server contract
xD
i just do what the legally responsible guy tells me to
^^
mind sharing your pom xml?
literally in the link
oh im blind
yes, I initially had no integers but when I added 2 of the same material, one replaces the other
yea
i dont see why it cant find the language considering its defined twice
so why cant i compile it
it normally works ive used this same pom with many projects (besides changing the name) and it worked fine
try just setting it to xml <properties> <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>
1.8?
Do you need something specific in 17?/
no not rlly
well what r u trying to do in the long run/ elaborate the bigger picture of it all
so tristan
did u change to 17 in project settings
equals mostly
for now it's a 1 page shop that I can set the size of, so I just want to add a itemstack to gui at a specific slot with a price and a name
yes i just changed it back to 1.8 now it says error: invalid source release: 16 even though ive almost never touched java 16
a Map<Integer,ItemStack> or sth could suit for this (or the superior alternative Int2ObjMap<ItemStack>)
I had issues with slots getting replaced by duplicate material names
ckzn
Do i need the int?
thing is you probably wanna track stuff primarily by slot
could this be the piece of shit thats been messing with me this whole time
in the iml
yay
oh thats easier
Settings -> Build, Exec... -> Compiler -> Java Compiler
and set it to 17 I believe
bytecode ver that is
in the project settings?
File -> Settings
i only found this
oh wait submenu on the side
wouldnt that mean java 17?
so i have to change the version again lol
oh cool
ok now it works thx :)
why does this not do anything
((Levelled) event.getBlock().getState()).setLevel(0);
is there some kind of setState() or smth?
update()
BlockState#update
so im trying to do this but smh the state of water is not castable to Levelled
imagine btw, hit 60k msgs :3
im 2.3k away
hehe
i remember when i was the most active in the server
im using blockfromtoevent
then i got a life 😔
why not?
...
did you debug it
Main.plugin.getLogger().info((event.getToBlock().isLiquid() ? "yes" : "no"));
oh my, yeah
wouldnt make sense
i just showed u the line that does it
thats before the other lines run
ok so smh water is air
so it is before it updates ig
ok so if i run it in a runnable it works
and then why is levelling not castable
by it works i mean it knows its water now
but its still not castable tot Levelled
ok still a bit confused by what to use however would yml be more than enough to store all uuid and loads of info in one file? I find making a file is easier than more code for all the sql/ mongodb.
or is it best to just go with a database. Just struggling to choose and setup seems too complicated for what its purpose is for (having a big brain fart)
Can you? Yes. Should you? Maybe.
kianj I'd at least split it up to a user per file
The thing is with YML is it'll all be stored in memory.
and a normal flat file storage can be fine altho its not really reliable nor scalable, but for mocking it might be fine
its still just a formatting language, he can choose to cache relevant data whilst keeping irrelevant data saved in said files
Can you only half load a yml config?
in principle yes but that'd lead to corruption probably
bukkit just wraps a yaml snake parser instance and uses it for loading/saving
the actual data when stored in memory doesn't have any strong coupling towards yaml specifically
its literally just a glorified linked hash map
ok, so for the long run a database is the better option.
yes
and generally speaking you could go with flatfile initially but it can be a bit painful to convert
altho its doable
The only other really big thing for me is can you constantly read and write to databases? because ideally I want to have cooldowns and other short term things aswell as kills, money etc
nah dont do that
you cache stuff
like in memory
such that accessing data you use frequently becomes relatively cheap in terms of speed
and by cache I mean, creating classes encapsulating data, then having a map or something to make it accessible (transferable and indexable)
im not too sure if I understand fully as i've never looked into this side but have a file/s holding all the players data and when they log out after a period of time that data is then added to the database
then if the player doesnt have an existing file it creates one and adds all the info to that file from the database. If this isn't the correct way how would you do it and how would you cache stuff? @ me
How can I show text or something above a players head?
in a vanilla world with commands, you can do that with scoreboard
but how do I do it in code
If you can do it in Vanilla you can do it in Spigot
Yeah so do I just create a scoreboard?
I don't know. You'd have to do the research on it
Well that's why I'm asking here xD
I couldnt find anything on google abt it
ohh wait
nvm I got it
nvm I dont got it breh
Ok so I got a scoreboard below name to work
but how do I make it so it's only below a single entities name
not everyones
Idk if this is correct but im pretty sure you can only do that with packets (Unless some new Api methods came out)
declaration: package: org.bukkit.scoreboard, interface: Scoreboard
this might work idk what this does havent tested it
@vague oracle How do I do it with packets
Can you somehow slowing fire spread rate?
Use BlockSpreadEvent and if its fire maybe generate a random boolean and if true cancel the event
or if you don't want 50/50 use random numbers
Does burn blocks with flint and steel will call BlockSpreadEvent?
idk 😦 never used it just know the event exists
Called when a block spreads based on world conditions.
Use BlockFormEvent to catch blocks that "randomly" form instead of actually spread.
Examples:
Mushrooms spreading.
Fire spreading.
If a Block Spread event is cancelled, the block will not spread.
thats all I got xD
Yeah I've read that too. I'm just gonna test it later, thanks anyways!
BlockIgniteEvent maybe https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockIgniteEvent.IgniteCause.html#FLINT_AND_STEEL
declaration: package: org.bukkit.event.block, class: BlockIgniteEvent, enum: IgniteCause
https://www.spigotmc.org/threads/tutorial-creating-custom-entities-with-pathfindergoals.18519/
is this outdated or am i missing dependencies?
the EntityX isnt a class for me
public class CustomZombie extends EntityZombie
You need to have a jar with craftbukkit embedded into it
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
spigot it's legit to use discord api for a discord bot to receive messages form server mc?
https://github.com/DiscordSRV/DiscordSRV/blob/master/src/main/java/github/scarsz/discordsrv/DiscordSRV.java you can compare to DiscordSRV to see how they do it
Discord bridging plugin for block game https://www.spigotmc.org/resources/discordsrv.18494/ - DiscordSRV/DiscordSRV.java at master · DiscordSRV/DiscordSRV
I have a question about bungeecord, can player intercept plugin messages? I'm asking about security of plugin messaging.
I'm no expert on PMCs but I wouldent send any secure data across anything like that
if i want to run a task every 5 minutes, which field do i change?
?scheduling
Mostly this, https://cdn.rackdevelopment.tech/img/ugtIUFlcSO.png
So you would want to change the period in your case

