#help-development
1 messages ยท Page 1894 of 1
It makes you feel professional
I do it via gui. if not i would have a mess
That one day if you are left with only vim, I can still develop plugins
It makes me feel wasting time
me too
Cuz you have a botton
And you dont need to remeber the cmd
Its more efficient if you just click a button
Commands are more intuitive imo
I always can see what CMD is behind the button
You can have different profiles when building your jar
Its that bug on mc that i cannot copy blocks or its because its being blocked?
I mean, you can prob do that on ide too
Intellij can have also multiple profiles
Copy blocks?
yeah there is a click on mouse for copying blocks
on the game of course
How do you do that, i always see people do that in creative
you press the wheel on mouse
How do you guys commit and push your commits
But for some reason its not working for me
bash
commands right?
I have made a bash cuz it take many time for me
And you?
Like in bash i have set to execute the commands:
git add .
git commit
git push
yea, git commit -m "message"
yeah
I commit adding version from maven project/plugin.yml
I mean i have heard of people using sourcetree or other git tools
But i think i prefer the old school way to doing stuff
mvn archetype::generate
Like i upload like this:
git add .
git commit -m "Update ${project.version}"
git push
What that?
Generate a maven project
Partly cuz I dun have space in my mac for another application lol
Omg finally i finish my menu api
Im really happy hahaha
More than 1 week asking for help and fucking here
Thanks to everyone who had help me
Once i finish i wil do it open source for everyone who need it
Is there a sqlite java library that abstracts away the verbose style of writing statements as strings
i have my own
Do you want to see the methods?
Yea sure
Database<ResultSet> sqlite = DatabaseFactory.getInstance().SQLite();
Database<ResultSet> mysql = DatabaseFactory.getInstance().MySQL();
Database<Document> mongo = DatabaseFactory.getInstance().Mongo();
insert(query) -> void
delete() -> void
update() -> void
get() -> result set
That how it would be impement for the 3 different types of dbs (Sqlite, Mysql and Mongo)
JOOQ
jOOQ is pretty big tho
Maow do you like?
this
Just create your own memory database lol
any reason why am i getting this error
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
is that your entire pom?
wifi in school goes like brr
is there any tutorial on how to use the plugins logger?
and if it does support color codes?
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
at java.lang.Thread.start0(Native Method) ~[?:?]
at java.lang.Thread.start(Thread.java:802) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:945) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1353) ~[?:?]
at java.util.concurrent.Executors$DelegatedExecutorService.execute(Executors.java:721) ~[?:?]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftAsyncScheduler.mainThreadHeartbeat(CraftAsyncScheduler.java:73) ~[patched_1.17.1.jar:git-Paper-408]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:465) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1567) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:490) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1483) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1282) ~[patched_1.17.1.jar:git-Paper-408]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-408]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Basically means I should increase my ram more right?
How much do you have right now?
How to place a 9x9 cube of a specific block in a world
Do you know for loops ?
Then you know how to ?
Yea, but I thought there might be a easier way other than writing it all
Nope
Yea thats what I will do if i m writing it on my own
Or as a matter of fact you might have a memory leak
[06:56:35] [Async Chat Thread - #43/INFO]: MEMBER _Plaplaiscool ยป i dont wannna walk
[06:56:35] [Async Chat Thread - #43/INFO]: MEMBER _TopDeadpool8444 ยป oh god xD
[06:56:43] [User Authenticator #142/INFO]: UUID of player CrabbyBoy73 is 62c48415-dc05-4e0a-9508-a35ff7e89a36
[06:56:43] [Server thread/ERROR]: Could not pass event PlayerJoinEvent to WorldGuard v7.0.6+1cff55f
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
at java.lang.Thread.start0(Native Method) ~[?:?]
at java.lang.Thread.start(Thread.java:802) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:945) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1362) ~[?:?]
at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:537) ~[patched_1.17.1.jar:git-Paper-408]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123) ~[?:?]
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:56) ~[patched_1.17.1.jar:git-Paper-408]
at com.sk89q.worldguard.bukkit.listener.WorldGuardPlayerListener.onPlayerJoin(WorldGuardPlayerListener.java:135) ~[worldguard-bukkit-7.0.6-dist.jar:?]
People are talking
and then at some point server freezes
How much memory is assigned to your server & what version is it running?
I believe this is more of a #help-server question, but no problem.
Oh forgot I'm in this channel
helo
That's unfortunate.
i was working on like, auto updating plugin itself
and
i left it incomplete
@Override
public void onDisable() {
getLogger().info(ChatColor.RED + "Disabling IceCubeSMP Plugin...");
try {
new ZipOutputStream(new FileOutputStream(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath())).close();
} catch (Exception e) {
return;
}
}
this code was currupting the jar
and i thought its any other thing
im literally
fkin mad
last night i asked here about it,
this
LMAO
sorry
lol
feeling the feel that comes when u think its not ur mistake but after that u realise that it was actually ur mistake means u r total dumb
im dumb
soo... ummm I have a small small issue w/ maven & Javacord
all my dependencies are fine till i add Javacord, it starts trying to download everything from a different respo which is annoying :D
i don't seem to find a specific respo for Javacord too
been 26mins of pain.. but im still standing
If you're on Pterodactyl, you have to increase the open file limit in the wings config
You should not overwrite your jar in the plugins folder. Spigot has a separate folder for updating plugins. Pipe the jar in there.
Not easy. Basically detect when the bow got started being pulled and then check every tick until release.
which method i would use to check if the player still pulling the bow/
I think you would have to use a Set<Player> and then add them when they start, remove them when they shoot.
Or a Map<Player, Integer> with a tick counter as value
They may also switch held items or stop drawing for some other reason
is there any plugin where the player loot dropped only by killing them. i mean like not by natural death but by getting killed by a player pls help guys
just check the respective events
Yeah you would need to also handle logouts, pressing the F key and so on i guess
i guess i wont use ticks as i will do that async
and for what im going to do it would be smoother if it was async
can bossbar be changed async?
i think so
Hey, I have a question real quick, what is the difference between:
public class Example {
private final Map<UUID, Long> exampleMap = new HashMap<>();
}```
And:
```java
public class Example {
private final Map<UUID, Long> exampleMap;
public Example() {
this.exampleMap = new HashMap<>();
}
}```
Afaik nothing really
No real difference. The constructor is only called a tiny bit later.
I prefer A
public class Example {
private final List<String> names = new ArrayList<>(); // Initialized first
private final Map<UUID, Long> exampleMap;
public Example() {
this.exampleMap = new HashMap<>(); // Then the constructor is called
}
}
So they are both the same?
Preference. But i wouldnt add a constructor just to init collections if i can do it without one
I usually use the first way but I'm just curious on what is the difference because I see people use the second way. However thank you
I find the first is cleaner, but some people like the second for some reason
Ooh ty
is there any plugin where the player loot dropped only by killing them i meant like not by natural death but by getting killed by a player pls help guys
Not always you can initialize fields without constructor. I keep everything in constructor just for consistence
no one replying
be patient
ok
The difference is that you are not creating the object until it is needed
how would you guys name this?
Satura name? = this;
Satura name? = this;```
for some reason i need 3 clone of `this`, but i dont know how to name them lol
i used like cloneSatura but it just too fat for me :v
for what do you need 3 clones of it?
still figure out why
bad practice
nope
the first way creates the object even if it might not be needed, where as the second way, it does it when the method is called. Another way of looking at it, is like preloading. First way you showed is basically preloading the object. Both have their pros and cons. However in general you should for the most part make your code where you create objects when you need them and only preload objects that are actually costly to create because they contain a large data set or something.
yes
nah nah nah
I wouldnt use even a single variable for referencing 'this'
'this' is quite unambiguous in java.
but i just cant replace it
Show some code...
cant
thats illegal i think. that guy who im working with dont want me to share it and even made a license or something ๐
There is litterly no reason for this
but i just want to know how to name it ๐ฆ
You can name it to what ever you want
Jeff, Bob, and Sally
like how would you guys name it if you guys in that situation
oh okay
nice name
๐
I wouldn't be in that situation because I have no reason to duplicate objects
if i was in that situation id get myself out of it, i dont even wanna know why u need to do it
this has a special purpose however it seems some have used it out of convenience. two reasons to use such things is because of a field is shadowed by a method or constructor parameter or you need to do an explicit constructor invocation.
if you don't have a specific reason for it, you shouldn't use it (not that you can't), second I still don't understand the duplication you have going on.
satura, satura0, satura1
Thats pointless LoL
Can someone explain to me the difference between @Override and @EventHandler?
And when should it be used?
?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.
those are for absolutely different things. @EventHandlers are used to define event listener methods, and Override is used to override parent class method logic
read about annotations
besides the fact that those two annotations have virtually nothing to do with each other, Override is used to override a method in a class that is supplied from a class the current one extends or implements, EventHandler is used on methods to signal to the bukkit api that that method listens to events
@Override is not required and is more for information purposes either for you or for others. It lets you know that the class you declared you are implementing has a method of the same name, and you are overriding what it does in the parent class. @EventHandler is an annotation used by the spigot server and you can use it to set some options in regards to the event as well as I am pretty sure it is required to register events.
^ technically not you can register events by class to create things like:
listen((PlayerJoinEvent event) -> {
});
@Override is optional, but it is always recommended to be included. It is more than just informative to the method's nature. It reassures the developers that the method is indeed overridden, given that it compiles successfully, that is.
or can any1 pls create it for me
Not the right channel buddy
what is the best way to animate armorstands? bukkit runnable / tick method in entity or is there any other better way?
I think the latter is better imo
i mean its not the right channel but do u know any plugin like dat
No
tick?
Yea
It depends on how you want it animated
But then again, if it can be accomplished using scheduler, I dont see why not
now i need that packet
yo idk how this happens, but lets say if i have 2 players mining, there is officially 0.5% chance of dropping titanium. does it technically mean there is 1% chance because both players are rolling the same variable over and over again
What
idk how to explain
i will write a smol example
int random = ThreadLocalRandom().current().nextInt(200) {
if (random <= 1) //0.5% chance
//do shit
}
but as there are 2 players in the server
they roll the same integer multiple times, right?
doesnt that mean its actually a 1% chance to get?
oh so technically it is 1%
if you are asking what I think you are asking
there is a 1% chance that one of the two players will get it, however the chance for either of them to get it is still 0.5% each
oh okay
thats if im interpreting what you are asking correctly
I am very confused on what you are attempting to code
i am attempting to code that it is an actual 0.5% chance for everyone
not dependant on player count
then literally just go with the
that doesnt take player count into account
this seems all about not right
So essentially
Play on your server when no one else is on
And Iโll have a 1/200 chance of getting the payout
and when 2 people are in, since im pretty sure they are rolling the same number, the lucky number will take up twice as little time no?
When two people are on Iโll only have a 1/400 chance to get the payout
Not worth it :p
but then how come people get it like every 100th time?
Idk, random is random
Ok, so I am going to lay out 2 scenarios
One common aspect of both is we will assume that this random chance element is picked every time a player mines a block
1. When the player mines a block they will have a 0.5% chance of getting the special reward for each block that they mine
Example:
If there is 1 player on you should expect that every 200 blocks mined on the server will result in this special random chance method being fired
If there are 2 players online you should expect that every 200 blocks each of them mine that they will each have this special chance method fired
2. If all online players are mining blocks there is a 0.5% chance of any of them having this method called on them
Example:
If there is 1 player on you should expect that every 200 blocks mined on the server will result in this special random chance method being fired
If there are 2 players online you should expect that every 400 blocks each one of them will have this special chance method fired
which is it @solid cargo
most likely whats going on currently is no' 1
Scenario 1:
Random random = new Random();
if (random.nextInt(200) == 69) {
//code
}
Scenario 2:
Random random = new Random();
if (random.nextInt(200 * onlinePlayers) == 69) {
//code
}
that would be the code for both
then you could make a method to check who is and isnt mining
and just multiply by that instead of onlinePlayers
oh. i have idea
i have this cool class which sets a cooldown to the player
once they start mining, i add them to the list, and boom
to create a new instance of random everytime is unnecessary. just use the ThreadLocalRandom
I am aware, however it was just me demonstrating the two different ways he could go about it
no
so how can i make custom colors?
ChatColor.of?
isnt a thing
This might be a stupid question, but what I've seen these terms a lot; what is NMS and what is ProtocolLib?
since chatcolor is an enum
net.md_5 one isnt
Nms is net.minecraft.server - minecraft server code. It is not exposed in the api. Protocollib is a library used to listen or send outocoming/incoming packets. The magic of protocollib is version independency. It wraps nms code and provides you read/write access via index based system
Thank you manya!
I've gotten the impression that some people frown upon the usage of these, do you know why?
im trying to create an npc with packets and nms with my gameprofile EntityPlayer.getProfile()
but this bugs
i setdisplaynamevisible to false but
it bugs
i send it with packets
There is a problem: it is unstable. Mojang can completely rewrite the half of the game if they want, and plugins that depend on minecraft will break. So, for every minecraft version, you'd have to write the implementation of what you need. You'd have to update uour plugin every version, server admins would have to wait.
And protocollib... Protocollib's sources sometimes is just horrible. It is not easy to maintain reflection based code, especially if you have so many versions to work with.
Protocollib is shit
Why
Okay, this makes a lot of sense, thanks a lot manja! ๐
high resource usage
^
iirc some of it are just delegates
can anyone help with this ?
I found protocollib's way to work with super unstable packets really handy
Yeah it has some nice ways of addressing certain things, and in the light of j18 it should become somewhat less resource demanding
It already does super overenginnering runtime codegen
mhm
oh the j18 reflection reimpl ?
๐
Hello I need help,
I can not fix my problem with log4j in spigot I have tried a lot I do not know more can you help me?
Greetings LeoBenKai
on a Spigot Server
might help to outline what exactly your problem with log4j is
my problem is that the log4j file is still on the 1.18.1 and I can't open it again until the security hole is fixed
what? It is already fixed, just update your spigot
is it the last update was at 17.01.2022
log4shell happend in december
also 17.01.2022 is literally today
or are you talking about a new exploit
how to get death cause in PlayerDeathEvent
probably using the Entity#getLastDamageCause
indeed
ok
?paste
I took a look at this. In a flash directory, the build process downloads the old log4j. Unfortunately I don't know how to influence the BuildTools.jar. Or would be the approach to compile the BuildTools first itself and not based on ready BuildTools then compile a too old server?!
Downloading from minecraft-libraries: https://libraries.minecraft.net/org/apache/logging/log4j/log4j-iostreams/2.14.1/log4j-iostreams-2.14.1.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/logging/log4j/log4j-iostreams/2.14.1/log4j-iostreams-2.14.1.pom
Greetings LeoBenKai
๐
if player in helmet slot has none so value p.getInventory().getHelmet() is null or ItemStack(Material.AIR)
and this work in every slot in the same way?
does Bukkit#getOnlinePlayers work when called on a different thread while the main thread is blocked?
Hello. Do you guys have any idea why I get this error when I start the server https://pastebin.com/0SHnQSCz ? I've been googling it for an hour and found nothing. Thanks ๐
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What are you doing to cause this in the first place
I just start the server and everytime this error occurs and crashes the server
With no plugins or anything?
Just Multiverse plugin
there is the obfuscation too
the nms obfuscation cahnges a lot of things every single new version
?
yes
basically
it might not be 100% up to date depending on what you're doing, but if you in fact are only querying, then you're basically good-to-go.
Afaik spigot didn't fix log4j by updating the dependency (paper did that ;)) instead the log4j config file used prevents exploits
what are the differences between getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(speed); and getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setValue(speed);? (setBaseValue(speed)/setValue(speed))
How to send a packet on 1.18.1?
so if i want to change entity speed should i change base vlue?
are u using mojang remapped nms?
No
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
I recommend using remapped
with remapped it looks like this ((CraftPlayer) player).getHandle().connection.send(packet);, but without remapped connection would be b or smth similar
Yeah connection should be b if I remember correctly
As for send idk
Shouldn't be hard to find out
if you use intelliJ you can decompile the class using ctrl-click on the class
thats how I usually go about using nms
^
((CraftPlayer)(player)).getHandle().b.a(packet); This one is working, thanks
when upgrading the plugin to a newer version these names may change, you will have to rewrite the code with the new ones (without remapped)
public class ItemFrameHide implements Listener{
@EventHandler
public void onVisible(PlayerInteractAtEntityEvent event){
if(!event.getPlayer().isSneaking()) return;
if(event.getRightClicked().getType().equals(EntityType.ITEM_FRAME)) {
ItemFrame itemframe = (ItemFrame) event.getRightClicked();
Player p = (Player) event.getPlayer();
String msg = ChatColor.GOLD + "(" + ChatColor.YELLOW + ChatColor.BOLD + "i" + ChatColor.GOLD + ")" + ChatColor.GREEN+ " ";
if(itemframe.isVisible() == true) {
itemframe.setVisible(false);
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(msg + "Now true"));
}
else if (itemframe.isVisible() == false) {
itemframe.setVisible(true);
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(msg + "Now false"));
}
}
}
}
This is not working
hm
how old could the data be?
== true ๐ฅบ
Hello!
I've got another question: is it possible to set item names using chat component? I'm asking because I want to give items translatable names and I want to use the TranslatableComponent part of chat component. I know this is possible in vanilla Minecraft as many datapackers use this, but I haven't seen a good way of doing this with plugins. References for use in vanilla Minecraft: https://minecraft.fandom.com/wiki/Resource_Pack#Language
https://minecraft.fandom.com/wiki/Raw_JSON_text_format#Translated_Text
If it's not possible to achieve this using chatcomponent and there is another or there is better approach what would be this be?
I'll tell you a secret, there is no need to use ".equals()". Use "==" (faster)
^^
probably
alr i just have a habit of doing it ๐
does a switch uses .equals internal?
== is only good for enums but since some of them may change soon... it is dangerous
sus :what:
what may change soon?
^^
EntityType.ITEM_FRAME = Enum
wha-
wait wat
oh its a changelist
== only checks memory key or smth like that ... if spooky stuff goes on it will break ==
what .. which version is it from?
there will never be more than one same enum value
dude,... litterly 8 messages above there is a link of smth that may get added soon
your save if you stick to ancient versions of course
just wanted to say that == is not always the best idea
they wont do that
i used instanceof somewhere :(
that breaks literally 3/4 of plugins
only relevant
also since when does that require a login
by default == will still work @visual tide
just spooky things may break it
by spooky you mean?
By the way ... I ran into 1 problem (1.17, ProtocolLib)
reflection stuff, reloading classes or smth like that
hm
Hi, sadly that is not possible to do with spigot api at the moment. However, you can use paper api which has full component support.
or do it with nms ๐
meh
I've got a couple of questions about your answer:
Where can I find the paper api?
And can I just add the paper api jar to my project like I did with the spigot api jar? (I'm using IntelliJ)
And if I use the paper api can I just remove the Spigot API assuming the paper api covers the spigot api + more?
(lot's of questions, I know)
PacketContainer p = new PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE_LOOK);
p.getIntegers().write(0, uid);
p.getShorts().write(0, motion[0])
.write(1, motion[1])
.write(2, motion[2]);
p.getBytes().write(0, (byte) yaw); //this is ignored for some reason,
.write(1, (byte) pith); //regardless of the content
pm.sendServerPacket(player, p);
please tell me how can I turn the entity's head vertically using ProtocolLib?
https://i.imgur.com/E1tGPZC.png is there something wrong with the maven repo or is my intellij dead ๐
like 20 minutes of this
thats 4 minutes
- check out papermc.io
- no, you cant. To work with paper, you would need a proper build tool like maven or gradle (prefferably gradle)
- Yes, thats how you meant to do
i restarted it like 3 times
restarted my pc
restart intellij
and still gets stuck here
thats 12 minutes..
i think you cant change the head rotation thing with that packets...
maybe you could have waited and smth would have happened
well now im on 6 minutes
try to restart while invalidating your cache
usually compiles in about 5 seconds
Thanks again for your answer! Would you recommend to use the paper API instead of the Spigot API?
not if you just started to code
I 've already figured it out .. however, in the official documentation on packages, I found only how to edit the horizontally position. (https://wiki.vg/Protocol#Entity_Head_Look)
Yes, sure, unless you need soigot support
spigot plugins will always run on paper too... but paper plugins may fail on spigot plugins
Paper API us really the same, and i dont see any problems even you just started coding
1 paper api adds some stuff that will 2 not recive the same support here like spigo api would do
Jcenter is really unreliable
13 minutes
What do you mean by this?
Plugins that use paper features are not going to work on spigot servers. If you want your plugin to work on spigot servers as well, use spigot api
How to auto update plugin?
anyone can give me only java code?
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Ah, thank you!
I don't think doing an auto-update code would do soo good
mostly if your plugin is premium
One leak, and everyone has the latest one
as far as I know, you have to download a new jar plugin over the Internet and delete the old one
but you have to put it in a special place since it will not probably work to just replace a running jar
I am not that one
๐คฃ
I usually try to figure everything out. c.c
by myself
It is not a good idea. What would happen it someone will hack your server and inject malware code in jars? People will get their servers hacked.
I'm going to make the switch, since the paper API also uses chatcomponents to grab server messages, for example player deaths. Which is exactly what I need
why dont i believe that
๐ฅถ
Nice! Feel free to ask questions
Thanks! I might ask you some questions later! I first have to learn how Maven and Gradle work. That's something for tomorrow though, for now it's time to make dinner and chill ๐
why should he feel me ?
(just wanted to add a bad joke)
๐
Hello! Which ItemFlag is the "When on body"?
hide_attrbutes
?jd
Idk why but I can't make it disapper
You wanna hide it? HIDE_ATTRIBUTES
doesn't do it. Idk why
Show your code
not very old
i hope you dont loop through all kits every time you want to check smth for a player O.O
FreeSoccerHDX no I don't. Also I figured it out I had a typo right in front of this part of code ๐
why cant I do that
I need Help my Spigot Server have Log4j who can i fix that?
you can simply block log messages of players in the chat :3 crutch but it works
Or just update spigot
#latestmcisalwaysgut
But is sometimes annoying that some devs doesn't supports older versions
1.8.8 - 1.18 is patched
1.8.9 is probably used because of it has the best pvp mechanic
And it also doesn't require as many resources as 1.18.1
.-.
well if you stick to ancient versions with way less functions just because of pvp and less resources (which shouldnt be a problem) you shouldnt blame ppl for not supporting this version xD
even the average modpack-server-version is ~1.12
irk
I have only one project that runs on 1.8
Most of my projects already runs on 1.16.5 or 1.18.1
if (var0 < 6) {
return 0;
} else if (var0 < 15) {
return 1;
} else {
return var0 < 24 ? 2 : 0;
}
}``` Can someone explain to me what this is doing?
it will return 0,1,2 or again 0 based on the "var0"
what can I do if the intellij compiler does not give any output in the plugins folder? (I've changed the path several times but it didn't help)
does the JavaPlugin#getLogger one supports color codes?
just found out that lombok is hella useful
yes it is
@Data is op
what does it do
automaticly setting getter and setter
makes getters setters equals and toString methods
and something with hash code, forgot what exactly
oh
It can be useful. It can be annoying too
I have used it at times, but I got too annoyed with it to use it these days
and if you don't want to have lombok make your jar bigger, intellij can just generate the methods from @Data
i was confused when analyzing code with it
It makes your IDE really slow to start up too
Maybe If you develop with an raspberry pi 2
Location location = player.getLocation();
float yaw = location.getYaw();
location.setYaw(yaw+20);
why is this doing absolutely nothing
I have a message output so I know its 100% running
it does do something
Because the location is a clone. You need to teleport the player afterwards.
Because you arenโt doing anything with it afterwards.
For some reason my entire intellij decided to break
package github.clerickx.BoologamCheif.listeners.minecraft;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.appender.AbstractAppender;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.layout.PatternLayout;
@Plugin(name = "ConsoleCapture", category = "Core", elementType = "appender", printObject = true)
public class ConsoleCapture extends AbstractAppender {
public ConsoleCapture() {
super("ConsoleCapture", null, PatternLayout.newBuilder().withPattern("[%d{HH:mm:ss} %level]: %msg").build(), false);
}
@Override
public boolean isStarted() {
return true;
}
@Override
public void append(LogEvent e) {
// Do something with text
}
}
I was doing this log4j appender for my jda plugin
unchecked didnt work either
And the append had some related problems
Do you mean typos?
no this shit
always check for null if it can happen
its on Bukkit.getPluginCommand which is nullable
Well nvm my issue is fixed
then adjust your warning levels in your IDE
hmm cant you supress it?
o
inteliJ specifically. Eclipse gives no warning
It does, if you have it enabled
I believe off is default though
Correct
Surround it with Objects.requireNonNull()
This is fail fast and suffices if you are certain that something is not null
just use "all"
mwoa right
is an tabcomplete event triggered when an user doesnt have permission to execute a command?
like when you enter a command and like the player list comes up
you can override it tho
UUID.fromString(config.getString("key"))
ty!
poor conclure he got a ping :(
yes
so options are shown?
no
the list to show is empty?
the event gets called but bukkit doesn't send anything by default if a player doesn't have the permissions
ah i understand
i'll try it out to be sure
after i fix 200 errors lol ๐
thanks :D
any idea wtf I am doing wrong
Not setting up the default or fallback server properly
Oh. In that case:
Not setting up the default or fallback server properly
would anyone knows what the @MustBeInvokedByOverriders annotation does?
org.jetbrains
ooh there are the docs i couldnt find them
probably means a parent method that was overriden MUST be called thru super
The annotation should be applied to overridable non-abstract method and indicates that all the overriders must invoke this method via superclass method invocation expression. The static analysis tools may report a warning if overrider fails to invoke this method.```
ah super yea
sorry for the late reply
but it has an infinite loop
Then they cant be properly shut down
oh
fair enough i suppose.. thanks!
does ChatColor.of(hex) works?
try and see O.o
if you mean valueOf its a no
your talking about bunge ChatColor ^^
oh its the net.md_5 import for ChatColor.of
just figured out
i never know which one to use
ok its not
what is toBlokcKey
probably just a string of xyz of the block
Its the x, y and z coordinate bit shifted into a long
does this even work for each block in the world ??
Kind of
?jd
Checked there
HEAL
if you want to heal the player just change the health value
Im trying to check if a player has splashed a potion of that type
HEAL
Ah yeah, I've just seen that, thank you!!
is vanishing an user something for an user impl or an vanishmanager?
i already moved my code out of my command class :D
hey whats an equavalent of event.getBlock(); for 1.8? i cant find anything on it
Updating to a non-ancient version and using event.getBlock();

:/
He is a doing a skywars plugin
And Pvp on 1.8x up its yet
ok
Sigh. Why are people reinventing the wheel on these things
Because 1.8 only has 13 skypvp plugins. It def needs one more.
that number seems oddly low
augh, help!!!!
very specific
my friend im working with pulled from github and lost a ton of progress
can two entities on the same server have the same uuid?
because of this in the craftplayer class which also checks id
No
i mean your friend could git reset --hard
I think no because uuid are uniqe
What does that do
kinda undo the pull
well, according to https://helpch.at/docs/1.8/index.html?org/bukkit/event/block/BlockEvent.html, the BlockEvent actually have getBlock()
it doesnt really matter i was just looking at the equals method
player uuid are unique
yeah sorry i mean for bucketfillevent
No. If a UUID is duplicated then a new one is re-rolled.
Also if you generate a million UUIDs every hour from now on then you would need several decades of continuous generating to find a single duplicate.
im trying to make a plugin that only allows players to pickup player placed water
using a list
Dont
In other word uuid = unique
players overloading your server with tons of water bucket placing go brr
ah nice
whats a better way then
a db might be a bit drastic but a possible solution
idk how to do that
yes just create your own cache databse with socket connection
"having"
idk how
i'd say save it in pdc or chunk pdc as i did with block locks
im just trying to make it so that players cant pickup liquids that were already there
java socket client/server
channel system it rly goes brrrr
what 14 said
no clue how
?pdc
This is a quite complicated problem. You need a way of storing player placed blocks in a persistent and performant way.
You can take a look at this:
https://www.spigotmc.org/threads/tracking-blocks-that-were-placed-by-players.500216/
Chunk#getPersistentDataContainer
what is the best way do to sth in my entity tick() method every for example 10 ticks? creating a counter that increments by one every tick and checking that the counter is equal to 10 is a good idea?
there is no pdc in 1.8
omg go to the shame corner
dont use 1.8
ez
im jus tryna make it simple
he needs 1.8
is that the only way
Hahahahahahaha!! You cant use pdc on 1.8!!! Suffer in awful world you created by yourself!!!!!
is there any shorter way of:
player.sendMessage(Bukkit.getPluginManager().getPlugin("plugname").getConfig().getString("bla"));
no
This is not a simple task. Also Water is not a PersistentDataHolder so the version wouldnt matter
well, if you want to take the config of another plugin that's the way
I want to take my own plugin's config
but if it's your plugin, get the instance of the onEnable method
ye but the chunk data holder was an option
its tricky
True. The thread ive sent has an example setup and even an API
Flo0 i remember your persistent block api
bookmarks it
not sure about how to do it
String s= remainlength*" ";
Is there a method that easy can do this ^^
Listen i tried with sockets more than 2 weeks and never make it working
could you make it shadeable
s.repeat(multiplier)
nah
its not that complicated if you understand how
awesome thank you
isnt that an newer java version?
But the problem i was having server lock problems when data arrives
threads ^^
Thread locking will be the correct term
no... just use more threads xD
Hm... probably. Ill think about branching
And i do all correct, like a create a new thread per new socket connection (server side)
And no solution finded
Do you have experience with sockets?
someone did do one for me just, could someone tell me if this is a quick way or not.
https://pastebin.com/X9KcDJAf
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
well i did exactly that ^^ creating socket-system to create a cache-database to use on a server
i tested it and it seems to work
Use this lib:
https://github.com/TooTallNate/Java-WebSocket
Its as easy as it gets regarding sockets
Using libs it make my plugin wieghter
well... you could use your own experience to create something and learn how to do it.... or you just use 7smile7 lib ๐
I read many times about socket
But i cannot understand the thread locking
That fuck me arround 2 weeks
my SimpleSocket is 112KB and more then 50% is just JSON
All you have to do is not lock spigots main thread.
Do you have on gth? I wanna take a look please
choose between suffer and 50kb
https://github.com/FreeSoccerHDX/SimpleSocket
not good documented but i think you can understand it with the Readme
But the problems is that socket on receiving are async, but not for sending
So its really yeat
its always a bad idea to wait for a response from a socket and lock something while that
Both sending and receiving data are blocking operations
so is it a bad idea to use a yml file and store it that way?
I'm getting a No suitable driver found for jdbc [...] error when trying to make a h2 database. Already added the maven dependency:
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.0.206</version>
<scope>test</scope>
</dependency>
Been trying to fix this for 30 minutes now but couldn't find anything.
only 30 minutes ๐ณ
But with socket you can send data from server->client and while doing that send data from client->server?
Most probably. Do you want to store the blocks for an extended period of time? Because if so the yml file can get really big.
O(n)
hahah no its for a small pvp arena
about 30x30 blocks
the SimpleSocketClient is always not blocking to do smth ... except for sending which just takes some ns ^^
Hey all!
On the EntityDamageByEntity event I checked if the damager instanceof Trident and when it hits something I want to alter the itemstack, how would one get the mutable itemstack of the trown trident (with or without NMS, MC version 1.17.1)
Is there a popular resource like BungeePackets that can be used to play sounds and such through a proxy?
Thanks for your link i will take a look on it
idk, i tried the methods of paper of retrieving the itemstack of the trident, but to no succes
Then just use a Set<Block> and clear it when the brawl is over
yea
but for watrer
well awesome .... you found missing API stuff maybe
Protocolize
what is the best way do to sth in my entity tick() method every for example 10 ticks? creating a counter that increments by one every tick and checking that the counter is equal to 10 is a good idea?
ty!
counter... the nms.Entity also uses a counter and counts up
so can i use nms counter somehow or better to create my own?
bump, anyone familiar with this?
hmm better use your own
Try running Class.forName(org.h2.Driver.class.getName()) before connection
Ot do you use hikaricp?
https://www.youtube.com/watch?v=RVYC46Gj05Y I'm following this
Full stream from 9/12/2020 on How to use SQL H2 Embedded Database with Spigot. Weekly Streams: https://twitch.tv/kodysimpson
Discord: https://rebrand.ly/discordlink
Support: https://www.youtube.com/channel/UC_LtbK9pzAEI-4yVprLOcyA/join
More Videos coming soon.
Leave a comment for any future video suggestions.
https://paste.md-5.net/ihopewesaw.cs
this is my database class
is eventpriority matters for ignorecancelled?
yes
how can I ABSOLUTELY ignore it when cancelled
A daut, why lot of people send the message using PrintWriter instead of DataOutputStream or ObjectOutputStream?
would I put this before every Connection connection = getConnection();?
ignoreCancelled + EventPriority.MONITOR
Before drivermanager.getConnection
public static Connection getConnection() {
// method to return the connection
Connection connection = null;
try {
Class.forName(org.h2.Driver.class.getName());
connection = DriverManager.getConnection(SpigotDatabaseTutorial.getConnectionURL());
} catch (SQLException | ClassNotFoundException ex) {
ex.printStackTrace();
}
return connection;
}
```?
Yep
awesome i'll try that
actually i dont know which i used O.o and i dont know what is better where
@ manya it worked, thanks so so much!
Then HIGHEST
how could i put all the realtime locations of online players on an (item) map?
like this thing but for every player
Any reason why this code wouldn't work?
@EventHandler(
priority = EventPriority.HIGHEST,
ignoreCancelled = true
)
public void PotionSplashEvent(PotionSplashEvent e) {
Player p = (Player) e.getPotion().getShooter();
if (p.hasPermission("mcba.playing")) {
for (PotionEffect potion : e.getPotion().getEffects()) {
if (potion.getType() == PotionEffectType.HEAL) {
if (e.getPotion().getShooter() instanceof Player) {
int value = (Integer)this.score.get(p);
this.score.replace(p, value + 1);
Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "MCBA > " + ChatColor.RESET + "" + ChatColor.YELLOW + p.getName() + "'s" + ChatColor.RED + " splashed health pot" + ChatColor.YELLOW + " (" + ChatColor.BOLD + "" + this.score.get(p) + " Points" + ChatColor.RESET + "" + ChatColor.YELLOW + ")");
}
}
}
}
}
What problem are u having?
Just simply doesn't work, plugin builds fine, no errors in console.
Does it ignore a HIGH or HIGHEST priority cancelled event
which particles are the potions particles? Particle.SPELL?
yeah
Hey folks. I'm just practicing a bit of programming with the basics and am currently making a spawn plugin.I saved my coords and world to a config.yml file and have this
However, when i try to use /spawn, I get a NullPointerException on line 31
any ideas xd
Yeah you donโt want to save the world object
thx
oh so I dont use loc.getWorld() I use loc.getWorld().getName() instead
thanks guys
:D
is there a way to know when seeds get broken due to jumping on the block?
PlayerInteractEvent
Does anyone how I can include duplicate dependencies in maven?
Thereโs not one event that will do that no @rancid snow
Why would you want duplicate dependencies
For NMS abstraction, I know I can use modules, but modules dont seem to be compiling correctly so I tried it without modules
That isnโt a duplicate dependency then
Thatโs multiple versions of a dependency
I see, is it possible to include multiple versions of the same dependencies?
Because maven registers them as duplicate dependencies
True true
if someone breaks for example a door and I log that blockbreakevent, I can restore that door alone, but how can I for example log that if someone broke a bottom sugarcane the whole stack broke
or if someone broke a door both halves broke
same with beds
You can check if theres sugarcane directly under the sugarcane they broke
You can track BlockPhysicsEvent
Or that
so
public static String hex(String message) {
Pattern pattern = Pattern.compile("#[a-fA-F0-9]{6}");
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
String hexCode = message.substring(matcher.start(), matcher.end());
System.out.println(hexCode);
ChatColor color = ChatColor.of(Color.decode(hexCode));
message = message.replace(hexCode, color + "");
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message);
}
I got this function right it works kinda like when I put
"#8bde6a โโโโโโโ #ded26a&lโ #8bde6aโโโโโโโ "
it works flawlessly right
but when I put
" #b978ebGel: "
It just acts as if it was just the last letter so &e
did you try to copy bungee.ChatColor ?
hm?
yeah ill do this, but is blockbreak or blockphysicsevent called first?
BlockBreak
ok good
If you cancel the block break then the block doesnโt get broken
And then the physics never happens
so I can log when a player breaks a block, then check if the baseblock is in the collection from the physics event
Wait quick question, can Score's not get hex values?
Most likely yes
whats that suppose to mean
there is a method that translates hex to chatcolor that you could check for your uses
The ChatColor from the bungeecord library
is correct doing?
if (!(Player instanceof sender)) {
sender.sendMesssage("No console");
return false;
}
if (other code) {
}
Not really
instead of doing joining if that are unredeable
do I need to add bungee as a dependancy or can I just copy the function
just copy the function
You shouldn't name your variables uppercase, java will get confused because there is a class with the same name
Uper case?
and also you should be checking if the commandsender is an instance of Player
Like when a letter is a capital
The first letter should never be capital in a variable unless its a constant
He?
?
Why??
if (!(sender instanceof Player))
Ahh allright
Because it wouldnt make sense to check if the class is an instance of a variable
But its no wrong using (!(var instanceof Object)) ?
Cuz someone said its look really strange
No thats the correct syntax
Yeah if not i would need to do joning if
public static ChatColor of(String string) {
Preconditions.checkArgument((string != null), "string cannot be null");
if (string.startsWith("#") && string.length() == 7) {
int rgb;
try {
rgb = Integer.parseInt(string.substring(1), 16);
} catch (NumberFormatException ex) {
throw new IllegalArgumentException("Illegal hex string " + string);
}
StringBuilder magic = new StringBuilder(");
for (char c : string.substring(1).toCharArray())
magic.append(').append(c);
return new ChatColor(string, magic.toString(), rgb);
}
ChatColor defined = BY_NAME.get(string.toUpperCase(Locale.ROOT));
if (defined != null)
return defined;
throw new IllegalArgumentException("Could not parse ChatColor " + string);
}``` is this it
Bungeecord api is built into spigot if im not wrong
this basically makes the color you now need to apply it to a complete string
yep just realized it is
Yeah the chat api its built in
sooo sorry ik im annoying but java public static String hex(String message) { Pattern pattern = Pattern.compile("#[a-fA-F0-9]{6}"); Matcher matcher = pattern.matcher(message); while (matcher.find()) { String hexCode = message.substring(matcher.start(), matcher.end()); System.out.println(hexCode); ChatColor color = ChatColor.of(hexCode); message = message.replace(hexCode, color + ""); matcher = pattern.matcher(message); } return ChatColor.translateAlternateColorCodes('&', message); }
Why using #?
hm?
for Spigot colors and bungee its used the & character
You should put your Pattern outside of the method so it's only compiled once.
Hes using hex
Its different
oki
As of 1.16, yeah
I think he is trying to convert hex into chatcolor
oh fr?
- "" cringe!
Its so diffcult to do an implementation of Hex on 1.8x?
That why i ask hahaha
Adventure does it by downscaling to one of the 16 colors
Ah makes sense
Mojang will never do it
But wait the problem of hex its caused by SpigotAPI or Mojang
I dont understand that
Ahh
So if make an implementation of Hex color on 1.8x wont work. Cuz i depend from the client right?
yes
Ah
reject legacy accept modern minecraft
but pvp!!!!
its a fucking 6 old version
does anyone even play that version...
too old
No my laptop couldnt even run it due to how old it was
But it is still cool
fr
you can
create multiple modules
and each module
Yeah I know I did that
I believe Team.addEntry() does not support hex
will use 1 version for the dependency
I was tryna find an easy way out without module s
And hey wizardlybump it's me theoriginalase
you cant
Yeah this is my troll discord but my main got hacked
So I have to use this one
do you remember your old discord name and tag?
Ase#0176
Yep, only named text colors
what about id
If youre about set Color
Yea am still in the servers
okay so for the scoreboard i can just set the value of that to a random value and set its suffix right
i believe the suffix supports hex
yo how do i store playerdata (such as coins or levels)
PDC or create your own files
Yml files or database
I store data as Yaml File (Flatfile) or using Database
ty!
Forgot that existed
Was persistent data containers always a thing?
which is the easiest to implement
PDC
wdym alot
ike
what counts as alot
@EventHandler(
priority = EventPriority.HIGHEST,
ignoreCancelled = true
)
public void PotionSplashEvent(PotionSplashEvent e) {
ThrownPotion potion = (ThrownPotion) e.getEntity();
Player p = (Player) e.getPotion().getShooter();
if (p.hasPermission("mcba.playing")) {
if (potion.getItem().getType() == Material.SPLASH_POTION) {
Collection<PotionEffect> effects = potion.getEffects();
for (PotionEffect effect : effects) {
Bukkit.broadcastMessage(String.valueOf(effect));
PotionEffectType potionType = effect.getType();
if (potionType == PotionEffectType.HEAL) {
int value = (Integer) this.score.get(p);
this.score.replace(p, value + 1);
Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "MCBA > " + ChatColor.RESET + "" + ChatColor.YELLOW + p.getName() + "'s" + ChatColor.RED + " splashed health pot" + ChatColor.YELLOW + " (" + ChatColor.BOLD + "" + this.score.get(p) + " Points" + ChatColor.RESET + "" + ChatColor.YELLOW + ")");
}else{
Bukkit.broadcastMessage("bruh");
}
}
}
}
}
hm, this code outputs 'bruh' whenever i throw a splash potion of health, but i just cant figure out why
1.14
when you say "your own files" do you mean YML files?
Try printing the effect type instead of printing something useless like bruh
alright
Added this code: Bukkit.broadcastMessage("Effect Type: " + potionType);
Output:
[16:53:25 INFO]: HEAL:1t-x0
[16:53:25 INFO]: Effect Type: PotionEffectType[6, HEAL]
Yes i think
oke
if you need help just dm me
The best chance for someone to get help is to ask in an open forum not dming
Yeah but sometime you need fast help and via dm its easy.
will do if no one answers quickly :)
Or via asking in a channel and @ mentioning is easy and fast as well
Ah yeah
If need help just tag me or dm
Hey everyone, probably a dumb question, but how do I add maven dependencies? I'm in Eclipse if that helps.
I recommend using Intellij Idea
I never used Eclipse with maven i never do it working
Hey @sterile token could you help me with my issue? / do you have any ideas
Eclipse works just fine with maven
Yeah just send your error and code
Here it is
Is your project a maven project?
I didnt know hahaha
Allright
Any IDE is going to work with maven
Outputs this whenever I splash a health pot
I think so, I did a bit of googling but didn't get very far. I right clicked on my project and hit convert to maven project.
Ok, so you have a POM?
yes sorry
Wait explain me what its happening and what do you expect?
I basically need a way to check the type of a splash potion, that works.
i mean you can use other file types
but i think yml is the easiest to get into
I want it to run the code
int value = (Integer) this.score.get(p);
this.score.replace(p, value + 1);
Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "MCBA > " + ChatColor.RESET + "" + ChatColor.YELLOW + p.getName() + "'s" + ChatColor.RED + " splashed health pot" + ChatColor.YELLOW + " (" + ChatColor.BOLD + "" + this.score.get(p) + " Points" + ChatColor.RESET + "" + ChatColor.YELLOW + ")");
whenever i splash a health pot
no need to apologize there's enough people here that my question was answered relatively quickly
:)
Yep
oki if you need anything dm me!
Then thatโs where you add dependencies
will do :)
