#help-archived
1 messages · Page 221 of 1
nice thx now I dont have to write it on my own 😂
https://i.imgur.com/FizqOzf.png Doesn't work
thisis my xml
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.ANN0Y1NGHACKER</groupId>
<artifactId>Plugin</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>Plugin</name>
<description>Plugins with spigot</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<url>ANN0Y1NGHACKER.github.io</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
```
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
?paste
oh god...
essentially I need a way for bungee cord to function while the server.properties is set to online mode
https://i.imgur.com/FizqOzf.png Doesn't work
@livid spruce
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
</dependency>
i never really worked with bungeecord but usually it should work in online mode too
@faint lance
you get any errors?
add that
@frigid ember What you need to do is set the server to offline mode and the bungeecord to online mode then make sure that all players connect via the bungeecord. This can be ensured with a plugin
spigot not found
@formal nimbus Then look at Inventory Frameworks source
@mellow wave I've found it, but not the source, only the JAR.
I'll dm it to you
decompile in java is probably the easiest thing on earth
@mellow wave Is there any way to have the server be in online mode? when I set the server to offine mode the players lose their data.
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
change your spigot-repo
Set bungeecord to true in the spigot.yml
if that doesn't fix it then idk @faint lance thats what mine looks like and NMS works fine for me.
It didnt work but thanks anyway
You need to run BuildTools so the files get installed in your maven repo
@mellow wave Set bungeecord to true in the Hub server or the server with the user data?
All servers
Including the server of just bungeecord?
Every server that is connected to the bungeecord
The bungeecord doesn't have a spigot.yml
The server will still be in offline mode but have online mode UUIDs. Atleast if I remember correctly. But make sure that no one can connect without the bungeecord or you will have problems
does anybody have any idea how you change the light level of a block (using nms presumably because there's no method for setting light level, only getting)?
I believe you have to use NMS. I recommend using LightAPI for this since it does it for you
If I am using paper would I do it in that yml file as well
If it has a bungeecord option set it to true there
reflection dum
and who are you talking to?
ow
so I just used nms for it
Yeah sometimes NMS just helps
so i made a plugin and it works perfectly fine on my system, but when i upload it on an actual server it stops working and im not sure why its doing what it does
File maindir = new File(this.getDataFolder().getAbsolutePath() + "");
if (maindir.isDirectory()){
File[] files = maindir.listFiles();
System.out.println("\n\nmaindir is a directory");
for (File f : files){
System.out.println(f.getAbsolutePath());
}
} else {
System.out.println("\n\nmaindir isnt a directory or doesnt exist");
}
im just trying to get into the "monsters" folder which i know is in there, but it says it doesnt exist
so i looked up all the absolute paths in my plugin directory to double check
this is what that outputs
so monsters is in there right
but then when i try to go into that directory using
File maindir = new File(this.getDataFolder().getAbsolutePath() + "\\monsters");
it dont work
it doesnt exist
should that make it not work on my end though
That'll work everywhere
Working where
on my localhost server
Just do what i said.
i mean ill try this out but im just trying to understand why
ok
is it because im running windows and that server is running linux or uhh
and i have this nether star thing
Probably
kody simpson has a fantastic tutorial on a menu manager
makes making menus really easy
i recommend it
for me?
wdym for you
nvm
Is this a good method for creating pages within menus? No one answered my questions so I'm looking on the forums, but haven't found anything promising. https://paste.md-5.net/ajojuheder.cs
Coll, you were asking for the custom block speed packets, yeah?
Ye
Gotta find their nms name
perhaps it isnt that storage efficient to contain support for all 13 NMS versions? https://imgs-i.sabel.dev/eJJwS4Z.png
any ideas? or is that just how it is :/
hm there's no PlayOutArmAnimation 🤔
are you shading in nms or what xdd
i.. i am
i did?
🤔
<optional>true</optional> on em all right?
oh
no
Set them to provided in the POM
^^
And don't shade them
^
@mellow wave I set everything to offline mode and turned on bungee on all servers, and the server is working with bungee, but the players are still not recieving items from when the server was set to online mode
I haven't used maven in 6+ months ._.
uhhh ok lemme see what i can do
PacketPlayInBlockBreakAnimation
PacketPlayInArmAnimation
PacketPlayInBlockDig
@lone fog
If anyone thinks they can help: I am setting up a server network and had a factions server open before enabling bungeecord. Bungeecord requires that the server be set in online mode, but when I do this all players lose their progress from the day the factions server was open. Is there any way to enable bungee but still keep the old player data?
They're probably somewhat wrong but hey, close enough
Thanks
"and dont shade them" how do i include my other modules? while keeping the filesize down
im new to maven
You shade your modules not the NMS
By setting your dependency scope to provided it will prevent them from getting shaded
Basicly add <scope>provided<\scope> in each dependency
so what i think you're saying is... i don't add provided to the dependencies connected to my modules, but add it to the spigot artifact in each module?
@frigid ember The links are the same?
@warm stirrup Yes that's correct. Add provided to all spigot artifacts
ok that makes sense lemme see what happens
Fixed
@frigid ember what is the problem tho?
..
"OK so what I want to do is whenever I click the nether star it opens up the guy, so how would I link them"
Did you get this code from somewhere else? This is complete code.
You only have to add :
new NetherStarMenu().openInventory(event.getPlayer());
into the click listener in the nether star "script".
Is this all your code?
Hm
@EventHandler
public void inventoryMove(InventoryClickEvent event) {
if(event.getClick() == ClickType.NUMBER_KEY){
event.setCancelled(true);
}
}
- This also cancels all inventory clicking using number keys.
Is that intended?
What you need to do is listen to the PlayerInteractEvent and then open the NetherStar GUI with the code Septicuss sent
🏒
But you are currently cancelling the hotkey movement with all items, not just the nether star
i know what ur talking about palm and i fixed that in a plugin i made maybe a few weeks ago. ill pull it up once im done testing this to show the code
K
if (e.getClick().equals(ClickType.NUMBER_KEY)) {
if (e.getHotbarButton() == 8 || testItem(e.getCurrentItem())) {
e.setCancelled(true);
return;
}
}```
this is what i did to disable hotkeys
testItem() just checks if the item is a specific item I set
thats for InventoryClickEvent
also olivo i think u saved it lol down to 58kb
i just need to fix errors in my actual code that appear now
ty
Hello there I recently updated papi I tried ecloud downloading some things didn't install at all
And some did
The one that didn't work and I need it is player
Any help
Did you ecloud download Player?
Ya ofc
e.getHotBarButton is probably all they need
And reloaded it
I tried via list but nope
It says successful installed and reload bur nothing happens and it doesn't appear in list
/papi ecloud list installed
Are there any errors in your console
Wait so it says it's installed?
or no
I'm confused
Ok I'm gonna start over
If anyone thinks they can help: I am setting up a server network and had a factions server open before enabling bungeecord. Bungeecord requires that the server be set in online mode, but when I do this all players lose their progress from the day the factions server was open. Is there any way to enable bungee but still keep the old player data?
Ok I'm gonna start over
@peak tiger .
@frigid ember Did you set bungeecord to true in both spigot.yml and paper.yml and restart?
I updated papi and all expansion Göt removed obviously so I started redownloading them essential and vault downloaded successful.
I tried with player is say successful and please do /papi reload when I do it nothing happens at all
And when I check in list it appears gray
If it appears in the list it should be installed
What are you using to hook in to the plugin
@mellow wave wdym
What plugin is displaying placeholders?
But it doesn't really matter if it fails to install
Oh its info board reborn
As i asked earlier are there any errors
I'll check just a sec
Anyway I recommend going to the PlaceholderAPI discord instead of asking here
They can probably help more
Alright go to their discord and ask
hey guys, do any of you have experience with votingplugin or votifier. My rewards arent working at all
I have set them up before
I recommend using NuVotifier :)
But anyway we need more information to help
@mellow wave The bunngee is enabled on every yml folder, bit the players are still losing their data from before bungee was installed
And you have restarted?
Yes
yeah im using nuvotifier. This is my current rewards setup:
oh i cannot paste images one moment
?paste
@frigid ember I'm not home atm so I can't help you further
Does the vote reach the server?
Use this to test if the server can see the vote: https://mctools.org/votifier-tester
Might want to remove those ips
Did you let VotingPlugin auto generate that section or did you add it manually
i did it manually
hi- so what versions of java is spigot compatible with? is it anything from 8 and above or should i just use the latest stable release?
8+
If you want to publish plugins i would go with 8 as most ppl use this version. Although i would like to see more plugins requring java 11.
Found the issue
how much does the version matter?
You put Item instead of Items @void hawk
and you need to create a sub section
an example can be found here: https://github.com/Ben12345rocks/AdvancedCore/blob/master/AdvancedCore/Resources/Rewards/ExampleBasic.yml
If you compile plugins on 11 then the machine that runs the server has to have at least 11.
Java 11 is the standard version for Linux now but for whatever reason a ton of ppl are still on 8.
11.0.2 (build 11.0.2+9)
Windows 64-bit zip (sha256) 179 MB
Mac 64-bit tar.gz (sha256) 174 MB
Linux 64-bit tar.gz (sha256) 179 MB
Source Tags are jdk-11.0.2+9, jdk-11.0.2-ga```so ig i should download this version?
@low citrus just download the version for your OS lmao
Diamond is the name of the subsection. There may never be more than one with the same name. But it can be named whatever you'd like
yeah ok thx
ok thanks
Yes thats the lates v11
can it be the same item on a different site tho? @mellow wave
Yes
also, does the item go under rewards?
I believe so
how do i put the lit banes gui thing on a websit i have a domon aklredy
I already told you
?
You need to point the domain to the host and port which the litebans menu is running
what port
is there a way i can test the configuration is correct & rewards have been given if ive already voted?
is it in config fil
Idk check what port it's using in the config
port?
@void hawk Use the votifier tester I sent
where is port
In the config I guess
i cant find it
Follow these instructions: https://gitlab.com/ruany/litebans-php/-/wikis/Installation
Turns out the website isn't running as I expected it would
@mellow wave it doesnt show anything different using that website or gives rewards tho because the reward hasnt been stated within the votesites file, do i need to create a field for it in that file to test reward output?
You need to add a different vote field for it
By default VotingPlugin auto generates those sections for you .. Unless they've changed it since I last used it
All you need to do is add the reward to it so you actually get something
Instead of a GUI?
you can program html in
ah I see
Litebans run php tho
You need a website host
how can i get a uuid of an entity?
You won't get a good one for free
No you need a host not a domain
host?
Entity#getUniqueId()
Something that runs the webside
ok thanks
What does that even mean :&
i think french
Spanish I believe
Well I'm off for today
When priority is at HIGHEST that means that code runs last right?
Yes, monitor runs after tho
Ah, that makes sense, I thought for the longest time HIGHEST was first
@frigid ember Put it in the plugins folder
And dont you dare change the event outcome in MONITOR
@mellow wave is there a default configuration for the votesites.yml you can link me to i cannot find it?
Like. With code?
Yes
Thanks, will try that
well yes
found org.bukkit.block.data.type.Wall
oh no, that data type doesn't exist
1.15.2
Ah
@grim halo may I ask where do you find 1.15.2 docs?
Not sure you can
I used the oak ones
I use paper docs -_-
ok. Using the votingplugin just doesnt work on giving the rewards
even giving the basic rewards which the plugin provides as examples
Works for me
@frigid ember https://helpch.at/docs/
1.7.10-1.16
wow thanks
TextComponent msg = new TextComponent("Helpop" + args);
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.RED + "This is player: " + lore.toString()).create()));
player.sendMessage("&4[Helpop]" + args);```
new HoverEvent
deprecated
just use the component builder
Of course if it doesn't have a hoverevent method ignore me
okay, ive identified the problem. I have my reward file setup correctly and it gives me the reward. But when i add it to the votesites.yml as the following it removes the ability to see this in /vote, so how are vote files supposed to be referenced
Or you can either list rewards files (Files located in plugins/PLUGIN/Rewards), like so:
Rewards:
- 'RewardFile1'
- 'RewardFile2'
i have it stated as the following which breaks the plugin
Rewards:
- 'VoteReward'
Is it allowed to advertise plugins (uploaded on spigot)?
Where do I ask to get someone to make a plugin for me?
Guess that'd be General
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Hey. using which event can I disable players right clicking an armor in hotbar and wearing it?
InteractEvent
let me check
hi help me pls
I want to make this as easy as possible
^
XDD
What does decaprated mean
means its no longer cool
k
nop
Human v595829038 BETA
Usage: !verify <forums username>
!verify
Usage: !verify <forums username>
cuz my old DC used to be verified
but its deleted
and it claims my spigot profile :(
Wrong channel 😩
oups
this is serious spigot help
Fr me to @naive goblet
😦
dose spigot work on PureCPU
How do I ask staff yet? There is no support channel and staff aint reply here and I cant ping cuz rules
Is there an efficient way to breaking blocks in a certain radius, rather than a triple nested for loop for it?
I'm not talking about that
Fawe api
I'd rather know how to do it without using an API for it, I doubt it's that difficult. Unless there's a lot more into it than I thought lol
No idea
oh, so I also have a question. cuz im coding skywars plugin. How do I make cages?
Yeah you’d most certainly have to use the nested shit
Like i need a void that when i run it putting player.getLocation() it puts glass arround
Hello, do you know if there's a way to cancel a task which is in a foreach loop ? If I define an int a = Bukkit.getScheduler()...., I will only be able to cancel the last task right ?
But it isn't stable, this method causes lag the moment I want to do anything past like a 5-10 radius. And while I only need a 3x3 radius, it seems to be slightly causing lag with a lot of people using it.
Yeah it’s cuz it’s sync probably
Lots of operations, although it shouldn’t lag with an area as small as you described
Did you apply block physics?
Grand why only the last?
wym? I'm setting the block to air, and then doing other things after that. Like checking for autosmelt and stuff
it's a veinmeiner thing. I had to make my own to be sure it works with my custom items
declaration: package: org.bukkit.block, interface: Block
So how can I remove the block without doing that, and without breaking it naturally. I can't do that because I need it to function with certain things
Well iirc fawe sets blocks sync but it allows other server traffic to go through
Sorry I think I'm confused
The thing you sent me is kind of saying using setType isn't really safe, but I'm not sure how else to remove the block
and still do what I need to do
Using setType with second param false might not be very “safe and friendly” but it should increase performance in most to next all cases
Block#setType(Material,false);
apply block physics = false
But what does that actually do, and why is it better?
It doesn’t do the block physics check which is presumably something that’s done when a block is modified and tells other blocks around what happened
Nearby
Yeah it’s unsafe although you generally don’t have to think about that
It can have some weird side effects
ok
yep. wtf.choco:VeinMiner for my groupId:artifactId for example
I get this error when I try to join my hub through bungeecord. http://prntscr.com/tvd96q
I started getting this error after I updated bungeecord to the latest version
On bungeecord, I have the latest version of ViaVersion, ViaBackwards, and ViaRewind
This is the error in the bungeecord console. Looks like this error is from ViaVersion.
yo how would I disable mob ai in the spigot source code itself?
Spigot doesn't handle AI, the underlying NMS does
ah so I guess I have to mess with nms then
Mob.setAI(false)
using redprotect is there a command you can execute to gain claim blocks?
i want to make a cooldown for something
but how
i could make a hashmap with a uuid and an int
when the player does the action i set the int to idk 10
then i can check if it says 0
but how do i make it count down
Is there an event handler for checking if a player is holding an item? Google is saying that only interacting with items will register as an event
Map<Player, Long> where long is system.currentTimeMillis then you can do if (!this.theMap.contains(player) || System.currentTimeMillis - this.theMap.get(player) < cooldownMillis)
I want to send message when join
@Override
public void onEnable() {
for (Player me : Bukkit.getOnlinePlayers()) {
if (me.getName() == "EditDev") {
for (Player players : Bukkit.getOnlinePlayers()) {
if (players.getName() != "EditDev") {
for (Player players2 : Bukkit.getOnlinePlayers()) {
players.sendMessage("§cOwner joined");
}
}
}
}
}
}
@celest current PlayerInventory has a getHeldItemSlot()
rip brackets
That is many loops
Also, that's not even a PlayerJoinEvent..
I assume you're new to Java and the Spigot API Edi?
🤔
I recommend as an introduction to events you look at this https://www.spigotmc.org/wiki/using-the-event-api/ and in your case, what you'd want is the PlayerJoinEvent.
There is so much text... but i will try. Do i just add a for loop and let it run until i jopin?
you won’t get far in this industry without doing your own research or reading. If you want to make a join message create an event, PlayerJoinEvent, and then listen for when specific players join.
How do i say != with equals
lmao
that's like java basics
@Override
public void onEnable() {
do {
for (Player me : Bukkit.getOnlinePlayers()) {
if (me.getName().equals("EditDev")) {
for (Player players : Bukkit.getOnlinePlayers()) {
if (!players.getName().equals("EditDev")) {
for (Player players2 : Bukkit.getOnlinePlayers()) {
players.sendMessage("§cOwner joined");
}
}
}
}
}
} while (!meOnline());
}
boolean meOnline() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getName().equals("EditDev")) {
return true;
}
}
return false;
}
@acoustic jacinth please learn some basic Java and then come back and try coding with the Spigot API. Not trying to be mean, but you're not going to get spoon feed here.
Like twitch? how?
....
Lol no
I never spoon feed because I'm a strong believer that you learn more when you do your own research and whatnot (i.e. reading the docs). I understand like people don't understand shit sometimes, but then it's just about pointing them in the right direction or to a tutorial.
No it stops when i join
I never spoon feed but I often give pseudo code
Ok i will read the join event thing...
also, which one's better
https://i.imgur.com/NfR5qNa.png https://i.imgur.com/wFVXNvi.png
🤔
that honestly won't help you @acoustic jacinth I'm sorry, but you really do need to learn some basic Java before you try dealing with APIs
I do know some java 😦
Imagine supporting multiple versions with NMS, I wouldn't ever do that
I'm only supporting 1.16+
The first one king
alright
Can someone point me in the right location for playing audio to an area w/ a radius set?
I mean abstraction and nms is nice
Better than going with non cached reflection
And it’s probably little faster than reflection in it’s best phase as well
Maybe there's those secret value combination that get you a radius, check the documentation for World.playSound
is it inefficient to check if a player is within a specific location and if they are, play the sound for the player?
Where do i get PluginManager ?
Bukkit.getPluginManager()
for some reason when i /kill me or other admins we do not loose our inventories regardless of gamemode?
ok
@sturdy oar thanks, i'll take a peak
@balmy sentinel depends on the situation I guess?
Server#getPluginManager
Taum, Godmode active?
Server is faster than Bukkit getter
Taum can be cuz if permission
@frigid ember that was my solution for you lol. I'd give that a try tbh
Oh XD
TheViperShow how much faster?
godmode is not active
TheViperShow how much faster?
@naive goblet at least 1 nanosecond
Did you check or are you just saying that?
I think less methods are called
Well I have no clue so just interested
You can check it
It should be negligible anyways
If it got JIT compiled there is literally no difference. some nanos on worst case
Anyway I usually use Server for everything
I don't really like using the Bukkit static methods
Any reason for that or just a preference?
no i just checked with whois i dont have godmode enabled
Do you pass JavaPlugin#getServer() or do you store the Bukkit.getServer() ?
I pass getServer() with injection
Both the same instance. Doesnt matter
^
This not loading...
public class OwnerJoin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(new OwnerJoin(), new OwnerJoin());
}
@EventHandler
public void join(PlayerJoinEvent event) {
if (!meOnline()) {
for (Player me : Bukkit.getOnlinePlayers()) {
if (me.getName().equals("EditDev")) {
for (Player players : Bukkit.getOnlinePlayers()) {
if (!players.getName().equals("EditDev")) {
for (Player players2 : Bukkit.getOnlinePlayers()) {
players.sendMessage("§cOwner joined");
}
}
}
}
}
}
}
boolean meOnline() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getName().equals("EditDev")) {
return true;
}
}
return false;
}
}
Again, why do you have that for loop inside the for loop inside the for loop?
Its safer if one equals check fails. No?
no
delete meOnline it's pointless. You can get the player with event.getPlayer() instead of looping through all online players. That event will be fired anytime a player joins your server
But why it not loading
Bukkit.getPluginManager().registerEvents(this, this); If you're registering an event thats your main class just do this.
i want to make a cooldown, if i make x = 120 (2 min) and then count down to 0 what's the best way to count down
I will read the strem thingy and it will look nicer ok
👍.
to wat dos "this" point
what is a need_nod and how do i compare universal time?
do i need that fot "this"`?
it’s used to access class leveled stuff instead of for instance local leveled stuff as local leveled stuff normally hides class leveled stuff
The time was to @wary ledge
oh so "this" is for class level stuff? like static?
I can give you a pseudo code
what do you men wit level? i onley know scope
class X {
private int i = -1;
public void setInt(int i) {
this.i = i;
}
}```
in the function, just i would point to the parameter meanwhile this.i would point to the class field
so "this" points to the parameter or the variable in the class instance?
the variable from the class instance
oh ok. So i dont can use the name again?
i was thinking make something like this
int x = 120;
while (x<0) {
Thread.sleep(100);
x--;
cooldown.put(player.getUniqueId(), x);
}
}``` and then check if the cooldown is == 0 and if not it returns like "you cannot use this for x seconds"
like. If i have a name "number" in my class and a name "number" in a method so i use "this" so i dont have "number" again and know wht to use
What are you trying to make a cooldown for?
Well basically it’s used to access a class variable inside a function if the function has a local variable with the same name
Can't you just store the last time they used X and then check the time since then?
@wary ledge see if this helps, https://bukkit.org/threads/how-do-i-make-a-command-cooldown-for-my-plugin.102299/
Exactly what the title says
Map<Player, Long> where long is system.currentTimeMillis then you can do
if (!this.theMap.contains(player) || System.currentTimeMillis - this.theMap.get(player) > cooldownMillis)
@odd knoll
ok "this" is cool. i will red stream
Yh, it's unnecessary to do a timer like that.
You're not counting down the time, you're comparing when you need to check if they can use something.
They execute /help - you log the current time.
You have a 5 second cooldown, they execute /help again after 2 seconds. You use the time you logged since they last did the command and see it's not been 5 seconds.
Only schedule tasks if you’re really in need of them.
what difference from "() ->" and "var ->" ?
First one is a runnable
var?
Second on is a lambda taking a single argument
oh so im logging current irl time?
Or I mean first is an empty lambda
That was probably just an example
Oh ok
oh ok so it is like with method parameters just stipid and in one line
first is a no paramter lambda
I need to make a cooldown for something actually, so I might as well give u an example Need_Not lol.
iirc, var is an added keyword in Java 10
Oh wait, no, I just need to make a lock 😐 I do need a cooldown
but i now have a stream or lambda thing "players -> " but i cant see this in the next lambdas that is "players2 ->"
I have a cooldown example in my plugin but it will probably only confuse you
Send ur code edi
And ugg, my code isn't per player sooo.
Wait i fixed it... but i dont touch it... if i do any my ide just makes everything red
why are they're trying to use lambdas? I thought they were just trying to get join messages to work
this do not better to red
🤷♂️ 🤷♂️ 🤷♂️
public class OwnerJoin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void join(PlayerJoinEvent event) {
if (!meOnline()) {
Bukkit.getOnlinePlayers().stream().forEach(me -> Bukkit.getOnlinePlayers().stream().forEach(players -> { if (!players.getName().equals("EditDev")) { Bukkit.getOnlinePlayers().stream().forEach(players2 -> players.sendMessage("§cOwner Joined")); } }));
}
}
boolean meOnline() {
return Bukkit.getOnlinePlayers().stream().anyMatch(me -> me.getName().equals("EditDev"));
}
}
So this now works and better reading?
Oh god.
about better reading idk
@acoustic jacinth that event is fired whenever a player joins the server so there is no need to check if they're online..
You’d do something like this perhaps
Bukkit.getOnlinePlayers().stream()
.filter(player -> player.isSneaking())
.peek(player -> player.setDisplayName(”sneaker”))
.collect(Collectors.toList());```
i dont know what filter and peek and all means
https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html here is a list of methods
It says there
And the code was just an example
my eclipse do not yell at me so i keep this for now. my server is loading it maybe works
Aight
i actually never used stream 👀
I mean I use it because it reduces boilerplate
ok so in the if(cooldowns.get(playerName) - System.currentTimeInMillis() * 1000 < cooldownTime) { line
i understand when the player runs it
it sets it to System.currentTimeInMillis()
Some things. 1) Make sure the map contains the player first.
but my code is all in one line now... and i dont understand it anymore.
BUT IT WORKS NOW. THANKS s much ican now make better plugins with lambda and @EventHandler thing
Second thing, I think you have some things backwards.
Lmao
yeah i just realized that
cooldowns.get(playerName) - System.currentTimeInMillis() this will give u a negative.
what do i set player to
You set it to the current system time.
one thing weird with streams is that they mess with the flow in a sense
System.currentTimeInMillis()
usually lines go one after the other
correct?
Yeah Free I did actually come a cross that
public class OwnerJoin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
if(player.getName().equals("EditDev")
event.setJoinMessage(ChatColor.RED + "Owner Joined");
}
@acoustic jacinth
could i write all plugins in one clkass?
Lol
Wait what do this do
🤗.
got a question
if the player is going out of the nether, and then is ouside of the worldborder (because of nether-overworld scaling) i want to teleport him back to the border.
how can i do that? made a paint, maybe it tells what i want
yeah, painting-skills 10/10 lol
should i do that? when i use lambda i can make that. right?
but it so hard reading. i dont understand
Don’t do the lambdas very much then
why the hell should someone write a whole plugin in one line lol
check world change event
Try understand what’s going on
i would have used the move event
That’s most important if you ask me edi
@acoustic jacinth you're clearly new to Java so don't try to learn lambdas for a bit. It's just going to confuse you further.
^
so let's say it sets it to 1596758206371 and then a while later they do it again and it says 1596758208218 i get -1847 (1.8s) would i then check if that is more than -120000 (2 min)
no. i do write a plugin now only with lambda. i have to learn that so i can make better plugins
got this
You're doing it all inverted if you have that.
is code faste when in lamda and one line?
wait
so -current from cooldown log
minecraft isn't handling borders right?
lambdas don't "make your plugin better"
Edi shouldn’t matter
You should do System.currentTimeMillis - theLastExecutionTime. That gives you milliseconds since they last executed. Then you just make sure it's larger than the cooldown you want in milliseconds.
ok
Lambdas isn’t just in streams but it’s the -> expression
And it’s generally just reducing boilerplate
Although you have to treat them somewhat different
Did someone say write an entire plugin in 1 line
If you're going to learn lambdas before you learn some more basic java you're going to confuse you're self further and end up doing more harm than good.
can i make a forum post to to explain new players how lambda are used and how it makes my plgin faster?
wait is not?
I'd recommend only making advisory posts once you heavily understand Java and have studied it a lot.
but its hard reding-. why do i use?
Boilerplate != performance
Code golf plugins
Reduces boilerplate
is boilerplate from cooking recipe?
Streams can make things really clean but also a lot slower in a lot of cases. I only use them for loading or unimportant cases where response time isn't vital.
i dont understand
@acoustic jacinth no offense, but a few minutes ago you didn't know how to negate .equals(). You need to learn some more basic java before you're ready to make tutorials educating people.
And I think java doesn’t create a new interface instance if it’s a lambda iirc. Might be totally wrong on this one though.
Try make a give command
also in my class==? can i implement everything?
Almost
It's recommended you make different classes for different things.
If you need to implement multiple classes, you do implements ClassOne, ClassTwo
but i can make one class and then use lamda and it gets smaller
Most likely you can implement all the needed interfaces but for instance if 2 interfaces has the same method but different return types it would give you a compiler errror I think.
No
😩
i hate my life atm
That's not how you should code.
Edi you’ll end up with a spaghetti mess
Make different classes for different parts of your plugin and only implement in them what you need in that class.
And a ton of unused methods
ok... so i see BukkitRunnable in tutorial, do i import mor or only the 3 ?
Don't bother manually importing unless you for some reason need to
Or I mean if you want go ahead
IDE's will take care of it
no i mena also implements BukkitRunnable
if you want to use tutorials, use this, its pretty good i think
https://www.youtube.com/playlist?list=PLdnyVeMcpY79UFZFfqwaXF2GUGc0v3YyG
Ok i dont know. tell me a plugin i can write an i try and you tell me whats bad
wait. only one
You choose?
ok so i can use the eventhandler i have with PlayerJoinEvent for this
do i use "==" or equals for players?
equals
Depending on what you’re doing == might also work but .equals() will always work unless some wizardry
(For player)
@acoustic jacinth https://stackoverflow.com/questions/7520432/what-is-the-difference-between-and-equals-in-java
Those words isn’t good for him
oh ok. so do every class have equals or? i dont see it when creating
Yes every class has the method
That doesn’t mean it’s convenient to always use it
But most likely
How do i say in this line not "A player has join" but with the name?
@EventHandler
public void join(PlayerJoinEvent event) {
event.setJoinMessage("Welcome");
Bukkit.getOnlinePlayers().stream().forEach(online -> { if (online.equals(event.getPlayer())) { event.getPlayer().sendMessage("A player has join."); } else { event.getPlayer().sendMessage("Welcome"); } });
}
Player#getName()
why did you do a stream lol
^
just do forEach doesnt that work by itself
Its faster
i
no it's not
.
lambdas don't make your code faster
It reduces boilerplate most likely
den why do i use it? i dont understand my code because i looked at chat for short time anymore
Go with an enhanced for loop
how i make enhanced? with "@"?
Huh
do i add @enhanced to the loop
No
then what is enahnced
A fancy term for a loop that goes over a collection
it sais that Collection has no index... i use Iterator ok?
can someone help me with making a playerlist menu with deluxe menus?
because getOnlinePlayers() makes me a Collection
like it shows
for (int i = 0; 0 < Bukkit.getOnlinePlayers().size(); i++) {
Bukkit.getOnlinePlayers().get(i);
}
//pretty same as
for (Player player : Bukkit.getOnlinePlayers()) {
}```
all the players heads
i tried the get(i) but it sais that Collection has no get(i)
i use iterator now...
My bad
Anyone know why ItemStackUtil is does not work
inv.setItem(11, new ItemStackUtil(Material.DIAMOND).setName("Click").buildItem());
For (Player player : Bukkit.getOnlinePlayers())
What’s not working specifically
it shows up in red and i get the error java: cannot find symbol
Send error
what is different from getName and getDisplayName
not Get
@acoustic jacinth https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html
declaration: package: org.bukkit.entity, interface: Player
Coll being a casual C programmer :9
Hush
Or I mean doesn’t C have capitalized names on methods?
C# does
Close
public class OwnerJoin extends JavaPlugin implements Listener, CommandExecutor {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void join(PlayerJoinEvent event) {
event.setJoinMessage("Welcome");
Iterator iterator = Bukkit.getOnlinePlayers().iterator();
while (iterator.hasNext()) {
Player player = (Player) iterator.next();
if (player.equals(event.getPlayer())) {
event.getPlayer().sendMessage("Welcome");
} else {
event.getPlayer().sendMessage("A player has join:");
event.getPlayer().sendMessage(event.getPlayer().getName());
}
}
}
}
So i make plugin. this good?
I’d edit it but I suppose it works
you already have a "Welcome" message sent to all players when someone joins the server. Therefore, event.getPlayer().sendMessage("A player has join:"); this is pointless.
i can smell the progress
but i want to join player: "welcome" and to everyone else "A player has join:"
You send welcome twice
ah ok i understand.
oh my ide just give me the option "replace with enhanced for" i understand
@EventHandler
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
event.setJoinMessage(ChatColor.YELLOW + "Welcome " + player.getName());
}
@acoustic jacinth I don't know why you're trying to make this more complicated than it is.
Should I shade all my dependencies or how should I do them?
I'm thinking of releasing my project soon but I am unsure about licensing. One dependency uses the Apache, the other the MIT license. Can I just have the users using my plugin put the dependencies in plugins/? Note: The dependencies are not spigot plugins but rather normal java libraries.
hey i was wanting to setup a situation on my 1.12.2 forge server where i can load/unload resource packs a player has installed, without them manually having to do it themselves.
do i use World Resourcepacks 1.7?
do i use Force Resourcepacks?
id include links to be more specific, but when i tried my message was automatically erased.
thank you guys for having me with you.
Sean if you’re using gradle I can help
Yeah I am @naive goblet
I know how to shade btw, it's just I don't know if I should do it because of licensing issues?
Ok i will sleep now. but i will make better plugins. do i post here if i make one?
idk... just here off a recomendation, i have about a year of mc exp, but most that time has been spent trying to play with server stuff, so im very green.
can i make my plugins premium?
@acoustic jacinth no this channel is for helping people with their code and Spigot/Bukkit development in general
You need to have 80+ messages 20+ positive ratings and 3 free resources before you can post a premium resource.
JDA (https://github.com/DV8FromTheWorld/JDA) and NBT-API (https://github.com/tr7zw/Item-NBT-API)
@EventHandler
public void join(PlayerJoinEvent event) {
event.setJoinMessage(ChatColor.YELLOW + "Welcome " + event.getPlayer().getName());
}```
No need for a variable :p
Most likely just give credit on github if you have your project there
I know lol, I copied my code from earlier where they wanted to give themself a custom join message, but I forgot to remove it
And if I aim to upload it to spigotmc.org, it is fine to have them shaded?
oh so i can send my join plugin and i can write to many people and ask them
i can make 3 plugins tomorrow and write a lot of players and then i make a premium plugin
@acoustic jacinth they won't accept a simple join plugin.
Pretty sure yes. You might have to just credit the licensed projects in your plugin description as well else it should be fine.
$10 to set welcome message plz
no i do add join so i can havwe 3 plugins
looking for /fly plugin, only paying $25 and above dm me to make pls
Hmm ok, thanks. I'll peek around the dependencys github and websites for any clues if there needs to be anything else.
my premium is a lobby with kit plugin
Yeah, presumably the license will tell you what you can do and can’t do and what you have to do in terms of service.
@acoustic jacinth no offense, but you're still new so don't make any premium plugins. Anything you can probably think of right now, already exists.
It’s always nice to credit authors for their products you’re using though
nty i want /fly premium only because it's more sm00th3r
so i add a join plugin and a leave plugin and what was the 3 you send me?
Obviously, yeah
i think maybe im in wrong server? haha
@acoustic jacinth They won't accept a join/leave plugin. They're already a ton of lobby managing plugins that can set join/leave messages and do a lot more than that as well.
well, i mean iv asked about 25 servers this question to be fair
wait do my plugins all need to accept from forum?
most the time people say "you cant" or point me to another server
Wait
ok
@acoustic jacinth they have to meet a certain standard yes, they don't get posted right away.
I am getting the error java: cannot find symbol. and it points to this
line inv.setItem(11, new ItemStackUtil(Material.DIAMOND).setName("Click").buildItem()); how do i fix this?
I mean shipgazer Forge 1.12.2 isn’t supported right?
So wait, you want to change resource packs between the ones the player already has installed
i want it so if a player loads a world/area in my server
but i see a lot of plugin that are super trash and get postet. and even more bad... skript. and they are only one line sometime
A chunk?
it automaticly loads/unloads the correct resource pack from the ones they have downloaded already
Not possible without a custom mod
i will post and i will see. i will tell you my premium plugin when it doen
i want this mod
? oh you didn't know?
Doubt there is one out there
skript anticheats are worth $30+ on the market
Probably need one made for it
I mean sure
@acoustic jacinth you do you. I'm done entertaining this idea.
But modpacks don’t often do stuff like that
i found a reddit thread that starts to point out some of the potential it could have if you would like to see.
even if you have one world
it could be very useful
Ship I don’t think that’s very possible
I mean you can already set a single resource pack for your server
Or I mean yes
if we can use windows on mc
but my friend told me that skript should "Skript soll reudig und allein am Bahnhof zoo sterben. Das ist so so bad."
wait i need to google translate
then this must be possible
i can even have a player be prompted to dl rp from ingame
but my friend told me that skript should "Skript soll reudig und allein am Bahnhof zoo sterben. Das ist so so bad."
wait i need to google translate
@acoustic jacinth that's quite mean lol
but i cant change ones they already have dled?
Occasionally you’d just make new textures instead etc
people have wanted tho
You would need the server mod to say “hey, activate this resource pack”
If you’re on Forge anyways
So translater: He seid that skript: "Script is supposed to die mangy and alone at the station zoo. It's so so bad."
And the client mod to find it and enable it
so i make anticheat skript and make premium?
yes then u make lots of money
i will see... im sleeping now
@acoustic jacinth read this entirely. I can guarantee whatever you're going to code won't meet these standards. I'm not trying to be mean, but you're clearly new to this and nothing you code will be up to par with a premium resource. You need to learn more java, and learn more about the Spigot API. https://www.spigotmc.org/threads/premium-resource-guidelines.31667/
just kidding, dont do that, i was joking
The current minecraft server won't allow for a dynamic resourcepack switcher I think.
Isn't it currently that whenever you enter a dimension for a server you can be promted with a resource pack but never just randomly? Or can a server just randomly tell the client they should switch to some resource pack?
I am getting the error java: cannot find symbol. and it points to this line
inv.setItem(11, new ItemStackUtil(Material.DIAMOND).setName("Click").buildItem()); how do i fix this?
?paste
you need to give us more than that. (full error and classes involved)
@hybrid path
so say someone goes to nether, or another dimension/age
You can randomly tell the client to switch
i want it to load a different rp
But only to the single one set in server.properties
Ah ok
@balmy sentinel https://paste.md-5.net/ufajiforiz.java
Error:(33,33) java: cannot find symbol
someone goes from say pokemon red world to spirited away world then errrr
it just dont look good
So use a bungee network
whats that?
@ionic hound what are you trying to do?
so
make a gui@balmy sentinel
I don’t see an import for ItemStackUtil
say one person goes from a pokemon red world to a spirited away world using myst, works great, but if i was using the rp to make pokemon world look right, then when player changes to spirited away world itl look like poop until the player manually goes and fixes rp order and load/unload, i want this to happen automaticly on each world entry.
oh okay, where do i start?
With which one
with the best way?
public Inventory myInv() {
Inventory inv = Bukkit.createInventory(null, 54, "My Inventory");
//set items
return inv;
}
@ionic hound do something like this and then if you want to open the GUI do player.openInventory(myInv());
my server is just a machine sittin in the corner of my room, you dont mean to go buy more like 30 more pcs do you?
no way
i think theres a misunderstanding, and im explaining things bad
im trying to do waht that guy in the reddit link i sent is trying to do.
hey is there a way to figure out what plugin is messing with scoreboards?
a plugin that has been working for weeks now all of a sudden throws null pointer exceptions when getting a scoreboard team during a PlayerMoveEvent