#help-development
1 messages ยท Page 2037 of 1
If the payoff wasn't there I wouldn't deal with it tbh.
Pure ASM Transformers better.
Sadly noone supports them
am i missing something here? Why's there no PDT.BOOLEAN?
use a byte
if(0) is if(false) right?
you can choose
...
if i use a BYTE for storage
and dont store anything in it
its 0
right?
dammit
Just store false as a 0 and true as 1

is this the correct way to generate a resource pack hash?
are there any resources on how to create PersistentDataTypes ?
yes
one sec
?pdc
then scroll down to Custom PersistentDataTypes and how to use them ?
thanks
I have this on github that adds a ton of new datatypes, you can also just look at how this works https://github.com/JEFF-Media-GbR/MorePersistentDataTypes
what is relocating & shading again?
no
it means that maven adds the library into your .jar file
and that it renames the package of the library
e.g. com.jeff_media.blabla becomes your.plugin.blabla
not in java
well your other library is what im trying to implement here lol @tender shard
if you're too lazy to shade it, you can also just copy the parts you need lol
im a programmer
well technically false does equal 0, but there is more to it. For instance if you think false means 0, you might then think 1 is then true if you were trying to compare the functionality of boolean. However, the boolean true is actually not equal to any specific number and rather just means does not equal 0. So that means true could be -1.
ctrl c and ctrl v maven seems easier than searching out the code i need
true
im aware
if you are aware then why the question initially
unless you were just asking if you could simply do if(0) instead of if(boolean)
yea
ah, then no
bc it said byte cant be used as boolean
well you can represent a boolean in a byte, but you would have to change your if check
to if (byte == (whatever number here))
@tender shard where tf do i insert <configuration>
boolean result = byte == 0 ? false : true
copying the code it is
lol
inside your maven-shade-plugin
??????
I have a completely different issue now
whats that
do you already have a <build><plugins> section?
uh its a commented out section with the remapped plugin from md_5
if you want to copy the code, either add jetbrains annotations as dependency or remove all the @ NotNull and @ Nullable annotations
if you don't have <build> at all, just add this:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<relocations>
<relocation>
<pattern>com.jeff_media.morepersistentdatatypes</pattern>
<shadedPattern>YOUR.PACKAGE.morepersistentdatatypes</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
</plugins>
</build>
if you do have a <build> section, insert the <plugin> section into your existing <plugins>
How .isSimilar work?
where did you get that from
Itemstack
^
?jd-s
declaration: package: org.bukkit.inventory, class: ItemStack
This method is the same as equals, but does not consider stack size (amount).
it basically gives true when those two itemstacks would be able to stack
I mean what it check between 2 itemstack? name or what?
ctrl+b that method lol
probably helps if you know what .equals() does
equals() in java compares object contents if that better helps understand what isSimilar() refers to when it says works the same as equals
or F4
f4 is a weird finger movement that resets hand position so ctrl+b is way nicer for me
i spend 90 % of my time searching stuff so i dont realyl have a rested hand position lol
ctrl+b > F4
Is there anyway to rename a itemstack permanently?
It reset when place & break
you have to store the name of the itemstack using PDC when the block gets placed
then listen to BlockDropItemEvent and apply back the name
I got a library that allows to get a persistentdatacontainer for blocks: https://link.jeff-media.com/customblockdata-spigot
I really find it stupid how many fixes and qol stuff we need to do ourselves... question @tender shard does the PDC persist when the block's broken?
which fixes and qol stuff you referring to?
why is this not bringing up a prompt? i know that the code is being called and there is no error console output
Unless I'm misreading his code it's just writing the block data to the chunk. I assume you have to manage the writing/deleting yourself
no assertion fails, connection errors, etc
maybe server settings on connection. Resource-prompt or smth can be set to never and defaults to what you enter on first join
You are forgetting if you are testing this you need to rename the resource pack to get the client you are testing on to have the prompt again
i never got the prompt though
dont they check the havh on every join?
my library uses the chunk to save data, so the data stays there until the chunk gets deleted or you manually remove the data
Ayy I can read code after all
how can you use those colors? I instantly assumed "hash" and "forcePack" are of wrong type
should we have been concerned previously ?
yes
I think it is not worth looking into
bruh youve said this like a million times
im used to it
Yes. I read code like I read French. I learned it in school but I didn't really learn it
I guess needing my library to store PDC in a block
i hate it when the whole text gets red on an error
anyways imma head off now
p a i n
well your library isn't needed to strictly do that
wellllll you cant do that normally
your library may make it easier or extend functionality but isn't required since the API already facilitates it
and the workaround is storing it in the chunk pdc
well, not if you write those methods yourself
the API does NOT have a way to give you a PDC for every block location
only for tileentities
Mostly because you require tile entities to store data for blocks
well maybe not for every location, but chunk pdc is generally sufficient most of the time
yeah that's what it does, my lib simply maps a blocklocation to a namespacedkey in the chunk
well and also handles loading/saving it everytime the PDC gets changed etc
yeah lol. I specifically made all those libraries so I don't have to copy paste my code between all my plugins
actually copy pasting was not the problem, but... if something needed a fix, then I had to fix it in 10+ plugins lol
now I just recompile them and have the fixed version everywhere
well you can consider it a qol thing, however people are free to make PR's to the spigot api as well.
PR's ?
pull requests
Gotta write your own libs for arbitrary unnecessary reasons
typically the case
like the above is an example where most likely chunk pdc is sufficient since you won't have a block without a chunk loaded
is a lodestone a tileEntity?
you still didn't understand what the lib does, right? ๐
correct
i do need to permanently store data for blocks
cant do that with stone
since it aint a tileentity
yes, using the chunk PDC. it's simply an interface so you only need 1 line instead of 10 everytime you need a block pdc
either way, people over engineer when it isn't necessary
that library is pretty simple tho
it's like 5kb in only one file
not sure why either you keep thinking my comment strictly refers to the library
even the comments before o.O
tileentities
tileentities
tileentities
I have nothing against your library @tender shard probably is useful to some. however that doesn't mean people have the tendency to over engineer or use things that are most likely not necessary.
im mostly just running under the principle 'if it works'
if someone wants to improve my code sure
but i aint doing squat beyond what's necessary
I'm writing a library to be as unnecessary as possible. That being said if you have an idea for something that could be done with reflection (non NMS stuff) that would save you 2 seconds of typing lmk so I can add it to my TODO list. So far I have
Listener auto reg
Command auto reg
Plugin auto injection.
I need more stupid things to add. feed me ideas
it should register a ton of listeners even when not needed to fire custom events like ArmorEquipEvent, PlayerJumpEvent, PlayerScrollEvent, etc
I'm listening ๐
create a PlayerScrollEvent with an Enum "ScrollDirection.UP" and .DOWN.
Now make your library automatically listen to PlayerChangeHeldItemEvent and call this event everytimg to indicate a player has scrolled up or down (only if they changed the held item by exactly 1 to the left or right)
I think my library does it too but only registers the listener if the plugins needs that event lol
so you can make menus where you can use the mousewheel to navigate
ofc the event must be cancellable
Wouldn't I just make a normal event? Although automatic custom event reg is something I can add
yes, you'd create a new event but of course you have to listen to other events so you will be able to call your event
beautiful, isn't it?
My lib isn't actually a plugin so I'm not sure the extent to which it can register things.
But automatic registration of custom events is something I'll add
should implement
fold a right-recursive datastructure to the right in O(1) stack
Wait speaking of that I could look for println and complain about it 
Call it the "best practice tool"
can you add \n in a kick message
or implement a trampoline technique
or lazy datastructures
I'll just rewrite their code for them. Write an intellij plugin that complains when people compare itemstack names
Trampoline technique plays out like a regular trampoline user. They go right over my head
yes
How can i compare int with iterator.next
lol nice one
?
Just to be clear: I can store multiple keys under a same namespace in a persistent data container, and then one value per key ?
send code
of course
that's what it's for
your namespace is your plugin name
it's like
myplugin:name -> "test"
myplugin:age -> 3
myplugin:enabled -> 1 (byte)
shouldnt happen as \n isnt actually encoded as \n as far as i know
so thats weird
do you have utf 8
does craftbukkit just wrap nbt data
or is it a whole different copy
of an nms item
When executing command mvn install:install-file -Dfile=C:\dynmap\target\dynmap-api-3.4-SNAPSHOT.jar -DgroupId=us.dynmap -DartifactId=dynmap-api -Dversion=3.4
I got error.
What should I do ?
yeah but you can have the same value for many keys
which is why you cant reverse hashmaps
does someone know whether the limit for maps is still only 65k?
and if so, what happens if all IDs are used up?
Do fireworks have a chance of curving upwards when shot from crossbow?
hey @tender shard i was following one of your tuts
but where should i execute the command line here ?
Where command lines are executed
am using intellij idea
and?
should i do it there ?
you can
this didnt work
1 sec amma try on cmd
operable program or batch file.
the result of IDEs making everything easy for you:
you dont have maven installed
i would also install gradle
useful shit
Is it possible to code plugins that would be compatible to 1.18.2 in intelliJ?
oh i didnt know i needed that thank you
does anyone how to solve this? java.lang.NullPointerException: Cannot invoke "org.bukkit.scheduler.BukkitTask.cancel()" because "this.val$finalKick" is null This is the code: java public void requestLogin(Player p){ User user = new User(p); BukkitTask timer = user.getTimer(); BukkitTask kick = user.getKick(); if(user.hasPassword(p)){ //timer timer = new BukkitRunnable() { @Override public void run() { if(!user.isLogged()){ p.sendMessage(ChatColor.RED + "Please log in."); p.sendTitle(ChatColor.WHITE+ "Log In.", ChatColor.AQUA+ "Thank you!", 10, 25, 10); } } }.runTaskTimer(TakaoLogins.instance, 0L, 100L); //kick BukkitTask finalTimer = timer; BukkitTask finalKick = kick; kick = new BukkitRunnable() { @Override public void run() { if(!user.isLogged()){ p.kickPlayer("You timed out on login."); }else{ finalTimer.cancel(); finalKick.cancel(); } } }.runTaskLater(TakaoLogins.instance, 600L); }else{ p.sendMessage(ChatColor.RED + "You need to register."); } }
Not sure if this is the right channel but
is there a reference sheet/documentation of all the callbacks (like onBlockPlaced(), onPlayerJoin() and so on)? I'm not sure if they are under Listener, or how to override them and write my own. Can anyone help?
In other words, just a guide to callbacks and a list
Thanc
theyre not implementable callbacks from the Listener class @spare canyon
u can look on the spigotmc.org tutorial pages on how to listen to events
and a list of them should/would be on the javadocs
?jd
https://www.spigotmc.org/wiki/spigot-plugin-development/ should be under "Using the Event API"
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
kickPlayer("a\nb");
thats literally what i am doing
(diff text on the sides but you get the point)
tho its fine
idrc
the major problem is AsyncPlayerPreLoginEvent never being called
should b called
nope
did u register listener?
yes ofc
does it work with something like the normal PlayerLoginEvent
Send code that really doesnt help
its hard to help when you dont show anything
because.. there's nothing to show?
Then you dont have a problem theb
i just kick the player if a certain condition is true (i get kicked so thats not the problem), it just shows \n as literally \n
not a newline
and yes i didn't type \\n
PlayerLoginEvent is called
What was the error / problem?
event.setKickMessage. Why not use that for asyncplayerprelogin?
this is being shown as literal a\nb
its two unrelated things
lmao
i am fine with \n not working
i need the event to work tho
But it still kicks the player?
alright
But doesn't process the newlines?
lets separate
Version?
@fresh templetHandler?
newlines are written as \ and n
1.18.2 paper
Ooh, that's even more interesting
Can you test it in different contexts?
Like on enable get player and kick
this environment variable is needed to run this program.
'cmd' is not recognized as an internal or external command,
operable program or batch file.```
can you help me with this ?
i followed a tutorial to fix it but it wouldnt work
If you reload
oh yah
checkin
my pc when i build my plugin: BRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
hi, im trying to work with bungeecord's plugin messaging channel, but im receiving multiple messages back even if i only sent one. this is causing eofexception because its reading the bytedatainput multiple times
console: https://paste.md-5.net/ritozawowe.makefile
plugin sending messages: https://paste.md-5.net/afunewuqod.java
api receiving messages, then completing a completablefuture:
https://paste.md-5.net/cagosayiba.cs
does anyone how to solve this? java.lang.NullPointerException: Cannot invoke "org.bukkit.scheduler.BukkitTask.cancel()" because "this.val$finalKick" is null This is the code: java public void requestLogin(Player p){ User user = new User(p); BukkitTask timer = user.getTimer(); BukkitTask kick = user.getKick(); if(user.hasPassword(p)){ //timer timer = new BukkitRunnable() { @Override public void run() { if(!user.isLogged()){ p.sendMessage(ChatColor.RED + "Please log in."); p.sendTitle(ChatColor.WHITE+ "Log In.", ChatColor.AQUA+ "Thank you!", 10, 25, 10); } } }.runTaskTimer(TakaoLogins.instance, 0L, 100L); //kick BukkitTask finalTimer = timer; BukkitTask finalKick = kick; kick = new BukkitRunnable() { @Override public void run() { if(!user.isLogged()){ p.kickPlayer("You timed out on login."); }else{ finalTimer.cancel(); finalKick.cancel(); } } }.runTaskLater(TakaoLogins.instance, 600L); }else{ p.sendMessage(ChatColor.RED + "You need to register."); } }(i made the finalTimer and finalKick variables cause the IDE told me to and idk why)
It's because you cannot use variables that are not effectively final in a Lambda or anonymous class
I'd recommend to use the consumer schedule method instead
If I'm trying to get a config value that does not exist and it's an int, will it return 0 or will it throw an exeption?
The issue you have is that you never defined kick to a non-null value and that thus finalKick is null. finalKick is passend through your Anonymous class into val$finalKuck as a synthetic field
I'd avpid the use of Bukkit runnables either way
?jd-s the Docs specify that probably
Oh, thanks !
Don't debug a Problem in 6 hours If Reading the Docs for 5 Minuten also solves it
but why is finalKick null, finalKick its a runnable
i cant get that
hi
im using spigot server and when ever i use command it wont work and in consule it will show me this "issued server command: /plugin list enabled"
you're looking for #help-server
did u code it?
i just install java on my vps and install spigot and run server and my vps is using centos
What is the event to check if a player is hitting a block?
PlayerInteractEvent
ty
it works with both righ and leftclick?
nice
however
you cant detect right clicks without an item in hand into air
but everything else yes
How do I move a vector one block to the right/left
cmd is
the command prompt
not the command to use
quick question: I Have just created a bunch of worlds with MultiVerse. if i move some folders with the SAME EXACT names and replace the folders the plugin itself has created will it work and keep the worlds or does it have the possibility of crashing the plugin/deleting the worlds
How can I access a key via any value in hashmap<String, integer>
probably wanna linear search the entry set of the map
alternatively use a BiMap<K,V> (which is a Set -> Set rather than a Set -> Collection)
why
what r u trying to do
What's the event for listening to a kick "You area already connected to this proxy!" i tried PreLoginEvent, LoginEvent, Post
so as i understand it, there can be one callback for each of the event classes, the class determines when it is called and the name of the function can be whatever i want?
u can have multiple event callbacks in one listener
Listener itself is an empty interface iirc
u then annotate methods u want to listen to events inside a class that implements the Listener interface
u can annotate as many methods as u want in that class
but how do i tell the plugin that the function is a callback for when a player breaks a block for example
or when a player joins
are there fixed names like "onPlayerJoin" and "onBlockBreak" or can it be any name?
so like
// in ur listener class
import org.bukkit.whatever;
public class MyListener implements Listener {
@EventListener
private void onBlockBreak(BlockBreakEvent event) {
// do stuff
}
@EventListener
private void onJoin(PlayerJoinEvent event) {
// do stuff
}
}
// in ur plugin class
import org.bukkit.whatever;
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// other stuff
getServer().getPluginManager().registerEvents(this, new MyListener()); // or something like that
}
}```
any name
oh ok thanks
we love annotation reflection 
Hi, what is an item's lore?
onChat(BlockBreakEvent
also make the handlermethods public
They can be private
sure in java 16+?
they dont need to be public, this isnt Forge api
Yeah, it calls setAccessible(true) on them iirc
yes, mine work in java 17
ok my example was going to be AsyncPlayerChatEvent but then they said block break
and i was already typing
Letโs say there are 2 blocks, how would I get the direction of the first block facing the second
Maybe the yaw
or the blockface
is
public class MyClass {```
or
```public @Data
class MyClass {```
more readable
first
first
not sure why you would do it the second way, idk if I seen anyone use the second way lol
alr
Yeah, I was planning on getting the blockface from the yaw or something of the sorts
Is there an easy way to create an permission that gives all permissions? (plugin.*), Or do I have to add that permission to every permission check?
Hello, I want to use an item durability bar to display its "usage cooldown" so when u use it, it gets to 1% and it slowly returns to 100% durability, using a separate thread sounds resource unfriendly, is there a better way to update the bar constantly? (there may be multiple items that are doing this at the same time)
repeating task? idk
Repeating task that iterates through the item list and updates all their durabilities yeah
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Hi, is there a way to make invisible text?
using ChatColor.COLOR_CHAR
only makes it black for some reason
oh wait u are alerighte <.<
Just empty line ?
I want to uniqly identify items, and from what I understand the way to do it is putting a randomized UUID in the item's lore. Like so:
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
meta.setLore(Arrays.asList(UUID.randomUUID().toString()));
item.setItemMeta(meta);
But I need the UUID to be hidden
Use PDC for that
What is that?
?pdc
I will check it out, thanks!
hi
Can u help me
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Pong.
๐
Plugins are coded in the Java language
Ok
usually
Java is best
Java is the only good option, if not the only one
?learn java
There may be some weird wrappers that allow for other languages to be used but please don't use those 
Hmm
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
๐
How to join multiple servers from one server dessie
Wdym means
What do you mean = wdym
what do you men
Like i make a server and add a game i have to make game in other server so how i go to that game server from my server
Bungeecord
Yes
You don't need to know Java for that though
Lookup a Bungeecord setup tutorial
Then
Follow it
Ok
Where it is ๐
On Google
Ok
I love comment trains
I see not bungeecord it is spigot
If I understood correctly, PCT is used like a hashmap
Enter a key, get a value
But what I need is to just store a UUID inside an item, without a key
although I could just set the same key for every item
would this work?
The key would just be uuid
And yes you can set the same key for all items
Just no duplicate keys in the items
Then what would be the value?
Oh, and "uuid" would be the same key for every item
Yes
I see
Now, when I delete the item (for example throw it in lava) everything related to it will be gone (the keys and values) and not take up space in the server's memory right?
Correct
That should work, thank you for the help! :D
i was Alerithe yeah
kotlin hehe
Scala >
Java bytecode
Ballmers peak coding
Guys lets just code in binary code
jython :harold:
no
It does if you're using NMS
unless ur doing something 1.18.2 specific but I doubt
Or that
Probably fine then yeah
what happens if i want to use NMS tho?
It won't work
just build it urself w BT ezpz
You should learn how to setup a project yourself tbh
ah, i see
That would be in eclipse?
well that looks like a problem for another day
minecraft dev plugin is good for sponge mixins n thats about it imo
I mean they are setting it up themselves, u can just change the pom later...
true
Yeah true ig
Still though, if you move away from plugin development you probably won't be able to use the plugin as a crutch lol
couldnt i just edit the pom.xml? <version>1.18.1-R0.1-SNAPSHOT</version>
in the future i mean
This doesn't work for any version for me for some reason
Other than the one I initially chose
I there a way to spawn particles that doesn't get removed after like 5 sec and which you can delete by hand?
Keep spawning them
yeah for spigot it sucks and it always crashes my ide
tbh i think setting up a spigot plugin is just too trivial of a task to require a plugin to do it
^
sure it saves u a few seconds of boilerplate but
its much more useful for something like Mixins, since it can help get the descriptors of methods, constants, fields and what not
But you see when the start to disapere
I could see it be useful for beginners who don't need to understand maven yet I suppose.
u dont need mcdev for mixins but boy is it a godsend
There's no real workaround for that
idk
like its really just a short read on spigotmc.org wiki
.
gone is the good old <scope>system</scope> and <systemPath>yeahfilehere</systemPath>
They removed it so people who spend hundreds on personal servers could justify doing so by hosting their own repos
do you humans put your dependencies section below or on top of the build/plugins section in your pom.xml?
in the directory where your .jar file is that you want to install
below everything
depends on how im feeling
but usually below
I recently found a plugin where I put the dependencies on top and it feels weird
usually above
i think when i first learned maven stuff the tutorial had build above deps
just give a zombie a shield and see what happens ๐ I don't think they can use shields
they cant
I mean, is there any trick that can make them
mfs can use a totem tho cant they
yea
yes, on damage, dont
yeah usually dependencies are at the bottom (only deployment is still below) but I once thought that since I change dependencies the most often, it should be higher in the file
but now it feels ugly to NOT have them at the bottom
why would you say so, build sounds like the last stage of your project
deps is the bottom yeah but then u have like task config under it
by chronological order, deps should be above
parent/childs
properties
build
dependencies
and people do weird stuff with build all the time, I like to keep weird stuff below
properties
repos
dependencies
build
wow that's the most cursed version I#ve seen so far lol
ah yes repos
I should update my pom generator some time
it still looks like a website from the late 80ies
could be worse
dependencies
build
repos
properties
and deploymentManagement at the top
and pluginRepositories at the bottom
plugin repositories anywhere after the plugins
at the end you choose the order as you please
even if its the wrong one
keep the ugly stuff down
but dont choose wrongly
no dependencies
if you are talking about plugins, we need that
ever seen a pom with a long list of maven plugins and wonder what they do?
and you realise some are/can be called even without specifying them
auto-generated project stuff
everyone should be doing mvn archetype:generate
no i dont use maven
nor do i use gradle
i actually dont even use an IDE
or write java
im just here for the ride
can you make nothing explode in spigot
make an explosion out of nothing i mean
oh found it
yes createExplosion
How can I make a mob break anything in its path (Iโve made it make a path with nms)
Hi guys. I wanna create it so there is a sidebar scoreboard (that displays individual stats to the individual) and a below name scoreboard (that displays the players current health to everyone online) that both display at the same time. Would I need to use NMS to make that work?
bukkit has a scoreboard api that can do that pretty sure
and health is a vanilla scoreboard objective u can add with a command
Command worked but it still dependency doesnt work
Check your paths make sure that's all good. Then make sure you're importing the dep properly
@buoyant viper yes but the issue is when I do two scoreboards at the same time. Spigot only allows 1 at a time
It overrides one when I do the other
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Which web is best
Text Shadows
Path is ok and what u mean by importing dep properly ?
I always just write the pom manually
How are bungeecord plugins different from spigot plugins and can you make spigot plugins compatible with bungeecord?
My custom enchantment is vanishing when im using anvil, any idea why?
they are two different APIs
bungee plugins are for bungeecord, the proxy software
and spigot plugins are for spigot, the server software
Hmm okay
Hey mfnalex, how can i save a map with persitent data container?
if I set a depedency that provides annotations to provided in my pom, are the annotations lost or are they still somehow included in my final .jar?
you need a custom persistentdatatype for that, or you use a new PersistentDataType.TAG_CONTAINER and manually map the included keys to your values
what kind of data does your map store?
i just want to store String-Integer
same when doing with ItemMeta#getEnchants
but string arrays arent included by default
lol
you can either use a normal string and do it like this:
unbreaking,3;someother,4
or create a string array datatype. I have one in my lib:
does a cancelled event get passed to the next listener
yeah
yes depends on the priority
i mean you have the ignoredCancelled
EventPriority.HIGHEST wont get passed
for example a inventory click event, if i cancel with highest priority, will another listener on another plugin with default priority and default other parameters recieve it
can i tell the pom that this isn't to be parsed?
Is there any documentation on https://api.spigotmc.org/
i think
Thanks!
bruh my cat was sitting on my keyboard
@tender shard It is possible to have a map with this? https://github.com/JEFF-Media-GbR/MorePersistentDataTypes
I'm currently adding maps, lists and hashsets to it but it'll still take a few days because I'm currently finishing a new paid plugin that I wanna release
tbh I'd just use a string
okay
I'd really just use a string and store it like this
enchName,1;enchName,2
then split by ;
than split everything again by ,
basically you can just do ```java
for(String enchantment : originalString.split(";")) {
String enchName = enchantment.split(",")[0];
int level = enchantment.split(",")[1];
how do i spawn particles?
doesnt work
?dontworking
lol
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
spawnparticle isnt a thing
Yes it is
your MC version must be at least 7 years old if you don't see those methods
and which direction the cursor moves?
1.8
yea, that's 7 years old
Itโs actually 8
example
it's probably the same value as "facing" in your F3 screen
Hi i have a problem with this ChatColor.translateAlternateColorCodes('&', instance.getConfig().getString("messages"));
i want to translate so i get collerd messages and it's not working
pls tag me
I think 0 is north, 180/-180 is south
it is 0-15
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
ah okay, well then try it ๐ I guess 0 is either south or north
Is messages by any chance a list or an array
Because if so, thatโs your problem
It only accepts a string
yaay
mvn install:install-file -Dfile=C:\dynmap\target\dynmap-api-3.4-SNAPSHOT.jar -DgroupId=us.dynmap -DartifactId=dynmap-api -Dversion=3.4 -Dpackaging=package
What I need to change in command when I want dependency to start working
translateAlternativeColorCodes is for a single string
packaging must be .jar
not package
-Dpackaging=jar
this is the hole code
private List<String> messages;
private boolean random;
private int lastmessage;
public Tips (Out plugin)
{
this.random = instance.getConfig().getBoolean("random");
this.messages = instance.getConfig().getStringList("messages");
}
@Override
public void run() {
String message = "";
if (!random) {
//nytt
ChatColor.translateAlternateColorCodes('&', instance.getConfig().getString("messages"));
try
{
message = messages.get(lastmessage + 1);
lastmessage++;
} catch(ArrayIndexOutOfBoundsException e){
message = messages.get(0);
lastmessage = 0;
}
} else {
Random random = new Random();
int nextMessage = random.nextInt(messages.size());
while (nextMessage == lastmessage){
random.nextInt(messages.size());
}
message = messages.get(nextMessage);
lastmessage = nextMessage;
}
for (Player player : Bukkit.getOnlinePlayers()){
player.sendMessage(message);
}
}
You canโt use that method on a list
Youโll have to iterate through the list
how can i tell a xml that <something> is not to be read as a tag?
i can't compile an option that requires those 'cause of it
< = <
> = >
or use a CDATA
<![CDATA[<]]>
<![CDATA[>]]>
e.g.
<mystring><![CDATA[<]]>Wassup<![CDATA[>]]></mystring>
now "mystring" is "<Wassup>"
oh nice
(I'd rather use gt and lt)
how do i do that?
gt is for "greater than" and lt is "less than" so easy to remember
If you don't know how to loop over a collection, read this:
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
<
for (String msg : messages) {
// do thing with msg from list
}
that was it @tender shard thank you
np
anyone got any idea why my .jar won't run? D:
when I decompile it, the main class looks fine
run the jar from the command line so you get the stack trace
did you setup manifest.mf?
there's no stacktrace
then there's too little information hmm
google that error tho
might be something that doesn't need explaining
hm well doesn't really matters as long as it's running from spigot for now ๐
Ugh I'm stupid. it was indeed the missing manifest because I had this in my pom
:D
I thought that the maven created meta-inf doesn't get removed by the shade plugin
I made a shield that strikes nearby entities with lightning when an attack is blocked, but the lightning also damages the player if there are mobs standing next to him. Is there a way I can temporarily make the player immune to lightning and fire?
set some boolean to true, and in entitydamageevent, check if it's lightning damage and if your boolean is true, cancel the event, set boolean back to false
ignoreLightningDamage = true;
// summon lightning
ignoreLightningDamage = false;
And in the listener:
public void onEntityDamageEvent(EntityDamageEvent event) {
if(event.getDamageCause() == DamageCause.LIGHTNING && ignoreLightningDamage) {
event.setCancelled(true);
}
}
something like this
you could also use a List<Player> or List<UUID> if you only want to exclude the damage for specific players
mfnalex do you happen to be good at math?
depends ๐
if it's just some tiny vector stuff
well might as well try again here.
Thanks!
Hello,
how long it takes for response on unban appeal?
First time I e-mailed them they didn't even respond. ๐
And that was in summer 2021.
i tried using TabCompleteEvent to modify a vanilla command but the event doesn't fire, any help?
i am using an Exponentional Growth formula to determine a price for an "upgrade", now i want to determine the cost of like 50 levels together right. but thats not very easy because the price for each level will differ. now i could loop 50 times and add up the costs but this wont be very efficient as there could be like a million levels upgraded at once. sooo any ideas?
maybe they just don't want to unban you ๐
๐ฅฒ Ban reason : alt account
I just wanted different name at that time ๐ ๐ฅฒ
hm can you show the formula?
I apologized and explained alt account.
sure one second
hm no idea ๐ did you use the correct email address?
it's tmp-support@spigotmc.org
?
You have been banned for the following reason: Alt account. To appeal, please email unban-support@spigotmc.org with details of why you were banned, why you should be unbanned, and how you will prevent it from happening again. Please note that creating a new account is against the rules and will only extend your ban.
private double quadraticBezier(double progress, double min, double max, double total) {
return quadraticBezier0((progress / total), min, max, min);
}
private double quadraticBezier0(double t, double start, double end, double intersect) {
double scalar = (1.0 - t);
double firstToIntersect = scalar * ((scalar * start) + (t * intersect));
double intersectToSecond = t * ((scalar * intersect) + (t * end));
return firstToIntersect + intersectToSecond;
}
i use this to determine the cost.
oh I didnt know there was a separate mail just for unbans
why are you talking about bans here
in help-development
He wants help developing his unban request
My mistake. ๐
You're gonna want to e.getplayer.setbanned(false)
hm if people really can upgrade a million times, then you definitely have to refactor that somehow but tbh I have no idea how. I remember we did something like that in school but that's like almost 10 years ago lmao
Why would they need to instantly upgrade a million times though
well they dont. but server owners have the possibility to configure it that way
i really think i still wont be able to get arround the looping
because owner also have the possibility of changing how its calculated
hey there, I'm trying to make a system which tracks what player has done the most damage to certain Monsters.
my current idea of a solution is to have a hashmap, which stores the uuids of the damagers (only players) and the Double damageDone inside another hashmap which stores the damaged entities UUIDs along with that first hashmap. (The Monsters I want to track for are rather rare)
My current problem is that I assume it will be rather resource intensive to track the damage done and update the hashmaps accordingly, as currently I only see the solution of listing all contents of the inner hashmap inside 2 lists to return the maximum value, aka the max damage. is there any other way of going through a hashmap and returning the key and value of the maximum value found?
Composition
you could just do the loop async and show a nice animation to the player who actually manages to level up a million levels at once, while the server calculates the price ๐
Hi! Im trying to modify the give command to add my custom items, i used the TabCompleteEvent to modify the items list, but it doesn't fire, any help?
hmm how would i do an animation. because i have a gui with a few different options the player could choose from for example 1, 5, 10, 500, 10000. those are automatically determined. but the price is meant to show on the items
it would be a bit weird to just not show the price xD
i mean i guess i could calculate it async and have the player wait for a bit for the gui to open but thats also not ideal
Make it update while inventory is open
So you can have like: "Updating values"
hmmm thats actually not a bad idea
And then replace them
i can have it say "calculating" or something
Yhm
had not thought of that yet
is there command like mvn shade:explain that explains to me why a certain class doesn't get shaded?
yea like mvn clean package:WhereTheFuckIsTheBugAt
theres an option in the pom that if you enable it wont shade unneeded classes
wtf is bounce
maybe you enabled that
bounce on deez nutz
yes, minimize jar, I have that enabled but I used filters to manually add that class
it's working in all my other plugins with similar settings so I am confused
you can create a useless reference to the class
somewhere in your code
/*
* This block prevents the Maven Shade plugin to remove the specified classes
*/
static {
@SuppressWarnings ("unused") Class<?>[] classes = new Class<?>[] {
JButton.class,
JMenu.class,
JMenuBar.class,
JMenuItem.class
};
}
true but I'd really like to know why it happens in the first place ๐
is spigot server open source?
?stash
omg I am stupid
I relocated it to de.jeff_media instead of com.jeff_media so of course I didn't see it
it was actually shaded exactly as I specified it lmao
Hi could someone recommend me some Websocket API for java? Currently i'm using org.java_websocket but websocket connection is not closing when plugin gets disable so Port gets forever stuck
release it in your onDisable method
i do
there's a packet that tells the movement
does craftbukkit just wrap nms
yes orby
or is it a whole different copy
so does a CraftItemStack have a reference to a net.minecraft.world.item.ItemStack
true
craftitemstack as i remember is just a util
Guys, does anyone know how to fix this? I've noticed that my scoreboard flickers (watch the video to understand) I don't know why it does it and I don't have the slightest idea how to fix it
wrong video
i don't know that class
wait what? craftitemstack used to not actually
it was just a util
i mean it seems better for performance
instead of copying literally everything
so it makes sense
but still i thought that too
yes
due to the CraftItemStack.as{}Copy(...)
This is a really old issue. Just search for it on your fav. engine and go through the forum posts.
yes because im using 1.8
Well then dont use 1.8 ๐คท
i dont like 1.9+ pvp
that's your problem then
i managed to stop the video
see this
for some reason it ignores the first 2 lines
this should be the normal scoreboard ๐
i just see an api on github, thanks
@manic delta use scoreboard teams
ah you can create custom nbt tag types
cool
kinda confusing that net.minecraft.tags.Tag<T> and net.minecraft.nbt.Tag are called the same
i wouldve just kept is as NBTTag in the mappings
or is this what mojang uses
the name above its head? packets or scoreboards
yeah using packets
you need to respawn the player client side for everyone with a different name and/or skin
ill write it in pseudo code
because tbh i dont know the specifics either
oh man, generics can get really complicated lol. I wonder if I'll get this to work somehow lmao
package com.jeff_media.morepersistentdatatypes;
import org.bukkit.persistence.PersistentDataAdapterContext;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
public class DataCollection
<C extends Collection<D>,D extends PersistentDataType<?,D>>
implements PersistentDataType<PersistentDataContainer,C> {
private final Class<C> collectionClazz;
private final Class<D> dataTypeClazz;
public DataCollection(Class<C> collectionClazz, Class<D> dataTypeClazz) {
this.collectionClazz = collectionClazz;
this.dataTypeClazz = dataTypeClazz;
}
@NotNull
@Override
public Class<PersistentDataContainer> getPrimitiveType() {
return PersistentDataContainer.class;
}
@NotNull
@Override
public Class<C> getComplexType() {
return collectionClazz;
}
my eyes
List<UUID> disguised = new ArrayList<>();
public void disguise(Player p) {
disguised.add(p);
// disguise for all online players
for (Player online : Bukkit.getOnlinePlayers())
disguiseFor(online, p);
}
public void disguiseFor(Player to, Player toDisguise) {
// send an entity destroy packet to the player
// to destroy the old player entity
// respawn the player entity with an entity create packet
// name the entity with an entity name packet
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
// disguise all players that need to be on join
for (Player p : disguised)
disguiseFor(e.getPlayer(), p);
}
you can name it Class instead of Clazz
people used that to circumvent the class namespace
that looks worse than clazz in my opinion
Set instead of list
why?
its faster
doesnt matter right
true
for removal yeah
I don't like to call it Class
because of all the empty spaces it may contain
no duplicate elements
I always used clazz and Clazz
in my java book they say Clasz
also faster and fancier ๐ฅบ
why do they hate Class so much?
clazz looks like the h4xX0r version of class
Klatz
because "class" is already reserved
it's like naming your variable True
or naming a method For
i dont find this complicated
i guess that's true
even though im not as good
but if it's something like prefixClass, i don't see the issue
its not complex but it looks messy or intimidating when you havent written it
plus i dont know how pdc works so i have no clue what any of this means
it's not complicated until you have to remember what C and D are everytime
comments?
generics
yeah
oh OOOH
what i did in my library is i commented what each generic means
what I don't get is why the default uses T,Z for data types
what does T mean? or Z?
Type is t
and Z?
Zoom
i dont see anyone using Z
I would have named it P and C, for primitive and complex
MD does
^
I understand K,V for maps
How can i get iterator.next method as an integer
but in most other cases, people seem to use ANY letter they just randomly thought of
that shouldnt be there
if you're correctly using the iterator, it.next() gives you an int
or at least doesnt follow naming conventions, an unwritten one if it doesnt exist
ฤฐ mean how can i compare it with an int
List<Integer> list = new ArrayList<>();
Iterator<Integer> it = list.iterator();
int firstInt = it.next();
the class has to implement Comparable?
what are you even iterating over?
or am i understanding it wrongly
hashmap
you can't iterate over a hashmap in the first place
you can merely iterate over it's keys, values, or entryset
Yes
so what are you actually iterating over?
i love atom material icons, except the interface icon
ฤฐ have <String, Integer>
Want to get the integer
iterate over the values
I guess you want to say that you have an EntrySet
Iterator<T>
T next();
the same generic is used
Yes i did it either
just do getValue on the entry
so what are you trying to do?
Iterator<Entry<String,Integer>> it = map.entrySet().iterator();
int number = it.next().getValue();
if you only want the integers
map.values().iterator()
is making client side hacks disallowed here btw
just wondering since while googling about randomness ive found ppl making autoclickers so i thought to make one for fun
though i may ask questions about it here and i wonder if its allowed or not
Map.Entry<String, Integer> entry = players.entrySet();```
Is this true?
yes
no
?learnjava pls
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
what do you think? Is this bad practice if I don't have and don't want to use any plugin for a namespacedkey?
i think it's something like Iterator<Map.Entry<A, B>> it = map.entrySet().iterator();
why not just use the constructor
with a string namespace
it might be
Yes
my opinion at least
alternative suggestion?
deprecated but its faster doesnt need parsing
"Represents a String based key which consists of two components - a namespace and a key" and you're only using a string, which defeats the point
also makes more sense but not a big deal
can you do Thread.sleep if it is not in the main class?
it says "should never be used by plugins"
hmmm lemme think
if youre using the factory method the thing is minecraft:yourstuff
what? no, the _ is the namespace
it does the exact same thing
or will this freeze entire server
fromString("a:b") just calls new NamespacedKey(a, b)
at least that would make sense
Oh
i dont think it will resolve the plugin and then make the key
so youre doing the same thing but more inefficient
sure if it doesnt break the method contract
you may only do that async
it might be 0.00000001 second slower but it doesn't use any forbidden methods
in simple terms, classes dont matter with multithreading
except if they're a runnable
or a thread
bruh
negligible performance boost
ye it does
its not for performance it just seems more logical and 'clean'
because now your just concatenating a string and then parsing it?
when I run a runTaskTimer asycronisly will it forever loop, or will it only do it once
using a deprecated, internal method is logical and clean???
Not sure
forever
until you cancel it
its like placing two lego bricks on eachother and then splitting them apart painfully again
got it
it's more clean to use a method that is deprecated and commented with "no plugin may ever use it"?
yep
lol we seem to have different opinions about what's clean and what isn't
i usually ignore deprecated stuff also paper deprecated like the whole fucking net.md_5.bungee.api.ChatColor
well i try not to use deprecated stuff
but there has to be a good reason for it
I decided instead to use StrikeLightningEffect and setFireTicks to set nearby entities on fire. As for the base damage of the lightning, I am currently using setFallDistance. It works, but it is a bit strange to have lightning damage that can be negated by feather falling boots. My other idea was to set the health of the nearby entities, but it looks like Entities don't have setHealth.
they aren't deprecated, only in paper api
"Optimization matters only when it matters"
hm I think my method would be waaaaay easier
its not for optimization its for readability
