#help-development
1 messages · Page 1571 of 1
al
alr
read the file, store in ArrayList(?), edit the strings in the ArrayList, and write the ArrayList back to the file?
yeah thats one way to do it
if you just change an existing line
then maybe a fixed size list or array might do better
Is redstoneevents an enum class?
its a public static final field
what should i use instead of PlayerChatEvent? since its deprecated
AsyncPlayerChatEvent
Oh, was confused by the field name.
yeah frankly the same lol
Was wondering if it was an enum, why not make it an EnumSet, then check the size.
🥲
Damn uppercase field name.
Well, that is rather pointless when I think about it now
kinda weird java compilers allow that but I guess its for the convention breakers
Would be funny if IntelliJ just yelled at you when you used incorrect conventions LOL
yeah lol
whats the difference between getName and getDisplayName?
no
displayname is the name which is displayed and can be modified server sided
any idea why it is named AsyncPlayerChatEvent
How is line 32 throwing an error when you're not even calling that method 🤔
i am
You sure?
Should be yellow instead of gray if you are
Unless you messed with your colors ig
I would like a rainbow gradient error color
It should do that when you do something really dumb
ye lol
It's way of saying "you're a moron"
how can i do something on each server tick?
isnt there any event for every tick?
?scheduling read here
no there isn't
anything thats called constantly, within a short period of time?
runTaskTimer
k
read this ^
is there something in the spigot api to easily create and parse config files?
YamlConfiguration.loadConfiguration
(static method)
and then we got Plugin#saveResource (instance method)
?jd
check the docs for this stuff
thanks
?cc add jd-spigot https://hub.spigotmc.org/javadocs/spigot
Custom command successfully added.
?cc add jd-bungeecord https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/overview-summary.html
Custom command successfully added.
Custom command successfully added.
?cc add jd-bungeecordchat https://javadoc.io/doc/net.md-5/bungeecord-chat/latest/index.html
Custom command successfully added.
Custom command successfully added.
?jd
?cc add jd-s https://hub.spigotmc.org/javadocs/spigot
Custom command successfully added.
?jd-s
oh neat
how do I disable a specific item from being dropped when a player dies
like how do I prevent compasses from dropping on the floor
i just want it to get deleted from existence
saw that
does that get triggered when player dies?
uh, nvm. missed the dies part of ur question lol
PlayerDeathEvent???
probably
saw that, i dont see anything to stop a specific drop
PlayerDeathEvent.getDrops().remove(itemStack); maybe
hmm lemme try
if you dont have a itemstack to remove you might have to loop through the list and just compare the material lol
cuz idk how you remove a specific item
exactly like you said, looping and comparing
didnt work
¯_(ツ)_/¯
trying to prevent a drop on death
specifically compasses
oh right yeah then just iterate like others told u to
@EventListener
public void iBelieveYouCanNameThisAnythingSoJustGiveItACreativeName(EntityDeathEvent e) {
for (ItemStack i:e.getDrops()) {
if (i.getType().equals(Material.COMPASS)) {
e.getDrops().removeAll(i);
}
}
}``` ?
i'm just confused on how to remove an itemstack from the list from within the loop itself
yes i understand events lol
(referring to ur edit)
yeah but idk if thats gonna work or not but you can try it lol
oh yeah thats just an interface
ArrayList extends it i think
ah
?learnjava if you need I guess
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.
wait um one issue
this only works in stacks of 1 compass
so if i have a stack of compasses and die it still drops
oh
do i just literally loop from 1-64 for each itemstack?
what? just loop the items in the inv, and check the material
it shouldnt..
maybe replace remove with removeAll?
also, use the .equals method smh
i did that
How would you recommend grabbing current TPS for 1.17 without NMS?
import net.minecraft.server.v1_16_R3.MinecraftServer; and...
int tps = MinecraftServer.currentTick;```
kk lol
if there are multiple stacks of compasses
then it bugs out
not possible you need nms unless your using paper
could always use paper
i'm using tuinity
ok thats a fork of paper isnt it?
so yeah, i should have access to those classes
i understand why, just dont know how to fix it
Bukkit.getTPS() but idk if tunity has that (paper i know has it)
i know spigot doesnt have it
it returns a double[]
i'll try using a "normal" for loop (dunno what to call it, the thing that uses i=0; ...) and then subtract one from i if it removes an item
@EventListener
public void iBelieveYouCanNameThisAnythingSoJustGiveItACreativeName(PlayerDeathEvent e) {
for (ItemStack i:e.getDrops()) {
if (i.getType().equals(Material.COMPASS)) {
e.getDrops().remove(i);
}
}
}``` try this?
hmm ok
idk if it will work or not
red underline
show
The method removeAll(Collection<?>) in the type List<ItemStack> is not applicable for the arguments (ItemStack)
if (idDoesNotExist()) kits.giveKit(kitID, player); //player never used any kit
else if (kitIdDoesNotExist()) kits.giveKit(kitID, player); //player never used this kit
else if (kitIsOnCooldown()) player.sendMessage("kit is on cooldown"); //kit is on cooldown
else kits.giveKit(kitID, player); //kit is not on cooldown```
is there a better way of doing this?
What is red?
send ss
not you
ah i dont think it has a removeAll welp then idk
wat
you can lol
how..-
just put it in
Looks good
oh im not verified bruh
you u using vs for spigot?
yeah
hm aight
why
@sharp bough tho I guess it’s a little bit repetitive
oh
yea i was looking for a cleaner way of doing it
of cant find anything
i did my own strategoy
if (kitIsOnCooldown()) {
sendMessage
return
}
kits.giveKit
idk do u?
whats the difference
Integer is the object?
int is primitive
oh ok
that might return null if player never used the kit or any other kit, thats why i check if player is null, and then if kit is null
but i cant do || cuz that would return null i think
if i try to get a value inside a path that doesnt exist
Yeah well your abstraction made it hard to spot the null checks
make it not null?
var x = !null
UUID:
kitID: Long
kitID: Long
kitID: Long
UUID:
kitID: Long```
long is when it was used
to get the cooldown
so if(kits on cooldown) takes the value in kitID, inside the uuid
i think a database would be better for this than a file
like sql? never really used it
and i dont wanna spend the next few days learning it
i gotta finish this first
no
only on disable
or on command
ok
where do i have to put the default config.yml inside my jar?
i mean, the intellij project
in resources?
in src/main/resources for maven
resources
ok thanks
Does xenforo support webhooks? I.e. is there any easy way to pipe a thread from the spigot forums onto a discord without needing to write and host a bot?
idk and idk
never used it
i dont have money to pay for it so i never used it
ik, but I am talking about as a user
Wondering if I can pipe a plugin's resource thread into its support discord
"Is anyone a doctor here?" - "I'm not!"
that way responses can be a bit faster
Probably not
doubt it, and even if you would need some sort of api key
Actually, 100% no
thanks, looks like it is bot time
🥲
unrelated note, for some reason I am going to write this discord bot in go
because why not
Good choice
can you even do that?
I always write in Java which ends with a catastrophe
I have started disliking oop in general
I mean it’s very powerful but yeah verbosity and some other things are cons
I just stick with JS for bots
same
to be fair, I think someone wrote a discord bot in bf.
I think someone also tried writing a MC proxy in bf, then found their sanity and decided not to
python is just too easy for discord bots
can you even do that?
bf?
idk, all I know is that I would never want to
whats that
how are you gonna send api requests in brainfuck?
I am sure someone has done it, and I am also sure that however they did it was probably exceedingly complicated
Sounds masochistic lol
I think someone also made a webserver in bf
sounds impossible
one sec, let me find the repo xD
some people have too much time
ah
and the brainfuck does the html stuff
older than 1995 at the very least
Meh, still easier than working with legacy code
still impressive for bf
Actually, I wonder what the most complex bf program on github is, one sec
is there any way of getting a persistent server unique identifier?
so the nhow do u guys get a lot of stuff done
the spigot api and craftbukkit are relatively limiting
well mostly people just use something which is not a api called NMS
its not recommended to be used cuz it gets updated every version
i guess reflection but mostly people just make separate classes for each version
(From earlier)
https://en.wikipedia.org/wiki/Tower_of_Hanoi
http://www.clifford.at/bfcpu/hanoi.bf
Found it
The Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower and sometimes pluralized as Towers, or simply pyramid puzzle) is a mathematical game or puzzle. It consists of three rods and a number of disks of different diameters, which can slide onto any rod. The puzzle starts with the disks stacked on one rod in order of decreasing size, ...
I started using sponge but not really a solution
I rolled my own mixin bootstrapper for 1.16 so I could do the fun stuff, but that requires running a jar that sets up Paper and cpw's modlauncher.
There is a project that does it already
never used b4, are there any guides
¯_(ツ)_/¯
have you never used before?
is it possible to get console colors with spigot? When I use the following code:
Bukkit.getLogger().info(ChatColor.YELLOW + "This is a " + ChatColor.GREEN + " test");```
nevermind, found that this works:
getServer().getConsoleSender().sendMessage(ChatColor.YELLOW + "This is a " + ChatColor.GREEN + "test");```
well how would u go about modifying the initial login packet thats incoming from the client
Is damagemodifier not getting removed then? there are comments saying it is but its now been 5 versions of mc, doubt its going anywhere.
do i need to use this to set an instance property? or both static and non static properties at the same time is not a thing in java and it knows what to do when setting a property?
this is the correct way?
public class Message {
String m_author;
String m_message;
public Message(String author, String message) {
m_author = author;
m_message = message;
}
}
or this
public class Message {
String author;
String message;
public Message(String author, String message) {
this.author = author;
this.message = message;
}
}
bro tf why is spigot so limited
i just need a way to modify the first packet b4 the player name is sent and shit
the property needs to be public to read it?
without specifying private or public, whats the default?
well i need to be able to intercept it in the first place
but ik i can use reflection and buildtools
Use Protocollib
How would I best go about modifying vanilla loot tables? I'm not too keen on using a datapack for it because my plugin generates custom items each with random attributes and such. Making combinations of what each item could be like would stack in the thousands and probably even millions.
I only saw a way to extend it and make my own
Even then I'm not sure how to override the vanilla unless I cancel the event, I'm hoping that's not the only solution because I'll be looking at spaghetti code with all the drops I'm adding/changing.
Ive never used it 🤷♂️
I mean you don't have to use loot tables
Most plugins don't
Listen to the entity death event and add your drops there
If you have a lot of drop combinations thats what you need to do
bro i just found out about protocollib
then i check back
to discord
and u reocmmend it to me
do you know if it can modify packets that are not player specific yet
like LOGIN state
Yeah also use PacketWrapper of you want to male your life easier
not just PLAY
You can modify and packet recieved or sent
please
i meant modify the very first packet someone sends
acnowledge me
like C00PacketLoginStart
you sure about that though?
cuz it isnt even in the play state yet
and not player bound
All packets
No
BuildTools isn't hard to use though
And It's the only good way to get a spigot jar
Everything else are illeagal uploads
(Forks like Paper have their own system and are perfectly fine)
If i have a list being created like this
public void loadEvents() {
angryBeeEvent = new AngryBeeEvent();
events.add(angryBeeEvent);
summonCreeperEvent = new SummonCreeperEvent();
events.add(summonCreeperEvent);
loopTntEvent = new LoopTntEvent(this);
events.add(loopTntEvent);
giveDiamondGearEvent = new GiveDiamondItemsEvent();
events.add(giveDiamondGearEvent);
giveDiamondEvent = new GiveDiamondEvent();
events.add(giveDiamondEvent);
loopSheepEvent = new LoopSheepEvent(this);
events.add(loopSheepEvent);
lightningSpawnEvent = new LightningSpawnEvent();
events.add(lightningSpawnEvent);
giveAppleEvent = new GiveAppleEvent();
events.add(giveAppleEvent);
}
I want to do event.getEnabled(); wich just returns true or false, and then if its true put it in the list, if false. dont.
Whats the best way of doing that, would i have to create a new List?
Loop through everything in List1 check if its enabled, if true add it to List2?
gtg
shit ran into another problem. i need to remove 1 line of code from nms
interesting message there
[06:11:34 INFO]: [ProtocolLib] Enabling ProtocolLib v4.6.0-SNAPSHOT-b492
[06:11:34 ERROR]: ******************************************************
[06:11:34 ERROR]: *** ProtocolLib does not support plugin reloaders! ***
[06:11:34 ERROR]: *** Please use the built-in reload command! ***
[06:11:34 ERROR]: ******************************************************
[06:11:34 INFO]: [ProtocolLib] Disabling ProtocolLib v4.6.0-SNAPSHOT-b492```
?
"Please use the build-in reload command!"
so im testing with IF but for some reason its adding another line in my inv called "server name", i did do that but i already removed it but its not updating. i removed the plugin, built it again and its still there, even if i make the pane or gui smaller
code
that code is from the last SS
you made ItemGenerator man
send me.paradis.aurorakits.UTILS.ItemGenerator
Line 35 change the 9 in there to s 8 maybe
thats the lenght
i already checked that
it starts at 1
Try with 8
oh u have that library
aight
sec
See if it will work
Then idk
xd
1s ec
i copied and pasted
oh
LMAO
i had the items in my inv
for some reason they got added
and when i clicked them it would take it as an item of the created inv
ahahaha
thx everyone
oh i had the global thing
gui.setOnGlobalClick(event -> event.setCancelled(true));
which passhfinder do i need to call for entity go to locatioon that i give ?
WTF
you sure ur using the right repo/artifact
wdym
how can i create a config file if it doesnt exist
you make it
yeah
.
saveResource?
declaration: package: org.bukkit.configuration, interface: Configuration
@granite stirrup
bump
declaration: package: org.bukkit.inventory, enum: ItemFlag
Hey guys, what's the 1.17 method to get the full NBT tag for an inventory item?
wasn't that for saving the folder in the jar file
i want the user to be able to change the config
No?
then how do i make it save the file like every other plugin
i got this from https://spigotmc.org/wiki/config-files
final String fileName = "manhunt-config.yml";
configFile = new File(getDataFolder(), fileName);
if (!configFile.exists()) {
configFile.getParentFile().mkdirs();
saveResource(fileName, false);
}
config = new YamlConfiguration();
try {
config.load(configFile);
} catch (IOException | InvalidConfigurationException error) {
error.printStackTrace();
}
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
just throws an error
java.lang.IllegalArgumentException: The embedded resource 'manhunt-config.yml' cannot be found in plugins\Manhunt.jar
no..
Well you need it
i said i wanted to save the config outside the jar
It's for the default
BUMP
this
where do i put it
Resources
Src/main/resources
nice
Stupid autocorrect
could it also be that im reloading with plugman
it is
b r u h
Maybe but you also need it in the plugin jar
lemme try restarting server then this
That's where it copies it's content from
Pom.xml?
no
?paste
Remove sonatype repo
Are you using maven?
no
why?
You don't need it
Ah then you place it somewhere else which idk where
What build tool are you using gradle ?
resources folder isn't inside your package dir
atleast from the image im thinking you've put it there sooo
Put it in src?
lemme try
He's not using maven
i see
can anyone check why line 10 is error? https://pastebin.com/wMWx82h0
how do i strip colors from a string? like a display name ie
[22:51:43] [Server thread/INFO]: [Manhunt] Enabling Manhunt v1.0
[22:51:43] [Server thread/ERROR]: Error occurred while enabling Manhunt v1.0 (Is it up to date?)
java.lang.IllegalArgumentException: The embedded resource 'manhunt-config.yml' cannot be found in plugins\Manhunt.jar
at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:192) ~[spigot-1.17.1.jar:3178-Spigot-eac3cd9-a6292cc]
at me.okay.Manhunt.Main.onEnable(Main.java:57) ~[?:?]
if you open any plugin you will see that files eg configs, are not located in the package, maven, gradle or just base compiling
whats your file layout right now?
manhunt-config.yml is my "template" config
final String fileName = "manhunt-config.yml";
configFile = new File(getDataFolder(), fileName);
if (!configFile.exists()) {
configFile.getParentFile().mkdirs();
saveResource(fileName, false); // line 57
}
config = new YamlConfiguration();
try {
config.load(configFile);
} catch (IOException | InvalidConfigurationException error) {
error.printStackTrace();
}
open your exported jar and check if the file was exported with the plugin
do you have winrar?
yeah
any file opener like winrar or 7zip should work
right click the jar and do open with winrar
alright
the yml shouldn't be in a separate folder unless specified
brug
in this instance it should be in the same as plugin.yml
looks like it's in a seprate folder
^
resources isn't technically a folder that gets exported when you compile the plugin
It can be whatever you would like it to be.
like whats the standard most plugins use
i called it manhunt-plugin because i was worried it might interfere with other plugins
it won't
ah ok
your plugin creates its own dir folder with your plugin name
It's in its own data folder so there will be no issues
^
the issue with your instance is that its actually exporting the resource folder, when it should just be compiling the files inside the folder
move the config so its in the same page/dir as plugin.yml
alright glad to hear
wait one more thing
ye?
how do i actually grab diff values
like i have this:
FileConfiguration config = new YamlConfiguration();
so i'm assuming just
config.getBoolean("track.distance")?
config = YamlConfiguration.loadConfigureation(instanceOfFile);
my bad i had this underneath it
config = new YamlConfiguration();
try {
config.load(configFile);
} catch (IOException | InvalidConfigurationException error) {
error.printStackTrace();
}
yes that would get the value
Track:
distance: false```
and how do i change values of it?
config.set(location, value);
config.save(file);
config.set("Track.distance", false);
can anyone check why line 10 have a error? https://pastebin.com/wMWx82h0
whats the error
Cannot resolve method 'registerEvent(github.bubzhome.combatplusa.Main.PluginListener, github.bubzhome.combatplusa.Main)'
wow
sometimes I am amazed by my own genius
hey I am making a combo plugin, how would I assign a value to a player's name in order to keep track of it's combo?
- assign it to their uuid
- hashmaps
doc pls?
Does anyone have the symbol for a splitter?
is there a special data type for uuid ?
its just a uuid object UUID
you'll see it if you do player.getUniqueId()
HashMap<UUID, Integer> combo= new HashMap<UUID, Integer>();
this?
?
this? |
thats legit |
you are going to get better luck finding it in a utf-8 symbol list than asking it here
its not
pretty certain
ok
I just remember it looking like this last time I tried that one
for me its whole
Unicode web service for character search. Find, copy and paste your favorite characters: 😎 Emoji, ❤ Hearts, 💲 Currencies, → Arrows, ★ Stars and many others 🚩
heres a unicode table
how to check if a item is already in a hashmap
key or value?
key
does anyone know how to fix the error cannot access net.minecraft.world.INamableTileEntity?
EntityPlayer ep = ((CraftPlayer)player).getHandle();
GameProfile gp = ep.getProfile();
all im doing
ping me if u know the answer please, ill look at it tmr
imma bout to pass out im so tired rn
?paste
I swear I called every null exception error possible
https://paste.md-5.net/fepifusula.cs
but i keep getting an error on line 30
https://paste.md-5.net/aledakavox.cs
try and add if(crate == null){ return} before the air check
see if it throws a error then
you can't have a method inside another method
still throws the same error
ty
How to get UUID for a player?
getUniqueId
How to make a timer in plugin
declaration: package: org.bukkit.scheduler, class: BukkitRunnable
?scheduling
are you new java or only spigot?
only sigot
spigot
sry low sleep me = low iq me
ok
haven't slept in 3 days
@chrome beacon
Yo I told you to use Protocollib
If you're a beginner avoid NMS
What can't you edit
cant get that far
And I'll prove you wrong
EntityPlayer ep = ((CraftPlayer)player).getHandle();
GameProfile gp = ep.getProfile();
its self
causes an error'
cannot access net.minecraft.world.INamableTileEntity
Lmao 3 ppl typing
Yeah that has nothing to do with tile entities
UUID uuid = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(event.getMember().getId());
if (uuid != null) {
String playerName = Bukkit.getOfflinePlayer(uuid).getName();
#do stuff
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "player" is null
works only when I'm in the server
GameProfile gp = ep.getProfile(); causes it
Well yeah
Player needs to be online for name
You will have to cache it or send request to mojang api
Other plugins works the same thing when im not online
With the same code I mean
(that I made)
Actually where are you using the player interface
and that what getOffline player is for, no?
does anyone know why GameProfile gp = ep.getProfile(); causes cannot access net.minecraft.world.INamableTileEntity?
Where is player
Did you import NMS?
Also use Protocollib
i am
and i did
i ran build tools
and using that spigot
instead of thr api
unless there is more to import nms
wdym?
You sent us the wrong code
imma sleep but olivo please help
nope
also this
/**
* Gets the player by the given UUID, regardless if they are offline or
* online.
* <p>
* This will return an object even if the player does not exist. To this
* method, all players will exist.
*
* @param id the UUID of the player to retrieve
* @return an offline player
*/
@NotNull
public static OfflinePlayer getOfflinePlayer(@NotNull UUID id) {
return server.getOfflinePlayer(id);
}
Idk why that error would show. I don't have enough info
Use Protocollib
Is there any event that is fired when player exp changes?
I know about PlayerExpChange event but that doesn't account for enchanting which makes player lose exp
Then listen to the Enchant event?
Do you always lose at least 1 level when enchanting?
if so PlayerLevelChangeEvent
top = 1
second = 2
third = 3
at least <<<<<
oh xd
So just dump your whole class. You're still not sending the right information
?paste
what about anvils, they also make you lose exp
^^^^^^
^^ if that doesn't work then listen to anvil event too
Is there an anvil use event the only one I found is PrepareAnvilEvent
Called when a players level changes
Ill try that
doesnt say naturally
Yeah naturally probably only means picking up xp orbs
Could you send me the entire error and make sure this is the latest version of the code you're testing with
Hello! how can I copy/paste region? I used cuboid but I can't do that: http://pastebin.com/pv8JFXXL without worldedit? (Please don't ask why I'm not using world edit. because It would be cool If I don't use!)**
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.
Because the player variable is null and you don't have that one
so theres a situation where you dont lose a level when enchanting or using anvil?
I am trying to make exp shared so all players have the same, I would prefer to do so without a Runnable, thats why I need to account for exp lost when using enchantmne table
From what I can tell you should still use WorldEdit. You don't have enough experience to recreate it
thanks, that made me look into the other class
Copy pasting other peoples code doesn't make you "cool"
thanks you for reply, but I want to experience
and challenge
yet I managed to forget it
just check for xp after he level down????????
???
no
check when PlayerLevelChange
Well you should know what you have to do.
- Loop all blocks in cuboid region with simple loop
- Save that to a list
- Write it to a file somewhere
- for loading
- Read that file in to a list
- Loop through that list
- Place the blocks with an offset from original position
ohhhhh thanks u
that means they probably used anvil or enchantment table
PlayerLevelChange is not fired
when they use table
I lost 3 levels
I'll take look at .schemic file
but still
ok
Was about to say don't
oh why?
It's really advanced and you are not ready for that yet
Is there an event that is fired when a player uses an anvil
check player events
declaration: package: org.bukkit.event.player, class: PlayerEvent
how to make a class excute a method when player attack at the right time
I don't get the scheduler thing
Do you want to keep track of their attack timer?
I want to make a custom attack timer
oh
Well all you do is Store the timestamp + cooldown
And then if you want to check how much is left just do that stored value - timestamp
so I am making a combo plugin
and you only get a combo when you attack at the right time
and the timer gets incrementally smaller
there are many ways to do stuff with time
not just scheduler
How can I optimize it more? I think worldedit uses this method, so how do we optimize it?
I don't know of any
yeah i look at scheduler and it is not good
if we save 10k block, the loop will occured 10k
Yeah which is why WorldEdit can crash your server with large selections
Now if you want to do things like FAWE you will have to read/place a certain amount of blocks per tick so the server doesn't do that
FAWE also does some other magic that you shouldn't to make things faster
https://stackoverflow.com/questions/12908412/print-hello-world-every-x-seconds
this, but I don't know it it runs on another thread
alr
hissssssssssssssssss
XD
I will look ty 😂
oh no don't this is bad
oh
Not good for what Bubz is doing
oh
Please offer a solution, I want to know as well
I've told you what you need to
You need to work with timestamps from everytime an attack is called
oh I see this now
@exotic scroll are you doing it so if a player attacks and kills a diff player or whatever, and if they are in a certain time, then add combo and shrink time?
so when a player get a crit the process starts, ad a timer starts, you can only get another combo after <x> period of time which gets incrementally smaller and smaller. The more combo u have the more damage you deal
it gets smaller as the combo value goes up
XD
My solution is what you were looking for
im looking at it like, create new date, then on attack check if date has passed, if so add combo then new date but smaller diff
simple solution
Yeah
ye a scheduler is terrible for that
after x time have passed, there is a timeframe where when you attack again, it will increase the combo
if you get damaged or stopped attacking, the combo will get cancilled
Don't use Scheduling here
do devs still support 1.8 plugins?
Depends
^
With 1.17 it will be harder to support older versions
So it might finally be time for it to die
Yes, I was trying to add some features to a plugin, but 1.8 didn't work
i can understand somewhat why people still use 1.8, but simply cause i use alot of 1.12.2 and 1.16.4
I believe 1.8 because of old combat
^^
lol
some ppl does
bc that is the only way to display their skills , this gives them confidence when they are insecure irl
or they just like hurting their fingies
or smth else , i am not assuming this
I mean I have nothing against block hitting
Tho I do think people should stop using 1.8 still regardless
it's been so many years since new combat, people should just switch to new versions
I would to, but I will probably only 1.13+
ye mines 1.8-1.17
i understand why people do 1.13+ now cause it becomes a pain to do more
As long as the plugin doesn't use nms, why not add 1.8 support
how to make a player's next attack stronger?
Missing API
Listen to the EntityDamageByEntityEvent and increase the damage
how to increase the damage tho
I already got the listener
thats how
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
heres the docs
?jd
ty
forgot that was a command
so
EntityDamageByEntityEvent.setDamage(Base type, double (EntityDamageByEntityEvent.getDamage*multiplier))
please tell me thats EntityDamageByEntityEvent isn't what you called the event object
what does your constructor look like?
I called it PlayerDamage
public static void onPlayerDamage(EntityDamageByEntityEvent entity){
if(entity.getDamager().getType()==EntityType.PLAYER){
Comboclass.testcombo(entity.getDamager().getUniqueId());
}
}
}```
oh you called it entity fewwwwwwwwwww
i felt so bad for ya
if you called it EntityDamageByEntityEvent
am i retarded or does it miss the @EventHandler
i think they just sent the method
makes sense. i just shove it over the method every time
i only realized they sent the whole class when i looked back and saw Listener at the top
forgot the @override on enabled and disabled too
can u give me an example of entity.setDamage(); ?
like what goes in the parenthesis?
i also just noticed, is your class static 0_0
event.setDamage(0.0);
I know it is a bad practice but I am confused and i just put static for all
so if i do that what will it do?
i know i need a double
set the health to 0
is it just a multiplier
set the health of the damagedentity?
i think so
@exotic scroll i suggest you to take some java courses before jumping into spigot plugin development.
public void setDamage(double damage)
Sets the raw amount of damage caused by the event.
For compatibility this also recalculates the modifiers and scales them by the difference between the modifier for the previous damage value and the new one.
Parameters:
damage - The raw amount of damage caused by the event```
^^
oh that is what it does
ty
entity.setDamage(EntityDamageEvent.DamageModifier.BASE , (entity.getDamage*multiplier))
what is a good one?
?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.
kk
This should change the item name, but it doesn't
how can I get a players head?
It think the string might have to contain something
But a space in there
" "
ok
Guys, if there anybody who understands how the spigot messaging channel works, i would like to ask you a couple of questions, thanks
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
okay, if i do player.getServer().getInfo().sendData() from bungee, and catch the event on spigot, what player will be passed in the event on spigot
Well you're not sending any players with that
You're not really sending anything with what you've shown
The player is in the events params
Send the player UUID instead
I mean that one
So, when i send data from bungee (as on bungee there is no sendPluginMessage method on bungee) the player is just a random player from server that received the message?
can I set an inventory items to be unmoveable?
cancel the click event?
^
ok, I thought there would be a property..
na
you can add one using PersistentDataContainer 😄
Yeah so that player will be the one that is the ProxiedPlayer
But you need to use sendData on the ProxiedPlayer object not server
oh, that makes sense
I'm not sure what happens if you just send it to the server without the player
It will pick a random one
I see
At least i could not find any logic in that choice XD
public static void InventoryClickEvent(InventoryClickEvent e){
if(e.getClickedInventory().getName().equalsIgnoreCase(ChatColor.RED+"ADMIN STUFF")){
e.setCancelled(true);
}
}``` Is this how to cancel an inventory click event? and why it doesn't work
for some reason when i use ProxiedPlayer#sendData, my spigot plugin does not receive any message at all
Uhh its static
^^
Did you register the channel?
hm
And thats a message sending method from bungee plugin
and if i just change player.sendData to player.getServer().sendData it starts receiving those messages
The hell is that
uh
i guess i will just have to send needed players name as a string for every message
thats weird
Hello how i get Player2?
Player fall from high place when trying escape Player2
I am using EntityDeathEvent
and use event.getEntity().getLastDamageCause()
ik have that but
what about arrow? i dont know if arrow detect the shoter
what about this?
if(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent damager = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause().getDamager();
console.info(damager.getName());
}
@quaint mantle
public void EntityDamageByEntityEvent(EntityDamageByEntityEvent e) {
if(e.getCause() != EntityDamageEvent.DamageCause.PROJECTILE) {
Projectile projectile = (Projectile)e.getDamager();
if(((projectile.getShooter() instanceof Player)) && ((e.getEntity() instanceof Player))) {
//TODO: YOUR CODE HERE
}
}
}```
Entitydamagebyebtityevent, check if the damager was a projectile and if it is you can get the shooter
that if statement checks if the cause isn't a projectile do code
i think you meant to write ==
?paste
hey to the previous problem
https://paste.md-5.net/nuqaqusefe.java
does this work?
Someone know what the error here?
DamageCause deathCause = player.getLastDamageCause().getCause();
I am testing plugins and everytime I need to change client to join older version, how can I just join with 1.17 on all servers?
I using Intellij IDEA
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', this.getConfig().getString("reload-message")));
Error: https://imgur.com/a/N81fgqo
It is not ur main class
getConfig() is a method only available in the class that extends JavaPlugin
I mean there’s no such instance method called getConfig
Your code is in ReloadCommand
so just use the instance of the plugin
is there any configless plugin out there?
what?
Configless?
Thanks
ya
wdym by that
What does that mean
as in a plugin with no config?
ya
