#help-development
1 messages · Page 529 of 1
I realized that just now, thank you!
to be clear I have no use for this
it just popped into my head and I'm just curious
but is there a way in spigot to fake a lighting bolt
without packets/nms
the namespacekey for a recipe needs to be unique i suppose?
rn i just have it preset to something
Yes
Hey, I am currently working with the EntityExplodeEvent, and I want door blocks to not explode when hit by TNT. Currently, I am looping through blockList and removing the door blocks. I confirmed with a sysOut that the blockList.remove(block) is being run for both the top and bottom of the door. When I test this with regular blocks, they are not broken. However, the door still breaks. Does anyone know why? I am guessing it has something to do with the door being a multiblock.
You need to ensure the blocks it is attached to and the block below it dont get removed
Lol np easy mistake to miss
Based
!verify
Usage: !verify <forums username>
!verify
Usage: !verify <forums username>
!verify Legnano
A private message has been sent to your SpigotMC.org account for verification!
?paste
i'm trying to make something like mineplex's turf wars but i don't know a simple way to do this without just using multiple signs to set rows
(not my map)
basically i'm trying to figure out an efficient way so when a player kills someone on the other team, each row changes to the killer team's color one by one until all rows are done
what i was trying originally is setting a sign on the sides of each row and having it just get every connected block in a certain direction but that seemed way too complicated than it should be
i feel there is a better way to do this but no idea
I am trying to make a plugin called: "anti-grief". With this plugin you have possibility to do some commands:
/anti-grief : this command gives you the list of all the commands of this plug.in
/ag claim [Name] : this command gives you the possibility to claim a minecraft chunk, and save it with [Name] i.e. to name that chunk as you want. In this chunk it is possible to destroy blocks, but as soon as someone destroys a block inside on these chunks, an admin (with op permissions) you are notified with a message and with [Name] where the block was destroyed.
/ag delete [Name] : this command gives you the ability to delete a chunk already saved with [Name].
/ag list : gives you the list of all the chunks saved with the [Name] list.
can you tell me if this script is sufficent?
I'd go for a method where you set the middle location of the map, and a direction axe for the map (like the y direction, with +y for blue and - y for red). Each time a kill happens, move the y middle and replace each clay block Ith the correct color (maybe you could set the range from the middle to replace block (on the x axis) to avoid having to check connected blocks
I'd probably do the map with Chunk as key, since you'll check a block each time a block breaks. (Map<Chunk, String>)
If it's all your code, you miss the block break listener part
i see what you mean, that could possibly work actually, if i had bounds yeah but i also wouldn't know then how many rows are left before the other team wins
Is the map fixed, or could it change ?
well it could change but for now it's fixed
i could hypothetically just specify how many rows to win
This is the parameters you need :
- middle location
- team axe
- bound of the "playing" map (where the color can change
and for the rest no yml file is needed right?
Otherwise you could try to build, under the map, a pattern easily recognized by your plugin (for instance put sponge blocks in the direction of both teams, and while you change row and stay on the sponge columns, the game could continue)
If you want your chunk to persists, you'll have to save your map
By map I mean java map, not the Minecraft map
I would go for PDC in the chunk instead of saving the data yourself
less headache, just let Spigot handle most of the work
do you have any PDC with you, and if yes can you send it to me?
?pdc
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
okay thanks, will probably try it in the afternoon. Will keep you updated on how it went
just look over the mineplex sc leak
maybe you find something useful in there
Define an axis where the rows are at
Then pre-map the game map to see what blocks will be changed
Something like
Basically just
you have 2 teams
you can use a number to keep score
if it's positive, team 1 is winning by whatever
if it's negative, team 1 is losing by whatever
I'll just add this on here if you want to quickly change the blocks instead of using World#setBlock https://www.spigotmc.org/threads/methods-for-changing-massive-amount-of-blocks-up-to-14m-blocks-s.395868/
(if your map is large, could be useful)
Anyone knows hoe to get custom Anvil GUI's text in some way?
Need Help
AnvilGUI is a library to capture user input in Minecraft through an anvil inventory - GitHub - WesJD/AnvilGUI: AnvilGUI is a library to capture user input in Minecraft through an anvil inventory
I think using this library is your best bet
thanks for that
OuOb
has anyone gotten JavaFX to work before from IntelliJ? every time I use javafx:run its throwing Unrecognized option: --module-path Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. for me even tho its using java 11
Do you need JavaFX for a spigot plugin ?
no lol
im just wondering if anyone got this shit to work 💀
I dont think so, I cloned a repo on github
(its a uni project template)
does intellij do smth special if I make a template?
I think you need some special JDK no ?
afaik you just need to define the javaFX libraries and java 11+
it was a bit of a pain to get javafx shit to import but it is what it is
oh ye, there are two ways, misread the docs
Tho there is this line
In any case, for both options, it is required to have a recent version of JDK 20, or at least JDK 17.
https://openjfx.io/openjfx-docs/
Getting started with JavaFX for Java desktop application development
im being trolled on god
now I need to download javafx compatible with 20
aaah
ill give it a try and check in a sec
[INFO] --- javafx-maven-plugin:0.0.8:run (default-cli) @ rpg ---
Unrecognized option: --module-path
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.```
with java 20
does javafx-maven-plugin just do its own thing and use the default java version or something
oh you dont want to know
one sec
Download an jfx jdk (for instance Azul JDK Java FX) and use it to code, compile and run
Using gradle for JavaFX is a pain since you can't shade JavaFX in your final jar
C:\Users\paradise\.jdks\openjdk-20.0.1-1\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\Users\paradise\rpg-team-water -Djansi.passthrough=true "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\lib\idea_rt.jar=65112:C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2023.1 org.openjfx:javafx-maven-plugin:0.0.8:run
What does the maven plugin do
great question
Easiest way: using a JavaFX jdk
but you can also use a gradle plugin (running is easy, creating jar is almost impossible)
If you'd like to go with gradle, https://paste.md-5.net/oyurinumap.cs
But it's impossible to make a jar without cheating
https://paste.md-5.net/mahoduguka.xml well jhere's my pom.xml
maven 4 it looks like
i only really fucked with the java version in the pom everything else was cloned
it could have something 5 decades behind for all I know
and no my javafx plugin is 0.0.8
i mean their github readme has 0.0.8 i didnt even know 0.0.9 existed
try corretto
🫡
Did you run with maven JavaFX plugin?
yeah
and what even is that pom
it always throws the same fuckin error no matter what version I use
You should try to run normally without that plugin
you dont need any special shit to do stuff with javafx
i have a feeling its not even using the right java version and the plugin is just using my local java version
but idk how to test that theory
because everything above java 9 supports module-path
What are you doing which requires javafx?
a uni project where we need to use javafx lol
ah bummer
tell me about it
[INFO] --- javafx-maven-plugin:0.0.8:run (default-cli) @ rpg ---
Unrecognized option: --module-path
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[ERROR] Command execution failed.``` corretto failed too
remove that plugin
and use only the dependencies
dont code for a specific jdk
alright ill give it a try
alright
using the run feature says the javafx components are missing but im assuming thats because idk its not packaged or sumthin
Right
This is not required
Error: JavaFX runtime components are missing, and are required to run this application
SUIIIIIIII
JavaFX is not embedded in Java since java 8 or 7 iirc
where did my javafx components go lmao
You have to package the jfx components in your program
Or at least add them in the module path
If you want to quickly develop for now, just download a JavaFX JDK and run your app with it!
ah yes
the javafx components are clearly missing
(they are clearly right there and they're packaged with the app)
or is there other components only in JDKs
well this time I did C:\Users\paradise\.jdks\corretto-20.0.1\bin\java.exe -jar .\RPG.jar
when I ran my main with intellij it threw the same error
what sdk are you using for the project
C:\Users\paradise\.jdks\openjdk-20.0.1-1\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\lib\idea_rt.jar=50574:C:\Program Files\JetBrains\IntelliJ IDEA 2022.2.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\Users\paradise\rpg-team-water\target\classes;C:\Users\paradise\.m2\repository\org\openjfx\javafx-controls\17.0.1\javafx-controls-17.0.1.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-controls\17.0.1\javafx-controls-17.0.1-win.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-graphics\17.0.1\javafx-graphics-17.0.1.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-graphics\17.0.1\javafx-graphics-17.0.1-win.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-base\17.0.1\javafx-base-17.0.1.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-base\17.0.1\javafx-base-17.0.1-win.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-fxml\17.0.1\javafx-fxml-17.0.1.jar;C:\Users\paradise\.m2\repository\org\openjfx\javafx-fxml\17.0.1\javafx-fxml-17.0.1-win.jar rpg.RPG
click on it and press f4
oh shit i had openjdk and not corretto
das weird
anyway
one sec
that didnt help
X-X
yea
😭
I noticed they make a custom run configurariton
configuration*
but
didnt work so well for me
it doesnt even work if I make a new project with the javafx template
sick
oh I see
the maven plugin doesnt work at all
the run button does
How to create npc in minecraft 1.16.5?
Unless you want to use NMS and packets then the Citizens plugin has API
Do you know Java?
Do you need to create it yourself ?
I am sure there exists a lot of plugins for shops.
?basics
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.
yea but i need to do it myself so i can be a dev
alright
Ik is kinda lazy, but how can i easily add some random names, or "players" so i can test the paginated menu i did, java // Get the list of online players List<Player> onlinePlayers = new ArrayList<>(); onlinePlayers.add(player);
not sure what you mean
but you could just not use a player object for testing purposes
or better yet, use OfflinePlayer instead
since you can still fetch player names with that
Oh yeah thanks
They can be
It’s up to the jre
Oops my messages didn’t load
Idk why I’m replying to someone from yesterday
hi guys i have a question for coding syntax
example:
players have a combat level and i wanna give extra damage per level
can i do this like this ?
if (playerlevel > 1) {
add extra damage 1
}
else if (playerlevel > 2) {
add extra damage 2
}
else if (playerlevel > 3) {
add extra damage 3
}```
?
or can i do this better ?
Are you talking Java ?
yes wdym ?
actually not java i just wonder syntax
ye, different languages have different syntax
alright let me explain
but if the playerlevel is an integer you'd want to add the integer to the damage
If you have max level of 50 for example, you're not gonna create 50 cases for if.
if its bigger than 1, it might be bigger than 2 too
can i do >=
That will not fix it
yes
i think now
but i understand
so can i do this with "if"
so my syntax example is true for do this at programming ?
you can but please don't
There are better ways to do whatever you're doing
yes i know
i just wonder the syntax
im new at coding and i wonder this
and i thought i could do it with "if"
but since im new i wanted to know if there is any other method
A better approach would be
event.setdamage(event.getdamage() + player lvl)
Without using if
this is it!
i wanna prevent xp pickup event
can i do this with InventoryPickupEvent ?
EntityPickupItemEvent
long answer short: you cant
alternative: listen to xp change and set it to 0 or when an xp orb is spawned set their amount to 0
public void getXp(PlayerExpChangeEvent e) {
Player player = e.getPlayer();
if (player.getLevel() > 30) {
player.setExp(1507);
}
}```
do u mean this event ?
yes, but cancel the event instead of re-setting the exp to a fixed amount
if i do with this event players can still pickup orbs
Is there a way to prevent a tnt minecart from being ignited by another Explosion?
cancel event not working
yeah no shit sherlock, but they gain no exp from it
EntityChangeBlockEvent maybe
otherwise some explosion event
BlockIgniteEvent
^ that could do it
public void ignite(BlockIgniteEvent e) {
Block block = e.getBlock();
if (block.getType() == Material.TNT_MINECART) {
e.setCancelled(true);
}```
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.
😄 alright
newbie spoonfed by a newbie
I tried BlockIgniteEvent but it doesn't seem to trigger on a TNT minecart as that is an entity
you can cancel the xp gain
but not that he picks up the orb
you could also cancel that the orb targets the player
but they can still walk over it and pick it up
which event to do this ?
maybe this fix
I can exempt a tnt Minecart from being affected by an explosion, but I can not prevent it from being affected by the ignition caused by that explosion
And BlockIgnite event does not seem to include entities like a tnt minecart (as far as I tested)
i look at for entityburnevent can't find
._.
oke he found
EntitycombustEvent does not count the ignition by Explosion of a TNT minecart as a combust event
Sadly :(
It does trigger on when I ignite the tnt minecart with a flame bow
EntityBlockFormEvent
What block would be created?
trigger with fns and other explosions ?
Could you explain what you mean by fns?
otherwise try EntityDamageByEntityEvent or rather EntityDamageEvent and check the cause
End crystal Explosion also triggers it hmm, just not primed tnt Explosion
I'll do some more testing
this prevents the tnt minecart from taking damage, but does not prevent ignition.
?jd-s
how can you send a packet to a users client?
Use NMS or Protocollib
Tyty, is there a way to make exceptions in this event as to what causes the event? For example a player can ignite the minecart but tnt should not be able to.
It doesn't seem to have a "cause" element :o
i cannot get a playerconnection at all from a player
i want to use this .getHandle().connection.send(); but send does not accept a packetcontainer
and what version
protocollib 5.0.0 and 1.19.4
so how would i do that?
Read the README
wouldn't that send it to the server?
read
Hi guys , i have created some events for my cosmetic but nothing work...
Someone can help me with that? :))?
public void onSwapHandItems(PlayerSwapHandItemsEvent event) {
ItemStack item = event.getOffHandItem();
if (item != null && item.hasItemMeta()) {
ItemMeta itemMeta = item.getItemMeta();
if (itemMeta != null && itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ColorUtils.translateColorCodes("&eʟᴀɴᴛᴇʀɴᴀ &6(ᴄᴏsᴍᴇᴛɪᴄᴏ)"))) {
event.setCancelled(true);
}
}
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
ItemStack item = event.getCurrentItem();
if (item != null && item.hasItemMeta()) {
ItemMeta itemMeta = item.getItemMeta();
if (itemMeta != null && itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ColorUtils.translateColorCodes("&eʟᴀɴᴛᴇʀɴᴀ &6(ᴄᴏsᴍᴇᴛɪᴄᴏ)"))) {
event.setCancelled(true);
}
}
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
ItemStack item = event.getItemDrop().getItemStack();
if (item != null && item.hasItemMeta()) {
ItemMeta itemMeta = item.getItemMeta();
if (itemMeta != null && itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ColorUtils.translateColorCodes("&eʟᴀɴᴛᴇʀɴᴀ &6(ᴄᴏsᴍᴇᴛɪᴄᴏ)"))) {
event.setCancelled(true);
}
}
}
}```java
put "java" at the end of the first ```
so it is colored
```java
code
```
Are you registering the event listener ?
?paste rather
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I know but shush
ye
gotta remember this one as well
Then the only thing I can think of is the display name not being the same
i can do everything like events don't exist
tried to print out a message at the beginning
ITEM:
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
Player p = (Player) sender;
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ColorUtils.translateColorCodes("&eʟᴀɴᴛᴇʀɴᴀ &6(ᴄᴏsᴍᴇᴛɪᴄᴏ)"));
meta.setCustomModelData(15);
item.setItemMeta(meta);
p.getInventory().setItemInOffHand(item);
return false;
}
}
oh ok
Isn't using ChatColor.### better then the magic numbers in strings ?
so i will try with normal chat color?
people prefer it over color codes because of anxiety disorders that the codes could one day vanish
That is probably not the problem
they will
Mojang will one day replace everything with chat components
compare items by #isSimilar
i hope mojang will one day replace chat with sneak only
for that you have ender crystal
i have added it but don't prints anything
Then you don't register the events
send where you registered your listener
i need to send all class or only string
The class has to implement the Listener interface
Bukkit.getPluginManager().registerEvents(new Events(), plugin);
ye ik
send the method where this is
ender crystal meth
i need to send all class or only string ( im confused lol )
what do you mean by "string"
like this
Send the stuff around as well
**LanternItemListener **
There is no
Bukkit.getPluginManager().registerEvents(..., plugin);
I would expect one to be in onEnable() method
You literally have to register all events in this way, or they will not work
Just replace the
new LanternItemListener();
with
Bukkit.getPluginManager().registerEvents(new LanternItemListener(), this);
That should work
ok i will try
oh yeah now work
sorry
last question
name of the event block the item swap Offhand to mainhand(?)
ye, sorry, I don't think I understand your question
Or I might but I am not sure
If you want to prevent swapping the item from mainhand -> offhand and offhand -> mainhand you would use the same event
Just check for a different item
then, I blocked the player could: move the item from the main hand to the left hand but I would also do the opposite.
How can I do that?
You're checking only the offhand item
Now check the mainhand item
in the onSwapHandItems method you have
oh ok thanks steve 🙂
Couple questions about the forward bungeecord messages
#1: With the forwarding done with Forward, the subchannel name is completely set to the subchannel name you specify on the receiving server, it doesn't say "Forward" or anything of the sort. Is that normal? (Assuming it is, just wanted to double check)
#2: How the hell does bungeecord ForwardToPlayer work? Does it send a message to the client on the bungeecord channel? How does the response know to go to the server that originally sent the message? Can clients even respond to ForwardToPlayer?
Trying to make a sort of wrapper so I never have to touch this again, but wanted to make sure the first thing was expected behavior and actually properly implementing ForwardToPlayer would be nice. (right now i just detect unknown subchannels and set those all to be a incoming forward message)
So I have these 2 commands, the /daily works but /store does not, it seems not to get called as I can't see any of the logs I made:
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
// Daily Command
if(cmd.getName().equalsIgnoreCase("daily")) {
if(sender instanceof Player) {
Player p = ((Player) sender).getPlayer();
UUID uuid = ((Player) sender).getUniqueId();
LocalDateTime localDateTime = PlutoAddon.commandCooldown.get(uuid);
if(localDateTime == null) {
PlutoAddon.commandCooldown.put(uuid, LocalDateTime.now());
// Reward
getServer().dispatchCommand(Bukkit.getConsoleSender(), "crate key give " + p.getName() + " daily 1");
}
else if(localDateTime.isBefore(LocalDateTime.now().minusHours(24))) {
PlutoAddon.commandCooldown.put(uuid, LocalDateTime.now());
// Reward
getServer().dispatchCommand(Bukkit.getConsoleSender(), "crate key give " + p.getName() + " daily 1");
}
else {
p.sendMessage(ChatColor.RED + "You can only use this once a day! Come back tomorrow :)");
}
}
return true;
// Store Command
} else if(cmd.getName().equalsIgnoreCase("store")) {
getLogger().info("/store done");
if(sender instanceof Player) {
getLogger().info("was a player");
Player p = ((Player) sender).getPlayer();
p.sendMessage("Grab some " + ChatColor.GREEN + "ranks " + ChatColor.RESET + "and " + ChatColor.GREEN + "crates " + ChatColor.RESET + "at » " + ChatColor.AQUA + "store.plutocraft.net");
}
return true;
}
return false;
}
show us how/where you're registering them
idu
ismy code wrong ?
@EventHandler
public void getXp(PlayerExpChangeEvent e) {
Player player = e.getPlayer();
if (player.getLevel() > 29){
player.setTotalExperience(1506);
}
}```
this not working
no errors
me?
did you register the listener?
yes
yes
yes
show me where you registered it
already i try setlvl
this works
name: PlutoAddon
version: '${project.version}'
main: net.plutocraft.plutoaddon.PlutoAddon
api-version: 1.19
authors: [Gizmo0o]
description: Simple addon plugin for PlutoCraft.
website: plutocraft.net
commands:
daily:
description: The /daily command.
usage: /daily
permission: plutoaddon.daily
permission-message: You don't have plutoaddon.daily
store:
description: The /store command.
permission: plutoaddon.store
permission-message: You don't have plutoaddon.store
in the code
but where do you register the command
does getCommand().setExecutor() or smthn like that ring a bell
ohhhhhhhhh wait lemme try that
i try getxp gettotalxp in if
not worked
only getlevel and set lvl working
idk
Try printing the values first ?
and i can't cancel the event in this event
thanks now it works i forgot to register it lol
to see what values the getXp() and getTotalXp() have
It might give you a hint why it is "not working"
lets have some private fun 😏
nah, i am all about that protected fun 😳
Couple questions about the forward bungeecord messages
#1: With the forwarding done with Forward, the subchannel name is completely set to the subchannel name you specify on the receiving server, it doesn't say "Forward" or anything of the sort. Is that normal? (Assuming it is, just wanted to double check)
#2: How the hell does bungeecord ForwardToPlayer work? Does it send a message to the client on the bungeecord channel? How does the response know to go to the server that originally sent the message? Can clients even respond to ForwardToPlayer?
Trying to make a sort of wrapper so I never have to touch this again, but wanted to make sure the first thing was expected behavior and actually properly implementing ForwardToPlayer would be nice. (right now i just detect unknown subchannels and set those all to be a incoming forward message)
sorry just resending it all in 1 message so i can make thread
I made vehicles indestructible by tnt, however they do still get pushed away due to the explosion, I have tried setting Velocity to 0, 0, 0
But it seems like it doesn't apply. Might it be applied too early or am I interpreting Velocity wrong?
By how many ticks should I delay? I've tried both 1 and 5 ticks delay with scheduler, didn't hit the mark.
1 should do it
does anyone know how to make my pluigin command overide a command from another plugin?
i want to make a /discord command but essentialsx discord already has that, since (as far as i know) there is no way to disable the essentialx discord commands in a config.yml file i want to overide it
I'll retry then :)
just to be sure this should be the code for the scheduler right?
Bukkit.getScheduler().runTaskLater(this, () -> {
event.getVehicle().setVelocity(new Vector(0, 0, 0));
}, 1);```
Does the SpigotMC website have some sort of REST api?
if you wanna use an unorthodox way you can open the jar file and remove the command from the plugin.yml
This is unofficial, I think:
https://spiget.org/
I appreciate it, thank you.
you should still be able to disable the commands in the config though
Im pretty sure first plugin to register wins
so you could put loadbefore in your plugin.yml
hmmm
i have one hell of an idea
but i wouldnt implement it by myself, since i dont have experience in modifying spigot code
so basically you guys know that in order to do some pathfinding from A, C you usually use Djikstra's or A* algorithm, right
what if you can vectorize that algorithm by creating a a shared library in C/C++ that would implement Java Native interface and calculate the pathfinding data via SIMD operations and return it back with java's declared native function?
imo it could drastically improve performance of the server
since SIMD operations on java are not really properly supported yet
pseudo micro code:
in java
public native int[] djikstra(parameters);
in .dll file (c)
some_jni_object __java_jni_generated__signature__function(parameters) {
//do some some SIMD instrinsic stuff on
}
ofc it would lose cross compatibility of the server
because code is not run on JVM partially (separate .dlls and .so files could be bundled for *nix and windows to run, tho)
but it could boost the performance of ticking pathfindable entities i think
what you guys think?
Question is whether it has any large improvements over actually using java
You'll have quite a lot of overhead from converting java <-> native
Make it bannable
Hsve your mods teleport to players and ban afk pool usere every so often
Ahhh
Well, something with player move event in water
Check for patterning
If a certain pattern repeats to much send a warning out to staff
I think checking for incoming movement packets would work
If no packet was received but the player is constantly moving -> afk pool
Does water trigger player move event?
That's my thought
Afk pools are just water circles
yes
So ideally water wouldn't flow or anything
That won't trigger player move event
Difficult
Yes idk how to do that then
Loop through all players???
Or make list that haven't moved in x amount of time
Check through them then restartb
Seems like that could be faulty so easily
What abt players who are just happen to be moving in a square in water
They'd get insta kicked you'd need to ensure repetition also as NTDI said water moving player doesn't trigger PlayerMoveEvent
Best solution: build several afk pools
Have players AFK in them
Train an AI on the incoming packets
Lol now that's innovative
Train the AI in c and use jni too
Performance go brrrrr
Isn't there a successor to JNI now ?
JEP 442 I think
It is in second preview for java 20
Is there any good scoreboard apis or apis in general that are good with plugin development.
It seems like its a config based thing. Im looking for like an api to create custom scoreboards.
Don't know where you're getting that from
Seems pretty API to me
Md, don't look
Fastboard API
Not config thing at all
Have you watched new megumin show
yep, not the last episode tho
Have not had time, will do today
pls no spoilers 🙂
I'm not caught up
I think it's kinda meh compared to main series but not much to expect from a spin off show
that is what i was thinking too
there should be some overhead as it needs to be passed to jvm somehow
It seems okay.
but the question is it of how bad the overhead is
Measure et
easier said than done
Overhead of ordinary JNI is pretty high from what I know, hence Project Panama exists
Well pretty high is probably relative but it means that there is a overhead that could be lower
We’ll if we’re talking about project panama
Why even use the new foreign function interface
Why not use the vector api directly
not using boards.values().forEach(this::updateBoard) shame on you
it's not my code
It's from the fricking github readme :D
ew
make a PR to fix it if you can XD
I approve of your pfp

what does it tell?
between 0.0 and 1.0
this isnt set player xp ?
alright i will try
between 1 and 0
ur puting on 110
0 < 110 > 1?
!!
im confused for this
i will show 1m
i got this from minecraft wiki
and i think setxp for current level
totalxp is player totalxp
Public funnies
someone help me with components, what is the proper way to create a textcomponent?
when creating a scoreboard, i am required to provide a component as per the new changes i assume. what should i pass in as the parameter? for titles
yea
oh
i didnt know it was different there
sheet
https://docs.papermc.io/paper/dev/api are those really the docs
?whereami
https://jd.papermc.io/paper/1.19/index.html are the paper javadocs
Given that mostly the same logic applies to both paper and bukkit/spigot plugins there is no reason for additional documentation
<insert generic geolykt rambling here>
finally something working
Can anyone tell me how i update my plugin version from 1.19.3 to 1.19.4 in maven?
or add multiple versions
but then i get an error that says that it can't be found
so this need to be changed just to 1.19.4 right?
hello gus i found a one skill plugin and look,
but i can't find player datas(imean playerlvl,player skillpoints) in file
how they did this ?
it gives me this after the reload
wdym?
so yours and mine need to match right?
didn't work
how do I change the jdk version?
how can i store my datas (example player-coin)
if can i do this with arraylist when server restart is datas lost ?
install a new java version and change your path variable
nvm got it working made a spelling mistake
I have 8, 16 and 17
I installed 17 last
you have 17 but only 16 is supported, weird
anyways if you have it installed just go to the systems environment variables and make sure the path to java 16 is higher than the other java versions so it gets priority
go look in Path
it didnt work
1.8.9 server is starting but not 1.16
java version not minecraft...
java 1.8 for 1.16 server?!
AYO WOT
yeah
its weird
that will not work bruh
Yeah, j16 works 1.16.5 and higher, all below use j8/j11
idk man
IK but how do I change my java version to 1.16
I mean java 16
You move it higher in path, or you specify the direct paty to j16 java.exe
oh i didnt know they changed it in 1.16.5
mb
show path variable
💀
@EventHandler
public void onVehicleHit(VehicleDamageEvent event) {
event.getVehicle().getWorld().playEffect(event.getVehicle().getLocation(), Effect.MOBSPAWNER_FLAMES, 0);
Bukkit.getScheduler().runTaskLater(this, () -> {
event.getVehicle().setVelocity(new Vector(0, 0, 0));
}, 1);
event.setCancelled(true);
}
If a TNT explodes next to this vehicle it prevents the vehicle from being destroyed, but still moves. I thought my Vector approach would remove the movement the explosion provides.
Am I doing something wrong?
uhh it needs to point to /bin i believe
so it finds java.exe which is the jvm executable
whats the most broad/super spigot on event I can use for event listener
theres no "Event" one
?xy
Asking about your attempted solution rather than your actual problem
?jd you can also easy check javadocs for that info
There's no mega broad events
You can't listen to any of the abstract events
i think he is refering for base class which all events inherit
what event is used when sugarcane breaks because of a different block being placed?
And we don't have an EventEvent (yet)
from short research seems like its BlockPhysicsEvent, but that one doesnt contain the drops
We need an EventEventEvent then
It's events all the way down
how can I use a completablefuture with the scheduler
CallSyncMethod returns something
It should also trigger the ItemSpawnEvent
However the ItemSpawnEvent will not have the block
I want to do it asynchronously
but I'd like to use the runTaskAsynchronously function
not that it matters that much
wut
There's no async futures in the api
oh Item nvm
but i think that uses a threadpool or something idk
my internet is lagging so much holy shit
can I make a future run synchronously
and just do runTaskAsynchronously and then pass in a runnable where I run the future
Futures use a thread pool by default
All async methods without an explicit Executor argument are performed using the ForkJoinPool.commonPool()
alright that's chill
Nah there's a scheduled pool
But yes, a pool
Oh
You mean java methods
ye
Carry on then
so can I just do ForkJoinPool.commonPool().submit() to make a task
or a future or whatever
nvm ill just google it
yea i am
but i dont think i can listen to those
i might just have to put a ton of different event listener functions which would be ugly but oh well 🤷♂️
?xy
Asking about your attempted solution rather than your actual problem
What are you trying to do
do you want a generic answer or technical
Just give an answer please lol
EventEventEvent :)
Already made that joke bro
ig in general make an items interface with event cancelling lib
ah i cant read
Ok, and how is cancelling every event going to help that
not every?
Well presumably you have per event code then
on the event the interfaces doAction function is called
and whatever is in there based on which instance/what class does whatever is set in there
for example
one that cancels fire tick and fire damage
And why can't doAction be generic with the event type you are concerned with
doAction(EntityDamageEvent)
Then you don't need to cast either
because its an interface for ALL items im creating
oh you mean for that one instance?
Yes, generics allow you to specialise the overrides in each subclass
FireResItem<EntityDamageEvent>
okay so I use completablefuture.supplyasync
Or rather, FireResItem extends Item<EntityDamageEvent>
and then I use thenAccept on that?
is there a thenSupply in case I want to keep chaining returns?
oh yeah thats useful
but back to the actual question with connecting it to event listeners
Add another method that returns Class<T> and hook it up to the non-annotation registerListener methods
Consumer is terminal (void), function returns for chaining presumably
ohhhhhh
that makes a lot of sense
thank you
I don't know how I wasn't able to comprehend that
that dosent work btw
it's coming together
this does for the most part.
ignore the 1 related problem lmao
what are you even doing lol
@EventHandler
public void onVehicleHit(VehicleDamageEvent event) {
event.getVehicle().getWorld().playEffect(event.getVehicle().getLocation(), Effect.MOBSPAWNER_FLAMES, 0);
Bukkit.getScheduler().runTaskLater(this, () -> {
event.getVehicle().setVelocity(new Vector(0, 0, 0));
}, 1);
event.setCancelled(true);
}
If a TNT explodes next to this vehicle it prevents the vehicle from being destroyed, but still moves. I thought my Vector approach would remove the movement the explosion provides.
What could be going wrong?
something amazing
or not
idk it might kinda suck
for anyone with fawe experience, is it safe to use BukkitAdapter.adapt(world) from an async thread?
How do I tell what kind of goat horn a goat horn is from its ItemMeta?
Free PR time
Heck I don't have time currently
Also, I did not know that Goat Horns even have different types lol
Yep
Im gonna be on my pc for 1 more hour max this week
Just spontanously decided to drive to Italy tmrw
last time i checked cancelling a damage event also cancels kb though
i distinctly remember this causing trouble while trying to make rocket spleef
might be wrong though
ok yeah i was wrong
your code works perfectly though
Why not make a cancelKnockBack() method instead?
And maybe default it for setCanceled but let it override it
Oh nvm then
the code he sent works perfectly fine for me
ok turns out im right about the damage cancelling meaning no kb but only in survival
yeah zodra ur code works magnificently on my machine idk man
wait no its broken but only when the boat is inside the tnt hitbox
thats really dumb
Okay after a bit of looking we do have an API for goat horns
oh we do?
MusicInstrumentMeta
goat horns are the best thing ever added to MC
is there any equip and unequip armor event. or even a change slot event
name or anything?
does anyone know how to fix Invalid signature file digest for Manifest main attributes shutdown when loading my plugin? I narrowed it down to a single shaded maven dependency causing it when I shade microsoft sqlserver, when I go to run it in minecraft I get the error above. this has never happened before and I've never had an issue with this previously, I was wondering if anyone knew why it could be happening?
Added the commands to the plugin.yml?
fuck
Im having trouble with one of my files "messages.yml" everything i get from there is null even if the path its correct
so im trying to access the path and it looks good
but always null idk why
Try without the translate and see if it gets it
neither
here im with out the translate
and when i use it on like 44
NPE throws out
theres something wrong with shading the artifact
it explicitly says this*
Show the config file its in
you are using java 17 for your plugin, so you gotta upgrade maven-shade-plugin to 3.3.0 or later
Oh good someone who knows maven better :p
Also smh Alex address your open issue
I have announced days ago that I won't do anything before june 2nd
if someone wants to fix something, they are free to pull request it :3
finally someone who knows that day comes before month when writing out dates
I think there is an open PR
could anyone help me with this?
https://www.spigotmc.org/threads/help-with-player-sendpluginmessage.605456/#post-4591180
yeah about swapping armor with right-click from hotbar
or sth like that
which previously was only possible if the target slot was empty
I have no clue what you're trying to do
plugin messages are, if it's not the bungeecord channel, meant to communicate with the client
YES
byut
my byug
isnt
fixed
and idk what to do
:(
I'm trying to send data from one server to another like the name of the arena a player should join. can it be used for that?
ah thanks
you gotta use the "bungeecord" channel for that
what's the bug?
Everytime i access my config file it appears as null
not config.yml
custom one
you didnt declare the command in plugin.yml
I'll try but I had the same problem. try changing the name and even using "pluginname:data" haha
wat
you didnt declare the command in plugin.yml
what does relates to config files
nothing
isn't this the issue you're talking about?
it says 3.3.0 dosent exist but i checked its maven repo site and it does, additionally it synced without problems so ???
k
send your whole CC and AutoFeedCommand classes pls
including imports, etc
the whole files
perfection
project take over 😂
am i missing something here?
yeah packages obv.
absolutely
also your plugin.yml is located wrong
thats where the exception comes from
oh
this good?
your plugin.yml belongs into resources
oh
Why are your getName and getFile abstract
You can define variables in abstract classes too
yah idk
yeah just 1.19
first time using abstract classes
i havent done plugin dev in like ages lol mb
api version must be "1.19", not "1.19.4"
your config doesn't have any value set for "COMMAND-DISABLED"
is that the config included in your .jar, or the actual file in your plugins/YourPlugin/ folder?
yep
?
i tried everything and nothing works
if I ask "is it A, or is it B", you cannot reply with "yes", you gotta reply with "A" or "B"
and do you have a messages.yml file actually saved in your plugins/YourPlugin/ folder on the server?
if so, how does that one look like?
btw why are you creating a new "Messages" object for every command? can't you just reuse the same instance in every command?
idk, it doesnt matter ig
it just makes no sense. but yeah that files looks fine. In your onCommand() method, loop over all keys of the messages config, then show what it prints, e.g. like this:
public boolean onCommand(...) {
for(String key : messages.getConfig().getKeys(true)) {
Bukkit.getLogger().info(key + " -> " + messages.getConfig().get(key));
}
...
}
how does your Messages class look like?
Not sure why but the effects here or its function atleast never seems to be called(its called)
please stop sending random screenshots of your code and rather paste that code
there
thats like 5 different classes
that's not your messages class
btw you cannot listen to "Event", it's an abstract class
https://paste.md-5.net/uyupadimul.java
https://paste.md-5.net/ipolabujok.java
https://paste.md-5.net/lahihuceto.coffeescript (dk why they think this ones coffeescript)
https://paste.md-5.net/ogemifehej.java
Listener Base: https://paste.md-5.net/ivudulibah.cs this language detection sucks
i dont
look at listener base
ah ok I see
Hello. I found this and it works, it just sends the message to all the servers. Is there something to send it to a specific server?
Config> https://paste.md-5.net/yoneweqehu.java
Messages (Extends config) https://paste.md-5.net/etidoduboj.java
just replace "ALL" with the server name
you never load your config
oh wait
haven't seen the Config class
I do it in main
I thought you extended Configuration
as I said earlier - you create a new Messages object everytime
you may load your config in main, but in the other class you create a new Messages and never load that
I mentioned that earlier, you should reuse your existing "Messages" object instead of creating a new one everytime
OKAY
so
may i make a new class like
ConfigManager
that has a load config method
and for each config
make like
getMessages()?
why don't you just create a "Messages" object in your main class, and then use that for all other classes?
public class MyMainClass extends JavaPlugin {
private Messages messages; // also have a getter for this ofc
// Then in onEnable, create "messages" and load it
}
then in your other classes you just do myPlugin.getMessages().getConfig().getString(...)
in fact
idk whats a getter
👍
gotta learn
private Messages messages;
public Messages getMessages() {
return messages;
}
a "getter" is basically just a method that returns that object
oop encapsulation
you could also just make the field public but that's a rather bad solution
yeah that does the same
It does have an annotation for that but please don't use it if you don't know what a getter even is lol
tbh don't use it at all, but yeah
yeah one should know what it does before using it lol
anyways, did anybody figure out whats wrong here?
the backend implementation was uglier than it could be but i was pretty certain that wouldnt cause issues, but i guess it does and it dosent even leave any logs either
to set values
bad way:
int age = person.age;
int newAge = age +1;
person.age = newAge;
better way:
int age = person.getAge();
int newAge = age +1;
person.setAge(newAge);
the reason for this is simple: implementation details, such as "which value does a field have" is not supposed to leak to the outside
seems weird at first but it makes sense
imagine "person" is not actually a person, but an "Animal" which can either be a human or a cat or a dog. they can all have ages, but you cannot expose fields in an interface
so if now "person" becomes a "cat", you cannot just exxhange it when you access fields directly
or let's imagine you wanna implement a check in the setter, e.g.
public class Cat {
private int age;
public void setAge(int newAge) {
if(newAge < 0) throw new IllegalArgumentExceptions("No cat can have a negative age!");
}
}
not possible when accessing the field directly, you know
encapsulation is a subset of the idea of using contracts. you can promise that "every living thing has an age which you can access through setAge and getAge" but java doesn't support that through fields, only methods
bad way isnt necessarily bad if its in the same class?
in the same class, you can freely access any field
yea
contracts are promises to the outside
oh all i know is encapsulation helps for security of instance variables
that was for an exam 💀
i sorta know what that means
idk anything about computer science exams, I'm a tax lawyer lol
the only reason i know half of what i know is because of CS courses... and then i waste it on useless stuff like making minecraft plugins! 💀
but I can for sure tell you from trial & error and experience that public fields are generally a bad idea, and it's also a bad idea to rely on implementation details, and it's also a bad idea to have redundancy, like creating the "same" (rather similar) object in every class that needs it, instead of injecting it (e.g. creating one Messages class per command, instead of having one Messages class in your main class, and reusing that)
that's not useless at all
I have learnt java in school like 15 years ago. but doing MC plugins made me understand java
whooo
ah for everything to connect well for me, that was unity
though translating from csharp to java took a bit
it's actually extremely similar, isn't it?
it is
but theres certain things that are different and weird
like lambdas at first
i thought => was normal
java devs just yelled at me saying microsoft ruins everything
lol
yeah true, it took me like 2 years to properly understand what a lambda even is
and it still confuses many people, so once I understood it, I wrote this blog post, and I think it summraized it up pretty well in very few words https://blog.jeff-media.com/understanding-lambdas-and-method-references/
i just try to explain to people that it can be used as a callback
no clue what a callback is
lol
oh
like for an action: event -> {}
and it triggers that code when event is invoked
i used it a lot when making something using swing and awt buttons
oh I know what you mean. yeah callbacks, in that case, often do use the lambda syntax, but it can also be used for many other things
e.g. a predicate
yeah
Predicate<Entity> onlyCreepers = e -> e instanceof Creeper;
after all, a lambda is just a short way to implement functional interfaces
yea
also this is cool
but why lightmode 💀
jetbrains products are great though because of quality of life features like this
Yes
even vscode 
IJ gets worse with every update
unfortunately
oh that reminds me, I gotta renew my ultimate subscription soon >.<
ofc my subscription ends during my planned stay in a psychatric clinic lmao
story of my life
i have jetbrains student key or whatever its called
yeah education thingy
same, but gotta renew that every year
I finished university like 7 years ago but I'm still enrolled for all those free software lol
damn
I don't even use my student subscrition
Idk why I renewed it
I've never used any of the perks
intellij only dosent seem that important, but the jetbrains pack is
you dont have any access to rider or clion without
the only IJ ultimate feature I actually use sometimes is UML graphs
visual studio is mid im ngl. There a lot that rider has that it dosent