#help-development
1 messages ยท Page 2179 of 1
sadly no
I just needed the FileUtils.copyInputStreamToFile from it
300kb seems a bit overkill just for that
u can see how spigot saves the config.yml
maybe look for a integrated java alternative
or just copy that method
File file = //...
try(OutputStream outputStream = new FileOutputStream(file)){
IOUtils.copy(inputStream, outputStream);
} catch (FileNotFoundException e) {
// handle exception here
} catch (IOException e) {
// handle exception here
}```
does that work?
yea
JavaPlugin#saveResource
nvm
copy that method
private static void copyInputStreamToFile(InputStream inputStream, File file)
throws IOException {
// append = false
try (FileOutputStream outputStream = new FileOutputStream(file, false)) {
int read;
byte[] bytes = new byte[DEFAULT_BUFFER_SIZE];
while ((read = inputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, read);
}
}
}```
What do I use as resource path?
does anybody know how can I check if the player wear this armor, I want to check when player wears a armor
that should work
player.getEquipment()
yes but I want to check when player wears armor
check if the armor isn't null
or when he equips it?
whats the event for that
someone with github knowlege wanna work on a bungeecord system together?
but when will I check, I want it to check without a command
those things sound pretty unrelated
Thanks I'll set it to that then
btw this worked perfectly, thank you!
what will I do with it
do the same thing
Ctrl + c, Ctrl +v yk
the easy kind of coding
if you can understand it in "C++, C#, Python, Java, JS, HTML and CSS", then you can probably understand it here aswell
I have a maintained version of this
including a proper maven artifact
Better use the maintained version -> https://github.com/JEFF-Media-GbR/ArmorEquipEvent
ok
I try use PotionEffectType but here there isn't WATER effect
simply check if the list of PotionEffects is empty
How?
haven't tested
public static boolean isWaterBottle(ItemStack item) {
if(item.getType() != Material.POTION) return false;
PotionMeta meta = (PotionMeta) item.getItemMeta();
return meta.getBasePotionData().getType() == PotionType.WATER;
}
hello, im making a simple arena system. If player request and another player accepts, i want both to teleport somewhere but somehow even if its entering the condition its not executing teleport method
@EventHandler
public void onMessage(AsyncPlayerChatEvent e){
Player p = e.getPlayer();
if(Arena.playersWhoSentMessages.contains(p)) {
if(e.getMessage().equalsIgnoreCase("yes")) {
for(Player c: Arena.playerWhoInvited) {
c.sendMessage("accepted");
c.teleport(loc);
p.teleport(loc);
}
}else if(e.getMessage().equalsIgnoreCase("no")) {
for(Player c: Arena.playerWhoInvited) {
c.sendMessage("nonaccepted");
}
}
}
}
public fields, static abuse, not using early returns x)
Yeah, it's work. You really help me
BukkitScheduler scheduler = MedievalPlugin.plugin.getServer().getScheduler();
scheduler.runTask(MedievalPlugin.plugin, ()-> {
c.teleport(loc);
p.teleport(loc);
});
like this?
ah
i got it thank you, im getting the pain unknowledges topics about threading
Is there a way to lock the Player from moving to a different Hotbar slot?
cancel PlayerItemHeldEvent
okkk but can i set the slot also?
so i lock it to the right slot
like the slot the player has selected
oh nvm
i think i found that
alright, thanks!
looking for someone to do a project with me
its hypixel skyblock dungeons remake anyone wanna do it?
So I have this method that if they hit something ten times then they win
^
and I want to also send them a victory! screen
just the beginning part dw
ty
?paste
https://paste.md-5.net/ajivequgeq.java
can anyone tell me what does this code?
and adds chests, bats, items, and essences?
yes
it pastes it
you got Skyblock source ? 
hey y'all I'm new to plugins but have experience with java and I hope this is the right place to ask my question
I'm trying to make a simple plugin that prevents enderpearls from despawning in a loaded area when the player is dead
How would I find and override the code for the enderpearl tick event?
tyty
Item has a method "setInfinite" or something like this
maybe just listen for the ender pearl teleporting and delay it until the player respawns
Item has a method "setUnlimitedLifetime(true)"
when you call that, the item will never despawn automatically
I can't attach an image but I found a screenshot of what might be the paper code for the enderpearl tick event
and it basically checks first if the player is dead and if it is, it discards, else it ticks the enderpearl
It would be ideal if I could just comment out the first part
you gotta verify to post images
no you cannot simply comment out NMS or paper code lol
just on this page
https://github.com/PaperMC/Paper/issues/6920
as said you can simply set the EnderPearl to "unlimited lifetime"
i know paper is a fork of spigot
should probably ask in the paper discord
then do this
this is intended for ender pearls floating in bubble columns
they sit there and I don't want them to despawn when players die
I don't think it's a lifetime issue
yeah my bad I meant the enderpearl entity, not an item
They don't
they do in singleplayer and on our spigot server
do I have to save stuff to config or can I make another file (for example, "playerdata") I don't want my config spammed with tons of information
guys how do i pass the plugin parameter in a runnable if i register it from another class (other than the main one)
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
use a database
What kinds of data Wihy?
how long does a spectral arrow last?
how could icheck if block taht platyer placed is sign?
Well I am trying to link discord account with minecraft account, so the player executes
"/link" and it gives them 10 random characters and when they do !link in discord the accounts are linked
I have the link command, and i am trying to save the 10 random characters
so it's a one time thing?
pretty much
Then u dont need to store it
a redis server is fine
like a map would be fine
do you ppl know how can I make it so that when I place the armor on the armor stand it still changes its colors
get the meta, change color, apply the meta
he was asking about changing it in a hand or inventory
but how will I get the armor stand
in memory
let me try similer to this
yes
you get the armorstand, get the things it wearing and get the meta, you know how to go from there
ok
and please, try to google things if you don't know, and mainly challenge to do it yourself without asking others
and do you know how can I get
EntityType item = EntityType.ARMOR_STAND;
Meta
bcz I cant find it on google
does the InventoryView.close() method invoke the InventoryCloseEvent?
InventoryView::close? is that a thing
oh yeah
nvm
but it just delegates Player::closeInventory
so yes
it does fire (the event)
basically im wrapping my inventory with a wrapper class to detect custom interfaces, however its not reload safe, so i want to close those interfaces on a reload
like this
public static void onReload(main plugin)
{
for (Player p : Bukkit.getOnlinePlayers())
{
if (p.getOpenInventory() != null)
{
if (p.getOpenInventory().getTopInventory() != null)
{
if (p.getOpenInventory().getTopInventory().getHolder() instanceof InventoryViewer)
{
p.getOpenInventory().close();
}
}
}
}
}
but i want it to fire the CloseInventoryEvent
cause it doesnt on reload at least
why not p.closeInventory?
ill try
oh ok
I need to build a remapped spigot.jar?
What would you guys say is a good way to abduct a player into an UFO? repeating scheduler increasing his y value and spawning particles around him or smth like that?
levitation effect
ArmorStand.getMetadata()???????
well seems that calling inventory.close() from the ```java
@Override
public void onDisable()
{
Callbacks.disable(this);
Ranks.disable(this);
Admin.disable(this);
User.disable(this);
ViewInventoryCommand.onReload(this);
}
InventoryCloseEvent will get fired if you run closeInventory tho
could you describe it in more detail please
yea but apparently not onDisable()
what version are u using?
oh yeah ofc not onDisable
I didn't play minecraft for a few years xd
1.18.2
cause its already unhooked
yeah
i suppose
well sort of
You can do listener.onInventoryClose
damn they added a lot of stuff while I was not playing the gae
@quaint mantle You can also use ArmorStand.getEquipment(); to get what it holds
ok
i suppose to fire my desired method manually does work tho ๐
ye
aaaaa everything static
not everything
why dont u listen to the plugindisableevent and close all the invetories there
thats exactly what i do
or just close all inventories in onDisable
i just expected the CloseInventoryEvent to fire
because thats where i serialize the inventory
btw timinator I did look into the code
its a bit strange as the code implies the event should fire
and i dont need to null check the inv
wait u serialize inventories every time they close?
no
only when the player is offline
whose inventory i inspect
ohh
if hes online i apply it to him
well sec
may I ask
@Override
public void onDisable()
{
ViewInventoryCommand.onReload(this);
}
@EventHandler
public void onInventoryClose(InventoryCloseEvent event)
{
ViewInventoryCommand.onInventoryClose(this, event.getInventory());
}
``` those are the two methods in the plugin main class
does it still work if I cancel the movementevent while adding the effect to a player? I dont want him to change x or z coordinate
not sure
public static void onInventoryClose(main plugin, Inventory inv)
{
Bukkit.broadcastMessage("TEST");
if (inv.getHolder() instanceof InventoryViewer)
{
InventoryViewer inventory = (InventoryViewer) inv.getHolder();
if (Bukkit.getPlayer(inventory.getHolder()) != null)
{
saveOnlineInventory(plugin, inventory);
}
else
{
saveOfflineInventory(plugin, inventory);
}
}
}
public static void onReload(main plugin)
{
for (Player p : Bukkit.getOnlinePlayers())
{
if (p.getOpenInventory() != null)
{
if (p.getOpenInventory().getTopInventory() != null)
{
if (p.getOpenInventory().getTopInventory().getHolder() instanceof InventoryViewer)
{
p.closeInventory();
}
}
}
}
}
``` and these are my static methods to perform
sure
thats the code that runs
How do I check if a pillager has banner?
(not if he's a PatrolLeader)
get the inventory
check if it contains banner
saveOnlineInventory applies the inv to the player if hes online and well saveOfflineInventory serializes it to his file
the variable in JavaPlugin enabled gets set to false just before the onDisable() call
there is no such thing in pillagers
//from spigot
for (RegisteredListener registration : listeners) {
if (!registration.getPlugin().isEnabled()) {
continue;
}
it didnt work before
so ill just do this line then ```java
onInventoryClose(plugin, p.getOpenInventory().getTopInventory());
@humble tulip but in what slot should the banner be
ye
aight teye
print it out and see
print slot and material
good to know so i can adjust the code
sounds like a good idea
and i dont see whats wrong with public static void methods which have only one designated purpose
@humble tulip
How can I turn lines in console into strings?
to some extent, event listeners are more procedural than object oriented
its [null, null, null, null, null]
so static in that case might be fine 
does the pillager have a banner?
he does
I did this:
System.out.println(Arrays.toString(p.getInventory().getContents()));
well the listeners are mostly callbacks but since i dont plan to cancel most events only inject custom behavior
check getEquiptment
most*
nah
they're still callbacks
try using Bukkit.getLogger().log(Level.INFO, "your string");
It's also all null
by definition yea
what???
are you sure?
I printed this 2 minutes ago
i'm gonna check
use bukkit logger instead of printl because its safety better wand wont throw warnings
do people still say that?
well i mean its not a crucifiable thing to not know the definition but yea
ideally, use the plugin logger
indeed
ye ofc
although one might argue that my coding style might be bad for writing less generic code and more one purpose methods
xD
You meant .getArmorContents() right?
yeah
which would be an argument against static voids
ik
^^
you dont do any unit tests, nor are you gonna scale your plugin to the moon
i mean im aware of that fact
and i do use almost only instancing when i write my own interfaces or plugin systems
but here i dont
@ivory sleet do you know how to check if a pillager wears a banner?
yeah
its not in his inventory or armor slots
wanna see what ppl would love to murder me for? xD
need to dm u cause the code is too long
want? @ivory sleet ๐
oh yea and now with the manual call the inventory gets serialized on reload properly
nope i was right clicking it
it's not in the inventory
I meant that maybe its null for me because its dead
it is
it's in the armor contents
thats a part of its inventory tho
well yes but no
which is 4/5 of the inventory
tf
I'll try again
System.out.println(Arrays.toString(p.getEquipment().getArmorContents()));```
`[ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}, ItemStack{AIR x 1}]`
@humble tulip
what version?
it must be because the pillager is dead
1.18.2
I want this in entityDeathEvent
i guess run your code if its not cancelled and health - damage is < 0
just see if the contents are null there
then we know if its death or not
@humble tulip Can you send your right click event?
btw one question about this, @ivory sleet ive softcoded everything, using my self written low level ini parser for the frontend and bukkits serializer for the backend. that being like okay or would you suggest something else?
the pic was the entire event
yes but i meant the text
?paste
the server crashed ;-;
mojang down?
invalid session id
restart ur launcher
it happens when the auth server thinks ur no longer online
mojang
its to prevent stealing session IDs
hey guys how i can create custom player nametags with packets? can someone explain me step-by-step of which packets i need to use?
ok
@humble tulip One of the armor content is the banner
in your event
in my it is not
it must be because its dead
idk how to fix it
does the right click event work?
yes
right well use entitydamagebyentityevent
entity is not dead yet but u can tell if it will be
ok
how can I get a fake nms entity through it's PacketType.Play.Server.SPAWN_ENTITY
Uh sure
Really hard to judge with no code x)
@humble tulip It prints null ;-;
if (event.getEntityType() == EntityType.PILLAGER && event.getDamager() instanceof Player && event.getEntity().isDead()){
Pillager p = (Pillager) event.getEntity();
System.out.println(Arrays.toString(p.getEquipment().getArmorContents()));```
oh wait
dont check if the entity is dead
check if its hp is lower or equal to 0?
elaborate
yes
how do I get its health
I have a plugin sending fake spawn nms armorstands to the player.
I want to turn the packets into a EntityArmorstand and see it's data such as name, helmet item, etc.
๐
its a bit hard to get the "fake entity" as if you use the spawn entity event directly, there's no entity for it server sided by default, so you'll have to keep track of it manually
almost everything works now but for whatever reason the armor slots dont get applied properly
is equipping armor treated special?
How can I turn every line from console into a string
assuming you're doing holograms
is there anyone who has lots of NMS experience with custom world generation?
No I'm trying to make localized model engine models
uh, mind elucidating your issue a bit further?
ah okay
but well
you'll have to create your own object that keeps track of necessary data
But their api has no docs and is a bit stinky
it has docs tho
Nope
Their docs is a single example repo with the ability to spawn a modeled mob in
untrue
Show docs
Every time a console message appears, I want it to be sent to my discord channel
I'm talking about model engine
oh
(since I said I'm not using holograms)
yeah, thought you were still alluding to hd but my bad
nah all good
yeah model engine is a bit notoriously known for its lack of docs
did you ever finish that code to launch a mob to a block so I could see how you kind of made it better
yeah tell me about it, their api is just not it chief
I think I found sth
dk if its up-to-date
https://github.com/Ticxo/Model-Engine-Wiki/wiki
Yee that's the demo
It shows you how to spawn one in
but not localize it to a player
do mobs have something called a "RangeManager" btw?
something to tell when a player can see a mob
or is close enough to render the mob
how can i generate a net.kyori.adventure.text.Component from a string.
Poons, afaik nope
I mean there's the reach distance
but thats probably not what you want as thats global
and iirc client sided
Component.text(str)
ye ofc
What's the PlayerChunkMap.EntityTracker
.text("example")
Because I think that's what he was talking about when it comes to RangeManager
?paste
Yea thats not a thing i meant
oh
yeah
also @ivory sleet
paper doesnt have that bug https://paste.md-5.net/iqesefadub.cs
bruh its a butt ton of overloading, theres like 30 methods i see
that's how they fixed it
is there a way to disable that? or make it not work
sorry for all the pings btw, I keep forgetting that discord autopings on all replies
why does this not work? it's supposed to increase the bad omen level if the level the player has is between 5-10 but it does nothing.
if (effect != null && effect.getAmplifier() >= 5 && effect.getAmplifier() < 10){
PotionEffect potion = new PotionEffect(PotionEffectType.BAD_OMEN, Integer.MAX_VALUE, effect.getAmplifier() + 1);
player.addPotionEffect(potion);
}```
is your code actually running?
@granite beacon give it a try tho iirc EntityTracker::removeEntity is protected so might need to use method handles there
then idk if that actually fixes it
yes I checked
but worth a try
i am so fucking dumb i was making a new instance WHILE calling the text method
Component myComp = new Component().text(str);
// bruh

It's an NMS tracker which tells players to load an entity, when to do it, when to get rid of it and if the player has loaded it before. It's used on multiplayer to sync mob changes, like when players throw a fishing hook
tiny bit more to it but thats the basics
So in theory, I was told that if that system fails it then falls back to the original system which is a list that shows which players to load the model for
5 is 4
haha yeah
wdym fails
DM
ok so now I know that all the if statements are ok. but this doesn't give me the potion effect and I get no errors in console.
player.addPotionEffect(potion);```
first effect: BAD_OMEN:117528t-x4
second effect: BAD_OMEN:(120000t-x5)
I printed this to the console
How can i get the max health of an entity? LivingEntity#GetMaxHealth is deprecated
attribute
wdym?
mob.getAttribute(Attribute.GENERIC_MAX_HEALTH)
thx
potion.apply(player);```
The player gets the effect but the amplifier is without the `+ 1`.
is this because you can't get this effect in vanila? I can get it in commands tho
The amplifier of effect is 4
so the one of potion should be 5
but it's still 4
Yes it gives me the potion but the amplifier doesn't go up from 4
why is that and can I fix it?
Try to see if u can with /effect
Hardcode the multiolier as 6 and try
I did
still doesn;t go up from 4
every amplifier which is more than 4 becomes 4 when its applied
what's the problem
.
in PotionEffect
why?
does metadata on blocks persist through restarts?
idk it becomes 4 when I apply the effect if the amplifier is more than 4
its just not funny
how are you trying to apply it? and when
?spoon
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.
potion.apply(player);```
effect.getAmplifier() is 5
in an event
can you open google? yes or no
what event
why does it matter when
then you wont get answer here
entityDamageByEntity
word
it might help reproduce or identify the issue
?paste
hasbanner function?
if (effect != null && effect.getAmplifier() >= 4 && effect.getAmplifier() < 9) { }
it checks if a pillager has banner in any of his armor slots
Does it return true?
check if the player has bad omen 5-10
I see, it's just that
The plugin does reach these lines
yes
if you want to add potion effect on player
you have to do it through #addPotionEffect()
on player class
this player.addPotionEffect(potion); instead of potion.apply(player);
I know that when you add enchantment to an item you need to input if it should ignore the vanila limits. does PotionEffect has something like it?
those are flags if I remember right
but I dont think potioneffect class have it
public PotionEffect(@NotNull
PotionEffectType type,
int duration,
int amplifier,
boolean ambient,
boolean particles,
boolean icon)
they both get the same outcome
so it does not go above 4?
yes
1.18.2
and you want manual giving of bad omen effect, why?
Is there a better way to verify if a string is a long?
minecraft won't give bad omen above level 5. my plugin is supposed to make the maximum bad omen level 10
isn't it capped in minecraft?
you can get it up to level 255 with commands
@twilit roost disable psychics from the arrow, that disables the gravity I think
hmm, okay, let me think
thx
I just now checked the console and saw that it does Log
soo it prob works ๐
I can execute the effect command through console, right?
the vanilla command
in vanilla you can't
only commands blocks
if I'm right
but spigot allows it
@EventHandler
public void Limit(EntityDamageByEntityEvent event) {
if (event.getEntityType() == EntityType.PILLAGER && event.getDamager() instanceof Player) {
Pillager p = (Pillager) event.getEntity();
if (p.getHealth() - event.getDamage() <= 0) {
if (!hasBanner(p))
return;
Player player = (Player) event.getDamager();
PotionEffect effect = player.getPotionEffect(PotionEffectType.BAD_OMEN);
Bukkit.getLogger().log(Level.INFO, String.valueOf(effect));
if (effect != null && effect.getAmplifier() >= 4 && effect.getAmplifier() < 9) {
PotionEffect potion = new PotionEffect(PotionEffectType.BAD_OMEN, 120000, 8);
player.addPotionEffect(potion);
}
}
}
}
@harsh totem try this
why 8
oh I already checked it with level 6 and 7.
And I printed the effect it was BAD_OMEN:117528t-x4
Bukkit.getLogger().log(Level.INFO, String.valueOf(effect.getAmplifier()));
if (effect != null && effect.getAmplifier() >= 4 && effect.getAmplifier() < 9) {
PotionEffect potion = new PotionEffect(PotionEffectType.BAD_OMEN, 120000, 8);
player.addPotionEffect(potion);
Bukkit.getLogger().log(Level.INFO, String.valueOf(effect.getAmplifier()));
}
this?
I already logged these
sorry, do this after adding potion to player
Bukkit.getLogger().log(Level.INFO, String.valueOf(potion.getAmplifier()));
okay
so
it doesn't work?
the only difference is that the effect is level 4 and the potion is above this level.
the potion is what it should be but I can't give it correctly because the amplifier becomes 4
oh
player.removePotionEffect(PotionEffectType.BAD_OMEN);
i'll check it
@EventHandler
public void Limit(EntityDamageByEntityEvent event) {
if (event.getEntityType() == EntityType.PILLAGER && event.getDamager() instanceof Player) {
Pillager p = (Pillager) event.getEntity();
if (p.getHealth() - event.getDamage() <= 0) {
if (!hasBanner(p))
return;
Player player = (Player) event.getDamager();
PotionEffect effect = player.getPotionEffect(PotionEffectType.BAD_OMEN);
Bukkit.getLogger().log(Level.INFO, String.valueOf(effect.getAmplifier()));
if (effect != null && effect.getAmplifier() >= 4 && effect.getAmplifier() < 9) {
player.removePotionEffect(PotionEffectType.BAD_OMEN);
PotionEffect potion = new PotionEffect(PotionEffectType.BAD_OMEN, 120000, 8);
player.addPotionEffect(potion);
Bukkit.getLogger().log(Level.INFO, String.valueOf(potion.getAmplifier()));
}
}
}
}
you can get rid of those loggers
but use this function
effect.getAmplifier()+1);
how do i make a code looking like that box?
do by ```
thanks
"```" infront and behind your text
variables:
{%player%.random} = false
options:
every 10 seconds:
loop all players:
if {%loop-player%.random} = true:
chance of 50%
give loop-player minecraft:dirt
chance of 50%
give loop-player minecraft:oak_sapling
wait 1 tick
command /test:
trigger:
if {%player%.random} = true:
set {%player%.random} to false
message "&c&lDISABLED &dYou will no longer receive a random items every 10 seconds" to player
else: set {%player%.random} to true
message "&a&lENABLED &dYou will now receive a random item every 10 seconds" to player
whats wrong
it does not work
?
okay, let me think
what does this do?
and why are u just asking why doesn't it work
its meant to every 10 sec give a player a 50% chance og getting one of those blocks
wdym
bruh wdym
this is not code
bro i asked what's wrong
this is not code
bruh the Hoi4 community better then this
its skripts
what's wrong is that you're using skript lol
That's not Java Spigot Code, thats seems to be SkriptMC code. Which completly different
noone here uses skript
well this was the only minecraft discord i knew
i guess because it doesn't have to be compiled
if (amt == 1) send(player, "fishing.catch.amt_1",
Placeholder.component("catch", catches.get(0).displayName()),
durTag
);``` would anyone know why it's sending a list? i'm only passing one value
because nobody care about modeling
interpreted languages are beautiful
the effect is given with amplification of 4 when it should be above it. the effect has the right amplifier but when it's given the amplifier becomes 4.
player.removePotionEffect(PotionEffectType.BAD_OMEN);
potion.apply(player);```
why cant it go above 4
working on it
server you're running it on?
@harsh totem
kotlin > java
imagine having opinions ๐คก
scary statement there
java is definitely superior to kotlin but kotlin does make things easier
nah
yeah i know, but there's something beautiful about not having to open a compiler and have your code being understood with a reload
java creates so much boilerplate
spigot
pls help
but all of the server info, not hardware but builds and those things
it's not sending list
like what
it may be a boilerplated language but at least is safer than most languages
you can't really make a mistake
in javascript and c++ on the other hand
like, idk how but send the spigot version and the build and stuff like this, i think if you doi /version it sends it in the chat
then why are the [ ] there?
doesn't that have everything that you get a object to send in chat
id say kotlin is better for making something like an client or forge mod while java would be better for a server or spigot plugin
anyone knows?
and do getName() and not display name
personally i do modding in kotlin but plugin development in java
can you try it with another effect?
whats the Placeholder class?
it's a kyori thing
Maybe I should execute the vanilla command through console
for localization
with speed it works fine
I get level above 4
its because the vanilla limit
speed has no limit
(besides 255)
How to make Velocity follow function(curve) sin/cos
?
and bad omen?
Should I use Persistent Data Storage? I don't really know how maps work
the vanilla limit is V but with command it can be above
which command?
./effect give YTG667 <effect> <duration> <amplifier>
well I'm sorry that I couldn't be much of a help, if I think of something I might text you, is that okay?
ok thx anyways
Remove the check every tick for collision
And see if it follows a parabolic trajectory
oh imma post updated code
@EventHandler
public void Check(ProjectileHitEvent e){
if(e.getEntity() instanceof Projectile){
if(ShipCannon.shotBalls.containsKey(e.getEntity())){
ArmorStand as = (ArmorStand) e.getEntity().getPassenger();
ShipCannon.onCollision(as);
ShipCannon.shotBalls.remove(e.getEntity());
}
}
}
public static void AddForce(){
ShipCannon.shotBalls.forEach((projectile, vector) -> {
projectile.setVelocity(vector.subtract(new Vector(0,0.2,0)));
});
}
this works ( kindof )
Why are you modifying the velocity though?
With an initial velocity, minecrafts gravity will do the rest
when i shoot it using "commands"
i give it a velocity
but after a while it would stop at place and start falling straight down
so I disabled gravity and im setting the velocity manually
Also is it possible to make arrow/projectile invisible?
Give it more horizontal velocity then
well it still suddenly starts dropping
doesn't look that great
no
I mean
you can do it by removing the entity on the client-side but attached entities will look funky
just turned off pc since I have to sleep rn
Imma dm you tommorow?
Sure
How can I know when a packet is sent?
for exmple, Entity Equipment
either inject the pipeline or use protocollib which injects for you
I'm a bit new to packets haha, what does 'inject' mean?
think of a tube
with a door in the middle
you can see what goes through the tube, add into it, maybe remove some
why does this give it with an amplifier of 4?
player.removePotionEffect(PotionEffectType.BAD_OMEN);
player.addPotionEffect(potion);```
this adds Bad Omen level 9
is should. it adds it with level V
check out what /data says
Is there some event to keep track of a player's first login?
PlayerJoinEvent? then check if Player#hasPlayedBefore
the variable effect is level 9. the given effect is level V
Is there an easy way to convert a bukkit GameEvent to an NMS GameEvent? I'm trying to get the game event id in IntList that is send in ClientboundUpdateTagsPacket.
I checked it with logger
So I want to be able to detect if a mob in the nether is killed, however after doing some debugging it appears that the entity isn't being detected in the nether
@EventHandler
public void onNetherDeath(EntityDeathEvent event) {
if(event.getEntity().getWorld().equals("world_nether")) {
if(event.getEntity().getKiller() instanceof Player) {
Player player = event.getEntity().getKiller();
player.sendMessage("TEST");
double random = Math.random();
if(random <= 0.25D) {
player.sendMessage(ChatColor.DARK_RED + "The " + ChatColor.GOLD + "Fire Knight " + ChatColor.DARK_RED + "has risen!");
fKnight.createFireKnight(player.getLocation());
}
}
}
Not sure if I used getWorld() wrong or if its something else
no answer ;-;
nobody knows
as said, it works for me. and I asked you to check the output of /data and what amplifier it says there
youโre comparing a world to a string
What you put in the .equals() is a string
probably need to use getName
not a world
ahhh
@crisp steeple maybe you can help?
several people here didn't know what the problem was
uhh
idk, maybe the max that potion can go to is 4?
havenโt really played later versions of mc much
with commands it can go above
I can do /effect give YTG667 minecraft:bad_omen 9999 100 true
is there no event for when a crossbow gets "charged" with an arrow?
it's not related to the number. it only cares if it's above 4. when it's above 4 it becomes 4
have you ever tried to give bad omen effects?
no
@crisp steeple so nobody knows what's the problem.
I guess i'll execute the vanilla command through console
not really sure what else the problem would be ยฏ_(ใ)_/ยฏ
idk why you keep refusing to check the output of the /data command
Is there a maven world edit repository?
I'm trying to put it, but it gives me an error
yes there is, check their wiki page
did maven relaod?
yeah
sure
what's the output when you do mvn clean package -U?
and what repository did you even add?
show the full log
https://prnt.sc/uWVVWyOV5lFs For example, the painprevention if I take it
click the uppermost thing here and then copy paste the full log
also as I said - what repository did you use in the first place?
I'm not English, it's hard for me to understand and I'm slow, now I'll answer the questions.
?paste your whole pom.xml
that's probably the easiest solution
what is this command
/data get entity <playername>
no, send your "pom.xml" file
and how would that help?
so you can see what potion muliplier your player's NBT data has saved
you haven't added the WorldEdit repository at all. You also haven't added any repository for GriefPrevention
- I told you I outprinted the effect and it was the right level
- /data doesn't show potion effects
Could you tell me how to fix it please?
add to repositories:
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
of course data shows potion effects
@tender shard
data shows literally everything
yeah
I recognize those numbers. see you soon
there is some kind of error that makes it send only a part of the data
EncoderException: String too big (was 337460 bytes encoded, max 262144)
what should I do
do it from console
then just ctrl+f the whole text for "Multiplier"
er
Amplifier
i mean
"bad_omen" isn't in any part of this
it is not in the data but I have the effect ingame
;-;
^
it IS in the data
this is the whole text
[20:58:08] [Server thread/INFO]: YTG667 has the following entity data: {Brain: {memories: {}}, HurtByTimestamp: 3910268, bukkit: {newLevel: 0, newExp: 0, newTotalExp: 0, firstPlayed: 1653510788530L, lastKnownName: "YTG667", keepLevel: 0b, expToDrop: 0, lastPlayed: 1654117088838L}, SleepTimer: 0s, Attributes: [{Base: 20.0d, Name: "minecraft:generic.max_health"}, {Base: 0.10000000149011612d, Name: "minecraft:generic.movement_speed"}, {Base: 0.0d, Name: "minecraft:generic.armor"}, {Base: 1.0d, Modifiers: [{Amount: 768.0d, Operation: 0, UUID: [I; 1686990948, 1784696665, -1967209790, 980277161], Name: "effect.minecraft.strength 255"}], Name: "minecraft:generic.attack_damage"}, {Base: 0.0d, Name: "minecraft:generic.knockback_resistance"}, {Base: 4.0d, Name: "minecraft:generic.attack_speed"}, {Base: 0.0d, Name: "minecraft:generic.armor_toughness"}], Invulnerable: 0b, FallFlying: 0b, PortalCooldown: 0, AbsorptionAmount: 0.0f, abilities: {invulnerable: 1b, mayfly: 1b, instabuild: 1b, walkSpeed:
There is no bad omen here
that can't be the full text, it's not even valid json, look at the end
how can i change the all values on a code
whut
like if there is an id everywhere i want to change it everywhere
looks like multicraft or some panel
maybe it cuts the string because it's too long
Search & Replace?
just typing once
yeah those panels always suck. run it locally
Search & Replace
your hosting panel shows only part of the message. open latest.log and you should see the full message
kk thx
[23:12:06 INFO]: Named entity EntitySkeleton['Slileton'/2830704, uuid='a1f384d9-3571-444a-96f2-c0019db2aabb', l='ServerLevel[svet]', x=-9855.80, y=78.00, z=-2340.97, cpos=[-616, -147], tl=335, v=true] died: Slileton was slain by krashpack
its possible to remove this from console ?
Why wrong channel, i looked for filter console or something, but kay
But if u said, where is this option ?
Why does that show in tje console
Can't you override the toString method
can you play sounds on an async thread
technically useless but yes you can
how is it useless
because assume you send a sound packet on another thread
then its going to get synchronized and queued to a specific pipeline which is still consumed on the server thread
like unless you're injecting yourself into netty, its gonna be pretty useless and the performance is gonna be worse
the only reason I'm asking is because I'm putting it in something else that needs to be ran asynchronously at the same time
because when I use the sendBlockChange method with paper the whole server freezes
๐
I mean
I'm sure it's better than freezing the server with sendBlockChange
do you know why that freezes the server?
didnt know it froze the server
or actually that's the wrong method I'm sorry
it's the method to show a break stage
might wanna deploy an issue at their issue tracker then
๐คก
god, it's insane how much i hate java rn
why
nothing works ffs
how
most likely i'm just too dumb to use jitpack properly, idk
because it always gives me empty artifacts, i suppose it can't find them or smt, idk
everything I found says that this should work but when the amplifier is above 4 it becomes 4 when given
player.addPotionEffect(potion);```
I have no idea what to do
I searched everywhere
i'm pretty sure bad omen V is the max value
always remember to remove any effect that is applied to player before applying yours
I can get bad omen up to 255 with commands
and there are other plugin that give it with higher level than 5
it doesnt do anything tho
I have a remove effect before what I sent
technically 5 is the max
no
it does
the bad omen effect is the amount of raid levels
?paste
that's wrong
that is not
the amount of waves is based on the world difficulty
easy is 3 waves, normal 5, hard 7
no.
The difficulty says what the max bad omen level is.
The bad omen level is the amount of waves in the raid.
tf? no. i always play on normal in my worlds, and always get bad omen 5
in that case hard wouldn't be ANY difference
works
sure it does
you can give yourself sharpness 255 as well
or idk what the max lvl there is
but sharpness is enchantment
in enchantments its like 32K
enchantments are ALL capped at 255. but lose their "effects" at certain levels
https://paste.md-5.net/mapatagezi.cs I'm trying to create a veinminer ability. Here I want to go through each face of a block and check if the block of that face is of the same type. If it is , add the location of the new block to a list and check all the faces on the new block and so on and so forth. However with this code if I mine a tree with only 6 logs, I'm getting 16 locations.
@slate mortar idk about the first line.
the seconds line true tho
no. enchantments can go up to 32K
is there a better way to check each face
after that they have no effect on the tool
In Java Edition, Bad Omen's potency determines the chance for illagers to be equipped with enchanted weapons when the player triggers a raid by entering a certain radius around a bed that a villager has claimed. If the raid results in player victory, the Hero of the Village's potency equals the Bad Omen's potency (capped at level 5). Bad Omen levels past the first also give a single extra raid wave, given the difficulty level. For example with Bad Omen II-V in Easy difficulty has four waves instead of three, Normal difficulty has six waves instead of five, and Hard difficulty has eight waves instead of seven.
enjoy reading
guys please help, I have no idea what to do
just check each face, when valid check if it is not already in the list of checked blocks, then get all faces if that is not the case and rinse and repeat
oh yeah fuck
cause its repeating locations
Bad Omen levels past the first also give a single extra raid wave
probably add a hard cap aswell
one wave
how would i go about the true damage dealt to the player
inclusive of armour + effects
Bad omen ain't a enchantment
ofc it isnt
who said it is?
getFinalDamage i guess?
weren't you guys talking about enchantments? I am confused now
everything currently is confusing tbh
true dat
idk why he started talking about it. I was asking for help about potions
what's your problem
thats the problem
I can get PotionEffect variable with amplifier of any number but when I give this to a player the amplifier becomes 4
It happens when the amplifier is above 4
could you show me where you define the "effect" variable
PotionEffect potion = new PotionEffect(PotionEffectType.BAD_OMEN, 120000, effect.getAmplifier() + 1);
player.addPotionEffect(potion);```
I outprinted potion and it can get to a higher amplifier than 4
but when given it cant
no
lemme quickly start my pc
the potion variable has amplifier of 8 (for example)
I give the effect to a player and the player gets it with amplifier of 4
if the amplifier i try to give is above 4 this happens
but in the next iteration, does it get server sided set back to 4 aswell?
It gives the effect but the amplifier is 4 and I had 4 before this so it only changes the duration of the effect back to 100 minutes
could you send more of your code
kinda hard to debug without any context
public void Limit(EntityDamageByEntityEvent event){
if (event.getEntityType() == EntityType.PILLAGER && event.getDamager() instanceof Player){
Pillager p = (Pillager) event.getEntity();
if (p.getHealth() - event.getDamage() <= 0){
if (hasBanner(p)){
Player player = (Player) event.getDamager();
PotionEffect effect = player.getPotionEffect(PotionEffectType.BAD_OMEN);
if (effect != null && effect.getAmplifier() >= 4 && effect.getAmplifier() < 9){
player.removePotionEffect(PotionEffectType.BAD_OMEN);
PotionEffect potion = new PotionEffect(PotionEffectType.BAD_OMEN, 120000, effect.getAmplifier() + 1);
Bukkit.getLogger().log(Level.INFO, String.valueOf(effect));
Bukkit.getLogger().log(Level.INFO, String.valueOf(potion));
}
}
}
}
}```
maybe try adding the potion effect without removing it?
and are you sure you are not just misreading the roman numerals?
IV = 4
V = 5
VI = 6
that was what I tried in the first time
I have V which is 5. it starts with 0 so 5 in the code is 4.
I have 4 so I should get 5 which is VI but I get V.
yea and 5 is V
so I have V. I should get VI and I get V
I thought screensharing is disabled here
it is
When you finish you gonna to publish the plugin?
idk how to make a config so I don't think it would be a great plugin
it's for a friend
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
I almost threw up
@harsh totem u still haven't gotten that to work?
It works now
thanks for asking
Mjanko helped me
What was the problem?
just found this out today and i love it so damn much but in intellij IDEA you can use //region <description> and //endregion to create custom folds like in C#
Wat
WorldServer worldServer = ((CraftWorld)p.getWorld()).getHandle();
at compiling error: cannot access org.bukkit.RegionAccessor at (CraftWorld)
use java17 or later to compile
File -> Project Structure -> Project -> SDK
what do you have set there?