#help-development
1 messages ยท Page 404 of 1
do you use clean package or just package
if i dont care about performance which is better?
whichever works best for you
depends on if you like verbositiy
its personal preference, you have been told multiple times already
anyway... how do i force update minecraft development plugin? (because its not latest)
manuall install
can i just unistall and install
how
nvm googled it
how do i fix this?
whats wrong
you want to code in scala?
are you talking to me
yes
what is scala
a programming language
he just happens to have that selected haha
oh lol
double angle = 0;
double centerX = center.getX();
double centerZ = center.getZ();
Location currentLoc = stand.getBukkitEntity().getLocation();
double x = centerX + radius * Math.sin(angle);
double z = centerZ + radius * Math.cos(angle);
double y = currentLoc.getY();
Location newLoc = new Location(currentLoc.getWorld(), x, y, z, currentLoc.getYaw(), currentLoc.getPitch());
stand.setLocation(newLoc.getX(), newLoc.getY(), newLoc.getZ(), newLoc.getYaw(), newLoc.getPitch());
PacketPlayOutEntityTeleport packet = new PacketPlayOutEntityTeleport(stand);
sendPacket(packet);
Would this work? cant test atm
bruh
you are not changing the angle
- the angle is in radians, not degrees
Forgot to copy it
getCommand("test").setExecutor((sender, cmd, label, args) -> {
if (!(sender instanceof Player)) {
return false;
}
if (task == null) {
Player player = (Player) sender;
ArmorStand armorStand = player.getWorld().spawn(player.getLocation().add(5, 0, 0), ArmorStand.class);
Location center = player.getLocation();
armorStand.setGravity(false);
center.setY(armorStand.getLocation().getY());
Location movingLocation = armorStand.getLocation();
task = new BukkitRunnable() {
float angleDegrees = 0f;
/*
* Math.sin and Math.cos is based on radians, not degrees, if you want to use them,
* you should multiply the angle based on degrees by (PI / 180)
* in order to get the angle in radians
*/
@Override
public void run() {
double angleRadians = angleDegrees * Math.PI / 180;
double radius = armorStand.getLocation().distance(center);
movingLocation.setX(center.getX() + (Math.cos(angleRadians) * radius));
movingLocation.setZ(center.getZ() + (Math.sin(angleRadians) * radius));
armorStand.teleport(movingLocation);
angleDegrees++;
}
}.runTaskTimer(PracticePvP.getInstance(), 0, 1);
} else {
task.cancel();
}
return true;
});
yo can someone help me?
im not really good at code im just learning javascript html and css rn
OOOH
it makes rainbow dots,
Thanks
you also need to change the y level
i want to make a loop to where it keeps on making dots when i hold down the mouse button
but idk where to put the loop
heres the code rn
var canvasEl = document.querySelector("canvas")
var context = canvasEl.getContext("2d")
canvasEl.width = innerWidth
canvasEl.height = innerHeight
addEventListener("click" , (event) =>
{
let x= event.clientX
let y= event.clientY
console.log(x,y)
circles.push([x, y])
}
)
var circles = []
var ticks = 0
function animate()
{
ticks++
context.fillStyle = "black"
context.fillRect(0, 0, innerWidth, innerHeight)
animationId = requestAnimationFrame(animate)
circles.forEach(circle => {
let x = circle[0]
let y = circle[1]
context.fillStyle = "hsl(${ticks}, 50%, 50%)"
context.beginPath()
context.arc(x, y, 10, 0, Math.PI * 2)
context.closePath()
context.fill()
})
}
animate()
since you are rotating around the y level (i mean, set the y level to the center location's y), i already did in the code
use ```java, we can't read your code
where?
its js
yeah its javascript
ok, i didn't read the code
there's no spawnProjectile equivalent right
just some small steps of learning code
equivalent for what?
Player#launchProjectile
not a player
or world#spawn
that's what I thought, thanks
you specify what you are spawning
also is there a method in the api to order something from uber eats, I'm famished
Yeah yeah ofcourse
please someone help
@analog thicket
This is Spigot plugin development help. At least use code blocks
Oh thanks
pro tip you don't need code blocks if all of your code is in one line
true
yes
oh ok
?paste for code, or use discord codeblocks
getLocationTargets(scriptActionData).forEach(targetLocation -> CustomSummonPower.summonReinforcement(scriptActionData.getEliteEntity(), targetLocation, blueprint.getSValue(), blueprint.getDuration()));
there's programmers and then there's PROgrammers
if it ain't in one line it ain't fine
var canvasEl = document.querySelector("canvas")
var context = canvasEl.getContext("2d")
canvasEl.width = innerWidth
canvasEl.height = innerHeight
addEventListener("click" , (event) =>
{
let x= event.clientX
let y= event.clientY
console.log(x,y)
circles.push([x, y])
}
)
var circles = []
var ticks = 0
function animate()
{
ticks++
context.fillStyle = "black"
context.fillRect(0, 0, innerWidth, innerHeight)
animationId = requestAnimationFrame(animate)
circles.forEach(circle => {
let x = circle[0]
let y = circle[1]
context.fillStyle = "hsl(${ticks}, 50%, 50%)"
context.beginPath()
context.arc(x, y, 10, 0, Math.PI * 2)
context.closePath()
context.fill()
})
}
animate()
u mean this?
or nah
oh
hm
so world#spawn() requires the class of the entity
but I am getting this from config
oh there's a getentityclass for the entitytype, thank god
Hey, need some help with abstraction
public abstract class MyClass1
public abstract class MyClass2 extends MyClass1
public class MyClass3 extends MyClass1
public class MyClass4 extends MyClass2
what am I looking at
Wait
looks like a binary tree
Hi i dont know way it does not work can someone help? https://paste.md-5.net/mafopaloqe.cs
the hole?
just do a composition with one main class instead
composition > inheritance
what is that?
Uhhhh
I haven't explained what I'm trying to do but you might be on to something, What is that
it allows you to decouple implementation of specific part of the code
into separate units
of implemented classes
which you can swap any time
public abstract class GUI
public abstract class GUISpecific extends GUI
public class GUITest1 extends GUI
public class GUITest2 extends GUISpecific
What I'm trying to do is as follows:
My class GUI has a method that I overwrite in methods that extend it. But I want to have even more specific "GUI" by forcing a basic layout on only some objects, hence class GUISpecific
My idea is that:
When I create GUITest2 a specific method which I overwrite in both abs classes
-> GUI gets called
-> GUI specific gets called
-> GUITest2 gets called
in very basic terms this is better
class Car {
Engine engine;
public (Engine engine) {
this.engine = engine;
}
public Engine getEngine() {}
}
rather than
class VolkswagenEngineCar extends Car {
}
But that's not what I want
just override methods and call super methods
If i want to continue an animation doing another task? i can just add another runnable right?
is there a way to check if an EntityType is a projectile?
cant every type be a projectile? xD
I have a method called openGUI which takes parameters GUI not GUISpecific and even though GUISpecific extends GUI it won't allow me to ass that as a object
How can I make the openGUI method work for both types?
projectile is a specific class so no
what
I thought it would work cause of inheritance but it's not
you need to provide an actual example cuz we cant follow this
I shall show
he did
according to him he passed base GUI object
as a a param
but it errors out
Class GUIManager
public void openGUI(InventoryGUI gui) {}
Class InventoryGUI
public abstract class InventoryGUI {}
Class InventoryGUISpecific
public abstract class InventoryUpgradeGUI extends InventoryGUI
class SlotUpgradeInventory
public class SlotUpgradeInventory extends InventoryUpgradeGUI
Then doing
guiManager.openGUI(new SlotUpgradeInventory());
Is casting safe?
I didn't want to cause it seems like there is a better way
So how can I make the it take both types?
The required type is an InventoryGUI but you're providing a SlotUpgradeInventory. Isn't that... logical? It seems the hierarchy should line up
But SlotupgradeInventory extends InventoryGUISpecific which extends InventoryGUI
In the middle I'm overriding methods
Then why is it not liking it
yeah it looks like it should work
It's why you can pass in an ArrayList to a method that accepts a Collection
That's the whole concept of polymorphism
are there erros in SlotUpgradeInventory?
have you tried invalidating cache in ide?
this seems wrong
or im too tired
i've went to sleep in 7 am today lmao ๐
Maybe you imported wrong class?
I checked
Cache wasn't the thing
Not getting any errors, overwriting works perfect
Just can't use that method with that class
can you show more of the code?
It's long but I can
like maybe there is some part we missed
Which is why I cut it
you cut it to 1 line
it's 5 files lol
surely 2 lines of code isnt too much
this should literally work according to the provided info
I am talking about where you pass the instance
doesnt matter if its abstract or an interface
how does the livingentity#launchprojectile work?
yeah inheritance shouldnt have to care about how many classes to put in between the parent and child class
Why is that purple underlined?
its an outer variable
you're probably using it inside lambda
for it likes to color those bright pink
at least in intellij when i use outer variables that underline pops out
It's weird
You know CraftBukkit's open source, right? lol
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java#409-497
I didn't include any methods in inventoryGUI but it just has some basic abs methods and interface stuff
Wait I thought that's how inheritance worked
Wheel -> car -> vehicle
But then how can I do what I want? I want to have a "middleman" override for a method from the parent class because I'm gonna be creating like 5 subclasses which all need to follow the same guidelines which I want to specific in the "middleman class"
I'm trying to add deobf 1.19.3 to my local maven, and buildtools is trying to download this: https://libraries.minecraft.net/org/spigotmc/minecraft-server/1.19.3-R0.1-SNAPSHOT/minecraft-server-1.19.3-R0.1-SNAPSHOT-maps-spigot-members.csrg but that url is erroring
I have either an entity type or an entity, I'm not 100% sure on how I go from there to ? extends T projectile
Snowball seems like an already existing Entity right
right so I have to spawn an entity ahead of time?
what you have is a ShinyCarWithPully that extends ShinyCar that extends Car, it should stand to reason that methods asking for a car can still take a ShinyCarWithPully as an argument
Yes you can either cast it as a Snowball or just use the Projectile methods
If this is correct then it should work or I just don't understand english either
yes I dont know why it is not working
I'm not connecting the dots to get to something that is happy with extending projectile
What you can do is entityType.getEntityClass().asSubclass(Projectile.class); which should yield you a Class<? extends Projectile>
if (scriptActionData.getEliteEntity().getLivingEntity() != null &&
(entityType == EntityType.ARROW ||
entityType == EntityType.SPECTRAL_ARROW ||
entityType == EntityType.SNOWBALL ||
entityType == EntityType.DRAGON_FIREBALL ||
entityType == EntityType.EGG ||
entityType == EntityType.ENDER_PEARL ||
entityType == EntityType.FIREBALL ||
entityType == EntityType.SMALL_FIREBALL ||
entityType == EntityType.FIREWORK ||
entityType == EntityType.FISHING_HOOK ||
entityType == EntityType.SPLASH_POTION ||
entityType == EntityType.LLAMA_SPIT ||
entityType == EntityType.SHULKER_BULLET ||
entityType == EntityType.THROWN_EXP_BOTTLE ||
entityType == EntityType.WITHER_SKULL))
scriptActionData.getEliteEntity().getLivingEntity().launchProjectile(entity.getClass().asSubclass(Projectile.class), velocity);
}
that's hot, that's hot
Cause otherwise, it works
I mean I can..?
unless im misunderstanding
oh wait
maybe its cuz I used an interface
no nvm
I'm so lost
I mean you could probably clean that up a little too, magma
yeah you are wrong ๐
but that still leaves us with the question of why does it not work for tom
I blame the fact there is no projectile data on the entitytype class
I can provide all the code you need but it makes no sense
if (Projectile.class.isAssignableFrom(entityType.getEntityClass())) {
Projectile projectile = entity.getEntityClass().asSubclass(Projectile.class);
}```
oh
I sent the code
yeah that's convenient
Actually the other way around I think
I didn't forget anything
I always forget the order
I explained
and you're sure you import the correct classes for everything?
But then how can I do what I want? I want to have a "middleman" override for a method from the parent class because I'm gonna be creating like 5 subclasses which all need to follow the same guidelines which I want to specific in the "middleman class"
I will check again
Yes, I followed the path on IJ and checked manually
That's not the part that's not working anyways, it was also done using smile7 implementation guide
The problem is purely inheritance
https://libraries.minecraft.net/
Is anyone else getting an error when getting mappings from here?
have you tried just building the project?
getLocationTargets(scriptActionData).forEach(targetLocation -> {
if (scriptActionData.getTargetType().equals(TargetType.SELF)) {
Vector velocity = new Vector(0,0,0);
if (blueprint.getScriptRelativeVectorBlueprint() != null)
velocity = new ScriptRelativeVector(blueprint.getScriptRelativeVectorBlueprint(), eliteScript).getVector(scriptActionData);
if (scriptActionData.getEliteEntity().getLivingEntity() != null && Projectile.class.isAssignableFrom(entityType.getEntityClass()))
scriptActionData.getEliteEntity().getLivingEntity().launchProjectile(entityType.getClass().asSubclass(Projectile.class), velocity);
else {
Entity entity = targetLocation.getWorld().spawn(targetLocation, entityType.getEntityClass());
entity.setVelocity(velocity);
}
}
});
alright let's see if this even remotely works
incompatible types: me.tomisanhues2.ultrastorage.gui.impl.upgrade.SlotUpgradeInventory cannot be converted to me.tomisanhues2.ultrastorage.gui.InventoryGUI
:( you need to make more variables
you don't want to know how much code this runs on the backend
I'm about to turn my pc off for 3 hours see if it fixes itself
so what
getLocationTargets is a very large logic chain
Cause literally the code that I pasted from zack works lol
Yes
I can share the entire project
I did
I followed the path in IJ
why do you have a different package for impl, is that usually how people work?
Cause abstraction and implementations
There's too many GUI's
So far it's worked beautiful
If you are making api, it should be kinda separated
This weird inheritance is the only thing that popped up
getLocationTargets(scriptActionData).forEach(targetLocation -> {
if (scriptActionData.getTargetType().equals(TargetType.SELF)) {
Vector velocity = new Vector(0,0,0);
var vectorBlueprint = blueprint.getScriptRelativeVectorBlueprint(); // Don't know the type, using var
if (vectorBlueprint != null) {
velocity = new ScriptRelativeVector(vectorBlueprint, eliteScript).getVector(scriptActionData);
}
LivingEntity entity = scriptActionData.getEliteEntity().getLivingEntity();
Class<? extends Entity> entityClass = entityType.getEntityClass();
if (entity != null && entityClass)
entity.launchProjectile(entityClass.asSubclass(Projectile.class), velocity);
else {
Entity entity = targetLocation.getWorld().spawn(targetLocation, entityClass);
entity.setVelocity(velocity);
}
}
});```
I see
ISN'T THAT SO MUCH NICER TO READ!?
@solar mauve Hope you still here. So this i what code i have so far. https://paste.md-5.net/igimijixox.cpp
This code makes the circle bigger and bigger for some reason. Video linked to this. Or any other people that wants to help.
double radius = stand.getBukkitEntity().getLocation().distance(center);
You're re-calculating this every tick
Oh thanks, always the stupid mistakes..
it's barely any different lol
it's less duplicated, yes
Yours overflows, mine doesn't 
tbf I didn't even know what asasubclass was while writing this
Class is pretty versatile
actually thinking back I might've used it a couple of times about 4 years ago
ValueOf coming...
Just give it a .getName(), tomisanhues
getSuperclass().getName(), that is
Logger#info() only accepts a String
We keep your names equal to your Spigot name
But i'm not tomis ๐ฆ
you are now

Until I unverify
Your spigot account is ๐ฟ
Dude
What is going on
Bukkit.getLogger().info(new SlotUpgradeInventory(ultraChest).getClass().getSuperclass().getName());
that looks correct
Next question is there a way to make it faster?
Without smashing the animation smoothness.
the parent class of the slotupdgrade is the inventoryupgrade is it not?
yes
so what it printed seems correct
I assume getSuperclass() only goes up one level
public void openGUI(InventoryGUI gui, Player player) {
this.registerHandledInventory(gui.getInventory(), gui);
player.openInventory(gui.getInventory());
}
that's the method that is the one that doesn't let me use InventoryUpgradeTest as a parameter
try making another class that extends inventoryupgradeui
did you read the error and see what intellij is telling you to do?
Not what we're looking for
Completely different
intellij isnโt gonna let you call a broken class
....
StorageUpgradeInventory extends StorageInventory which extends InventoryGUI
did you fix this
Yes of course, I was showing that inheritance was working correctly
And it detected the correct parent class
@pseudo hazel You gave up ๐ฆ
Throwing pc out the window
yeah
short of me having the project there isnt much I can do unfortunately
is it on github?
Ummm give me a bit
I bet it's something dumb and when a heavy hitter comes by they'll just solve it in 1 line...
Where the boys when you need them
pure curiosity why are you shoving an interface into an empty abstract class
It's not emptry
It was to reduce the code
Cause it's big
But regardless, inheritance should work in that case
Who can make plugin free?
Barrels will have 50 health, there will be three types of barrels, and things will fall off them if their player breaks with weapons. Make a config so that I can add weapons and damage to the barrel (1.16.5
xd
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
hey Olivo
Would you be kind enough to look at something I've been having issues with for a bit and no one has been able to figure out
@worldly ingot it's called a chicken gun we get bosses to shoot chicken at players around here
https://cdn.discordapp.com/attachments/1008771253747855401/1082748163166834808/image.png
it blasts off at light speed too
I should get it to blow up
Im so confused why this doesnt go around the enderchest. Code: https://paste.md-5.net/buzipucebe.java
Mostly the last Runnable
seems to be off by 1 block both up and to teh left
Yep, no idea why..
just subtract 1 from the center location
Hmm how would i get the EyeLocation? i think thats the problem
stand.getEyeLocation does not work.
hi guys, please help. I need to remove scope bars.
what even are scope bars
just use regex
what square brackets lol
[] ig
that chat?
if you want to remove [] from message, just do String#replaceAll("\[|\]", "");
thanks
on projectile hit event, check if the projectile is an arrow, modify the player velocity
otherwise decompile minecraft with mod coder pack, and just copy the code to calculate the arrow knockback
there is nothing in the code to calculate the velocity that mentions the arrow
How will it know what direction to throw the player if it doesnt know where the arrow hit you
just side note, pls run ctrl + alt + L if using intellij
you cancelled the event, so the player velocity will be zero
actually, i think no matter what in this function, the player velocity will be shown as zero unless you tell the event to run after the event fires
i gtg
hey, need some help,
trying to get the "currentItem" from a InventoryClickEvent and currentItem is null even tho its not
code:
@EventHandler
public void e(InventoryClickEvent e) {
String name = null;
try{ // get current item return null, error in get item meta, fix lol
ItemStack c = e.getCurrentItem();
System.out.println(c == null); // somehow got two prints one is false and the sec is true
boolean n = c.getItemMeta().hasDisplayName();
if (n){
if(c.getItemMeta().getDisplayName() != null){
name = c.getItemMeta().getDisplayName();
} else {
name = "";
}
}
} catch (Exception err){
err.printStackTrace();
return;
}
}
error:
paste bin: https://paste.md-5.net/hiyiwopepe.md
any one know where's the problem?
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getItemMeta()" because "c" is null
its logical
wait
i would wonder
use normal naming, not single letters
method e
event e
boolean n
lol
Are you trying to make a GUI or get the item clicked in the players inventory?
@shy wolf
GUI
?jd-s
InventoryClickEvent is not for gui
PlayerInteractEvent is
Yes
It's working as intended then
It's because you can't just change the event and hope it works
this is with InventoryClickEvent
Isn't that the other way around? :D
There's is a small chance I did mix them around
PlayerInteractEvent is for in game not gui
InventoryClickEvent is for inventories as in the name
lol
... y2k.. you know names mean nothing in spigot dev
It rarely actually does what the name says
Interaction means interacting by swinging with arms or interacting at objects in the world.
Are you insane
Most of the time the names are very good
lol
any way any one know whats the problem?
?paste the error
.
Yeah, you're trying to resolve a property of a null value
events get called before it actually happens
but in game im clicking stain gray glass
when that event gets fired your "current item" is null
because it's before you actually pick it up
They don't have item meta
Show your full event handler then, you have to have something messed up
It'll create item meta if there was none, IIRC
Oh? Hm
How would you ever get the base meta otherwise
Ok
It's like a factory
The handler has to be messed up
@EventHandler
public void e(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
UUID UUID = player.getUniqueId();
String name = null;
try{ // get current item return null, error in get item meta, fix lol
ItemStack CurrentItem = event.getCurrentItem();
System.out.println(CurrentItem == null);
boolean n = CurrentItem.getItemMeta().hasDisplayName();
if (n){
if(CurrentItem.getItemMeta().getDisplayName() != null){
name = CurrentItem.getItemMeta().getDisplayName();
} else {
name = "";
}
}
} catch (Exception err){
err.printStackTrace();
return;
}
}
``` *new*
this is the sort version of the handeler
bc the other part doesn't even fire
First print is likely PICKUP, while second is PLACE. Place means place down cursor, so the current item is null. You're never cancelling the event, so of course the GUI will let you pick it up.
i was about to add the cancelling part
well
um
1 thats helpful
2 is there a way to some how get the item?
Sure thing, take your time. It's not that easy to get into inventories, as there are a few case decisions you just have to know of.
You got the item the first time. If you cancel the event, you can always get it like that. Otherwise, you have to get the cursor instead of the current item
And don't forget your InventoryDragEvent, so players won't put any items into vacant slots, ๐
That's a classic.
Those are basically the two important events
The drag event will get fired even if you only drag across one slot, so it can be quite confusing
InventoryCloseEvent can also be helpful, if you need to cleanup/release any resources.
As you can see, SlotUpgradeInventory extends InventoryUpgradeGUI which extends InventoryGUI
But for some reason, a method that requires a InventoryGUI as a parameter won't accept it
Bytes can you give that a look please, We couldn't figure it out with 3 people
Gimme a minute, I need to get out of the yaml hacking mindspace and into inheritance, xD
Of course, thanks
Obviously you can assume that the openGUI method takes a InventoryGUI as a parameter
Can you show me the signature of plugin.guiManager.openGUI?
public void openGUI(InventoryGUI gui, Player player) {}
What does IntelliJ say to you on that error? Any messages, maybe if you hover over it?
Type
incompatible types: me.tomisanhues2.ultrastorage.gui.impl.upgrade.SlotUpgradeInventory cannot be converted to me.tomisanhues2.ultrastorage.gui.InventoryGUI
Yeah, but it's gotta be more descriptive than that
But, I printed the superclass of SlotUpgradeInventory and it's InventoryUpgradeGUI
And I printer the super().super() and it's InventoryGUI
Do you have two files called InventoryGUI, by any chance?
Negative, all imports have 100% been checked
And all paths to objects have been checked with IJ too
So the FQN of the parameter as well as the base classes match? Like, I'm not trying to question anything you've checked yourself, but that very much looks like an issue with same name but different package classes. Maybe IJ has another stuck bug in it's typechecker, have you restarted it? Otherwise, it's gonna be immensely hard without the import sections of classes in question.
Oh no of course, I will triple check anything I just want to solve this
I will provide the imports rq
?paste
Please also add the first line of the class definition, so I know what's what
Yes
SlotUpgradeInventory, InventoryUpgradeGUI, InventoryGUI as well as the manager
That should suffice
Wait I just found something weird
The InventoryGUI class according to IJ has 3 inheritors
Ignore
IJ just trash at updating
Was it a typechecker bug? haha
all ears
You were indeed correct, how, no idea
You need to believe into me more, haha
Awesome, so that's fixed
Always check the FQN (fully qualified name, name + containing package), instead of just the name token. That's not enough, as you can see. That can throw you for quite the loop, xD
โค๏ธ thanks for your time
Aw, happy to help! :)). I know how relieving it can feel to finally clear up a roadblock like that, haha
Has anybody ever worked with SnakeYaml on it's own and noticed that it doesn't save anchor names, but rather uses some sort of counting strategy to auto-name them? Is this the same on spigot's builtin config? I'm having such a hard time finding anything about it online...
fair fair hehehe
bump
Didn't he tell you just to lower the height by 1 block?
Cause it's just 1 block higher than it should
You probably didn't lower it in the correct places, because there's no other way to change that
Play with half blocks
Remember a location is a double value
And the center of a block is actually 0.5 0.5
Not 0 0
Yeah i know.
Im guessing its something to do with the eyelocation
But well 1.8 eye location isn't that easy to get using packets.
What do you mean by "going around"? You're moving it on a circle along the x/y plane. The video also stops prematurely, as I don't see the "Animation done" message. Looks like a circular path to me.
Yeah it has to move around the chest using x/y. Oh yeah wait i think i have a full vid.
I'm just not yet sure on what you meant by around the chest. There are many versions of that which come to my mind, xD.
don;t you mean x/z? unless it's moving above and below
Yeah thats true
But ill take a new vid in a sec
Well, it's always a y-based plane, as it moves in a circle like flat on the imaginary wall the player's looking at. You'd still have to decide on x or z based on the facing direction of the chest. That maybe throws something off. Or maybe the animation has been planned out completely different, that's the thing...
Exactly above and below chest y/x
So y/x or y/z, based on it's facing direction. Otherwise, it'll not always face the player
Btw, have you disabled collisions on the stand?
Yeah, just trying to make the animation work at first.
Dont think so
setCollidable(false)
otherwise, it might also look unexpected
The armor stand most definitely intersects the chest
explain exactly what you are tryign to do? move an armor stand in a circle, vertically about a chest?
Move it in a circle around the just above then below then above agian
If that makes sense.
Would be nice if it could help me.
Idk if you seen the video?
just edit it to your liking. it has 2 radius so you can control width and height of the circle.
?paste
here
That part just makes sense to me so far, so I don't see the issue. Again, try disabling collisions and show a full video, if you need any further help.
Also called an ellipse, xD
that code spawns a ring of flame particles around an origin
vertically
currently it takes a player and spawns it around them
the every variable is how many points it will plot
where the yamlers at, :(
anchors?
Hmm i need to update it accordingly so the animation is smooth tho
Or i could get alot of points.
then increase or decrease the step size
more points = smoother
ah never used them
Oh boi, that's gonna get wild... generics never stay simple, haha
slot-upgrade-tiers:
1:
price: 1000
slots: 1
2:
price: 10000
slots: 2
3:
price: 100000
slots: 3
storage-upgrade-tiers:
1:
price: 1000
storage: 1000
2:
price: 10000
storage: 10000
3:
price: 100000
storage: 100000
I want to be able to store these in my plugin as a upgrade tier list from a config. I feel like generics is perfect here because I can make a class that can accept different types of upgrades since they will all be in the same format
Now, about generics I know enough to understand but not enough to do what I just said
So any assistance is welcome
Yeah will do in a bit ๐
It is, actually, xD
other than that it all looks fine. Not sure what you are having a problem with
I mean, the spec's a mess, but 1 should work as a key, I mean why not
try it, it will nto work
spec's a mess,
Hi guys! I'm new to nms, I was trying to change the biome around the player with a custom biome when is moving and I put together the following code: https://paste.md-5.net/yotalawisa.cs
The problem is that I get this error: java.lang.IllegalStateException: This registry can't create intrusive holders
at net.minecraft.core.MappedRegistry.createIntrusiveHolder(MappedRegistry.java:369) ~[?:?]
at com.zainjx.fogtest.event.PlayerEvents.onPlayerMove(PlayerEvents.java:106) ~[fogtest-1.0-SNAPSHOT.jar:?]
how can I solve?
What this
it will complain about a non string key
Ok ok I changed it
no problem
But now the storage part
How do I implement a tier system that is adaptable to any amount of upgrades and different types
its just a map so treat it as one
Is it that simple?
I wanted to do it a bit more fancy so I could learn new stuff
getConfig(path).getValues() will return you a map
Oh wow, you're right, learned something new! :). I thought yaml would just turn it into a string, didn't know it had the same "rules" for keys as values, so that it'd tag the node as a number if it's just numeric. Great info.
Yeah I got that part I know how to get the stuff from the config but I thought there was more fancy ways of doing this
I guess not
I really wanted to learn generics lol just got no use for it yet I thought this was my moment
๐
There are many fancy ways, but keeping it simple will probably make it work the quickest. You could also map these to objects and then pass them into your UI to render accordingly
I am planning on doing that indeed
So I guess making 5 classes for 5 upgrade categories is the only way
price,storage would be an entry you can get by tier ID
So like Map<Integer, Tuple<Integer, Integer>>, or even better replace the Tuple with a descriptively named class
Oh god ok that got real quick
use a record as you are going static values
Right, do that if you're on those fancy pants versions, haha
Damn isn't a thing in 1.8.9 unless its something else for EntityArmorStand. But heres the whole video.
Never used a record, so much new stuff
records are nice for fixed data
Center is off, radius is too small, collisions are on
looks a little jerky
I know, but theres gonna be alot..
And i wanna optimize it the best i can ๐
i hate them tbh, it breaks the consistency of classes tbh
unless I use them for constants
i hate it
is it a bad idea to use custom events to let my ui manager open menus?
bytes I need a bit more explanation on your Map<<>> idea thing
instead of using teh manager as a variable everywhere
public class UltraUpgrades {
double price;
double value;
public UltraUpgrades(double price, double value) {
this.price = price;
this.value = value;
}
}
that's what a noob would do
maybe a DataWatcher
based of this tutorial btw https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
Oh i forgot to set Gravity to false too. that changed the animation.
Don't go all out on NMS, you'll completely box yourself in
Well the radius got fixed, but its still off :/ ill send a new vid.
before it gets lost bytes
That's exactly what I meant, that's fine. This is tier. So key 1 would map to that, key 2 to the next instance, etc.
So you iterate the keys of storage-upgrade-tiers, parse the integer, and if it's parsable, get that key + "." + "price"/"storage" to populate your object. Later on, you can store it into a Map<Integer, UltraUpgrades>, where you can get the upgrades by tier. I'd call it upgradesByTier. To map tiers to slot/storage/etc, you'd have to put it into another map. Something like Map<UpgradeType, Map<Integer, UltraUpgrades>>. Would also be nice to make another class for types, so the map notation doesn't get too nested.
Isn't that a massive amount of objects?
Well, you're gonna have to define your data in some way. You can also just go crazy on generics, like Map<String, Map<Integer, Tuple<Integer, Integer>>>. It'll work fine, but the question is if you don't want to make use of the language's static typing system to make your life a bit easier.
hi? ๐
ok ok gotcha, Thanks for the insanely detailed explanation
Ok. Guys, I need help. But first let me ask, Please do not actually fix this for me. i am learning as I go. Just tell me what I am doing wrong and point me in the right direction. Now for what I am doing. In this class a player uses the command to add a location to a coords.yml file. The file first checks to see if there is a location with that name. If not then it cycles through each stored location and checks if each locations stored is the world the player is in, if it is then it checks to see if the coords are within x blocks as defined within the config of the players location. If none are within x blocks then it will add the location. If one is then they get a message saysing they are too close to another location to add one. But this ALWAYS adds it. the location name check works great but the coords compare does not.
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.
It hasn't been there at 1.8, I just checked... that sucks. But now that I think of it, as the entity is entirely packet based, I don't think that you need to disable either gravity or collisions, as the server simulates those, not the client. Would gravity have been on, then your stand would have fallen way faster than the few pixels we imagined to see there, xD. It's fine. I don't know what that jump there is tho.
Ill I go through my code and check all locations. I'm guessing that the issue, can't see anything else than that.
At this point it's the only thing I can think of
Is it normal to drown in many spigot events and exceptions on them when you make a plugin with claims and teams?
for a beginner possibly
I can pretty much assure you that there are no collisions and no gravity, as you didn't register the entity on the server, so it's not being ticked
I suppose ๐
I've gotten 500 lines of pure events and exemptions at this point, but am almost finished
It must be my locations then. Should i also look into if i use the Eyelocation instead?
if i should use*
If you want to improve on it later on, you still can. It's important to get it done to the best of your abilities in order to learn as much as possible about the problem domain. If you know your requirements, edge-cases, design decisions etc, you can still refactor it.
eye location is where the head is
What eye location tho? The block has no eyes, lol. You need to go centered on the block
I mean of the ArmorStand.
Oh, no, you should just look up it's height online and compensate it's y value
As long as that compensation's constant, it should cause no jumps
Something like Map<UpgradeType, Map<Integer, UltraUpgrades>>. Would also be nice to make another class for types, so the map notation doesn't get too nested.
Bytes, lastly so I can stop asking about this topic. What does this mean,
What is UpgradeType? Is it an enum? What do you mean with another class for types to replace map?
Ah good to know. I just am struggling with things like instant damage splashpotions not counting as entity damage and armorstands not being entities due to not being living entities etc. They are a pain โ ๏ธ
Alright thanks, ill try some stuff out. Thx
That's exactly what you need to figure out in the prototype. It's the same with inventory UIs. If you try to build anything of any significance, you gotta get familiar with the topic first, until you can design a proper solution. I always build a pice of shit first and then rewrite. May sound extreme, but that's reality, as all developers who actually create new and good-ish stuff will tell you.
Aight I'll finish it first then and rework after ๐ซก ty
Armor stands are living entities
Just don't believe in the illusion of making every decision right the first time, it's nothing more than that. You're working on it, so you're making progress :)
Let's put it this way: does anyone know how to register a new biome? because I kind of found a way but it doesn't really work because I was browsing forums out of date and tried to update the code to 1.19. If you wanna see what I've done, I linked the code ๐
declaration: package: org.bukkit.entity, interface: ArmorStand
They are
Oh I meant that Playerinteractentityevent does not apply to armorstands*
Which might also not be true but I bumped that wall
wtf ๐
bump bytes
So used armorstandmanipulateEvent instead
Anyone here familiar with snakeYAML?
?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Yeah, it should likely be an enum. Your example had slot upgrade and storage upgrade, so have SLOT_UPGRADE and STORAGE_UPGRADE. Then have a string property on the enum class so each can give you the yaml representation (slot-upgrade-tiers and storage-upgrade-tiers). You then check for the presence of all known keys on your section and if you find them, you parse their value into the tier map.
Not sure how to use the .dump without it clearing my whole YML file. So frustrating!
That's kinda something you just have to play around with a bit to fully understand
I am, actually, xD. Are you using snakeyaml on your own, apart from the bukkit wrappers?
On its own
Oh yes yes but what did you mean with Make another class for types, was UpgradeType what you meant?
I wish I was using Bukkit would be so much easier but Iโm not making a plug-in
Ok Guys I need help But first let me ask
I don't know your exact problem, but maybe this helps you in some way. I've implemented my own config on top of SnakeYaml's node API
To be honest, I don't even know anymore myself, xD. I probably meant wrapping a Map<K, V> into a class, just for readability. You can also just have the map there, as long as you don't need to attach any other features to it.
Gotcha, thanks a lot bytes
Thank you. The problem literally is that I input data using the .dump. Then when I go to input new data with .dump it clears the whole yml deleting the old data and keeping only the new data but I donโt want the old data deleting
I'd just use configurate
Hmm not familiar with configurate
Just to be sure now:
Is it possible that PlayerInteractEntityEvent does not get triggered when a player removes a helmet from an armorstand, but subclass (of PlayerInteractEntityEvent) -> PlayerArmorStandManipulateEvent does trigger?
You input by using dump? Sounds odd, xD. If you don't want to override the config, you need to load it before saving it. If you want to extend keys, there's also a way for that in my class file.
Thatโs what the tutorials said to do lolโฆ I am probably doing it wrong but the documentation isnโt great.
I have ran yaml.load before I do yaml.dump but my problem still persists
How else can you input without .dump?
Okay, so @dry yacht I found the error, haven't fixed it tho, but for some weird reason, it adds 1 to x...
And i can't figure out where this would happend.
You should really have a look at the file I've sent if you want to look at how to work with bare yaml. new Yaml(...).compose(...)
Right ok!
Sounds odd... you could provide the latest code again, I totally forgot and don't want to scroll until I'm a skeleton, xD
I am unsure where you are finding all the documentation for this
I think I partially got some from bukkit itself, other from experimenting. It's not like I've written that thing in a day.
slot-upgrade-tiers:
'1':
price: 1000
slots: 1
'2':
price: 2000
slots: 2
What's the correct way to get all these values in a loop
Is it
There are javadocs on the dependency tho, those might help.
I just want to be able to write to the file without it deleting the data previously ๐. Donโt get why the tutorials are so bad and not covering everything
No idea either, there's just some software out there where you're really on your own. I'm already thankful for the free lib, as the parser spec's a nightmare. I can write a parser, but not something so messed up and complex...
for (String key : getConfigurationSection("slot-upgrade-tiers").getKeys(false))
If you "just want to get stuff done", you should really look at a library which wraps yaml. You can always shade one in, no matter your environment.
ill send it in a sec. Just some things to fix ๐
hmm you know if there is a way I can just hook the YamlConfiguration file Spigot has? Cause I know how to use that lmfao
Not trying to be mean, but your questions kinda need books as answers, xD. You're - in essence - asking about how to parse data. That's a huge topic. Iterate the top level keys, then decide on the section, then parse the tiers container, then parse the tiers and populate the container. It's basically a composition of multiple smaller functions which all care about parsing a section of the whole thing.
I don't think it's scattered at all, you might be able to just yoink that package right into your project: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/configuration?at=version%2F1.12.2
As I'm working on very specific projects, I have totally lost connection to what spigot is doing in regards to configs, tbh. I cannot be of much help there, I'm afraid. Of course I understand how it works, but I'm not having the implementation details in the front of my head at the moment.
?paste
https://paste.md-5.net/elupoxakay.java There you go @dry yacht
Wait
1 sec
i think i found something
Found this. Seems to work a treat! ty for your help https://github.com/Carleslc/Simple-YAML
Yep, that's what I meant, just a wrapper that operates on the yaml handle. Great stuff, hope it works out for you! If you need anything else, you can always steal from bukkit, xD
Yeh thanks.
https://paste.md-5.net/osijizases.java Updated version, still can't find the error.
Youtube
my code looks bad right now but I am just trying to get it to work for now.
yeah. I do that. but all my code is just in one big class for now. I'll split it out after I figure out what I am doing wrong. I kinda do things weird. lmao
by doing projects
Oh and if you want BlvckBytes i can make the comments english :9
yeah. once I get it working right i'll rewrite it.
I'm kinda having a hard time helping you tbh, as I also don't see the error, ://. I get what you're doing, but I just cannot seem to spot the issue... I'm pretty sleep deprived too tho, haha
Damn np
Ill send a vid in a sec
Well its a animation.
Hi, i don't know that happened here, i'm trying to call a static void methon on startup from class that is in one of subfolders, it worked one time, but after compiling it just popped out that without modifying anything there is an issue
You gotta be shitting me... that's the most stupid default implementation I've ever found. So that fixed it... I'm wondering whether I have to handle collisions myself, might just do that. Otherwise, finally.
What does Slabs.java contain?
The package and import statements are cut off 
Heres code: https://paste.md-5.net/buzipucebe.java
And heres video:
You see the little jump?
i thought you dont need them
Oh and its supposed to go around it downwards, but thats a fix for another time.
The main class'll always be gray, xD
It has no direct accessors, if you're not using the singleton pattern or whatever people do.
What should import it? There's nothing accessing that class (yet)
he is talking about import
I must be completely misunderstanding it then
Why is the main class circled red then
well, idk ๐
That import should work, and I cannot spot what's wrong with it yet, other than naming conventions, which don't matter right now
Can't you just delete that line and try an auto-import?
it just acts like the Slabs class did not even exist
auto completion cannot help when using method, but in import it completes it lol
Have you restarted IntelliJ? Just making sure at this point...
yep, i wil try updating
All of that's besides the point. The class is there, the import matches it's FQN, but the Symbol still cannot be found. Looks like either a stupid IJ bug, or I'm missing something very, very subtle
compile time symbol error?
still
i think remaking class will do the thing
can anyone tell me why onPluginEnable event is called multiple times?
Yeah, very hard to tell without being able to interact with it. I'm afraid that I can't spot the issue either :/.
bruh. deleted class, pasted methods to new class with the same name and it works
if you dynamically add event Listeners the event bus is re baked
Welcome to modern software
wdym rebaked and i didnt dynamically added.
I dont want to hear it at work in close future ._. but yeah c++ was also like that
double startY = location.clone().getY();
double endY = location.clone().getY() + 0.5;
double increment = (endY - startY) / ticks;
Is .clone unreliable? because its still adding to the normal location variable :?
no clone returns a new object
Not kotlin again, 
it will be called for every plugin when you perform a reload
it was just a reload - im printing registering X on its register and registered all event listener at the end of onEnable of my JavaPlugin. also i print onPluginEnable on each of listeners' onPluginEnable event handler.
yes reload will fire every plugins onEnable
That event is not just called if your plugin loads
You have your own hook in onEnable already
check in the event which plugin it is firing for
Would also be helpful to post the code causing confusion rather than just throwing around method names you chose yourself.
Wow, that's something massively different than what I was expecting
Are you trying to scan packages for classes that implement the listener interface to auto-register them?
yes and it works beside triggering onPluginEnable 4 times on each class - i double checked this by adding other listener thats not onEnable or onDisable (e.g. onPlayerJoin) and it didnt print out more than once
Why do you use that event, what do you want to achieve that way? just run the registration routine in onEnable
I do NOT understand this. This is where the Jump happens. And well no fucking idea why...
This is what it should look like :?
e.g. adding / removing packet listener channel, display/destroy every holograms
But what does the event do for you there, you don't extract any information from it? Why not delete the event and put the code into a method called in JavaPlugin#onEnable instead?
that is the good way to maintain your code i think? you dont want to put every logics in single class or smth
The event is called for every plugin on the server that enables. You will get multiple calls, n calls where n is the number of plugins you add to your server. Just create another class which manages this and instantiate in the onEnable. That's your lifecycle hook, while the event isn't
i didnt knew that well thanks
The event is basically helpful if you want to prevent other plugins from loading I think, like some sort of blocklist feature.
the event name is very confusing ngl i thought it only triggered upon my plugin's enable/disable
Yeah... it's a bit misleading. But you can - in general - expect events to be shared information flow, while your own hooks are overridden methods, as on JavaPlugin
i just fixed it by adding plugin instance equality check, without adding my own lifecycle. thanks!
Yeah, that also works. It's a bit of a rube goldberg machine now, not gonna lie, but if it makes you happy that's all that counts, xDD
Damn BlvckBytes I think I gotta rethink all this shit...
I was afraid you would have to, yeah... It became a bit messy, maybe that's keeping us from finding what's wrong with it. But hey, it's not that much code yet.
True, I think I gotta make the circle thingy first next time. To make sure it works, then implement the other stuff.
At this point i can't even go through my own code, because its so messy
this.saveDefaultConfig();
this.getServer().getPluginManager().registerEvents(new Core(), this);
this.getServer().getPluginManager().registerEvents(new onPlayerJoin(), this);
this.getServer().getPluginManager().registerEvents(new offHandSwitch(), this);
Objects.requireNonNull(this.getCommand("spawnParticle")).setExecutor(new spawnParticle());
Objects.requireNonNull(this.getCommand("addSpell")).setExecutor(new addSpell());
Objects.requireNonNull(this.getCommand("reloadConfig")).setExecutor(new reloadConfig());
Objects.requireNonNull(this.getCommand("setMana")).setExecutor(new setMana());``` Is there any better way to do this?
I mean this looks horrible there has to be right?
Explain further please
void registerEvent(Listener listener) {
this.getServer().getPluginManager().registerEvents(listener, this);
}
then just
this.registerEvent(new Core());
I'm sure this will be enough, thank you
Is there some sort of Reader which can have multiple restore points? I'd need to either reset to it's beginning or to a last position. Do I have to write that myself or is there something available?
It have c-like seek for example
Kind of
I'm not sure yet... I basically have an InputStream which I have no control over, and I parse a SnakeYaml root node from that. I want to put a custom reader before the call to parse the yaml and read string lines. If the line starts with a #, I keep on collecting until I either find an empty line and the header comment ends or until I find a non-empty line and that comment belonged to the first key in the config and I gotta put the whole thing back. Now that I think of it, there's no need to create a checkpoint before reading each line... It'll also suck that yaml will likely have offset line-numbers then. I think I need to handle the header comment differently.
I just don't want to have big blocks of comment text be member of the first key. I need different behavior for just that first key. I think that I really should go to sleep and re-think this tomorrow. Thank you for the input! :)
you need a BufferedReader. BufferedReader.mark(0) BufferedReader.reset()
FileInputStream fIn = ...;
BufferedReader bRead = new BufferedReader(new InputStreamReader(fIn));
// ... read through bRead ...
// "reset" to beginning of file (discard old buffered reader)
fIn.getChannel().position(0);
bRead = new BufferedReader(new InputStreamReader(fIn));
method above is slightly different
this will reset to the beginning of the file instead of the buffer to illustrate another way
However from above it sounds like you are going to need a series of buffers for the things you are wanting
and from those buffers perform what you are wanting
Alright, thank you for the idea! :). I was trying not to bind myself to a file, which is why I am afraid that operating on the input stream itself will not be applicable in my case.
the advantage that it is a file
is the fact you can load a copy into memory
and do as you please with it without affecting the original
so a lot of the operations will be quicker if you are doing it from memory copy
Yep, I see... I could also just take the easy route, read the whole stream into a string, perform my operations and then create an input stream from the string to pass to the yaml parser. I was trying to come up with a kind of cut-through method in order to not have to waste all of that memory. I get it that configs should be small, but it still hurts to load that much. I haven't yet considered all viewpoints of this...
and hopefully that gets you in the right direction and with that I am off to get ready for work ๐
just fyi
the yaml lib automatically loads yaml files into memory
so regardless if you decide to come up with a custom solution or not, the part that will always be slow unless you piece meal load it is well loading it, but once in memory it isn't an issue
Yep, thanks for the input! I'm gonna take some time to think about it, as I don't want to rush anything. I'm not even sure that I want to handle comments this way. I think it'd be even smarter to extract the header comment from the rood node after parsing, so all node cursors have the right offsets into the file. I really overcomplicate things sometimes, xD.
Oh, it does? I thought it was also this event based parser which emitted events as it went and built the config in the piece meal style. Hmm, I guess I was wrong.
also
if you are just wanting to keep track of the comments to put them back
the reader has the ability to get line numbers
so you could just save the comments noting their line numbers and then just put them back
Oh, no, I'm shading a new-enough snake yaml which parses comments into nodes. I just don't want this to happen, where the header comment is identified as a member of the first key and thus duplicated if I migrate the config automatically by adding a key above that. The header comment should always stay at the top. So I just need to extract it from the first key the parser yields and strip it out of it's comment, I think.
then obtaining the header and only the header to prevent something being put on top should be easy then
just scan for lines that start with # at the top and keep going down the lines until you find no more
once no more detected that is your header
I still cannot modify the stream, but have to extract it from the root node's first nodetuple entry, as their cursors are screwed otherwise. But well, I don't want to keep you from getting ready for work, sorry! :)
The input helped already
I don't use any APIs, instead of snakeyaml, xD
that is what I am saying you don't need snakeyaml to obtain the header or know where it is at
you can just use File API's in which you would have control over the stream
I think I do, otherwise all snakeyaml parser errors are going to have offset line numbers and going to drive the user insane... xD.
The context is still going to be matching, but the numbers will be off by the length of lines of the header comment
then not hard to implement an offset
based on header size
in either case you have more information then you did previously ๐
yep ๐
from a player ?
?xy
Asking about your attempted solution rather than your actual problem
For some reason this isn't working, the first part works but everything under the else doesn't, it's supposed to raytrace for 100 blocks and get the block hit by the raytrace and teleport the player to it. but it isn't working.
How would I go about detecting when an item drop is destroyed in lava?
My first idea is to start a timer when an item is dropped and check every some time if it's right next to lava but someone probably has a better answer.
and also cancel that timer after a certain amount of time so that every item drop isn't constantly being checked.
if it's been like 10 seconds, it's not being dropped into lava.
this is why I dont help people because I cant read (sorry demeng)
That does seem rather cumbersome, for instance what if the lava is being placed on top of the item way after the item has been dropped?
I expected there to be some sort of event for this but it doesnt seem like it
I don't think there's an item despawn event.
there is.
but only out of natural despawn.
Yeah, it's a tough problem to solve and be efficient at too
the only things I can think of are loops that check for lava around items.
Hey mates, would anyone know of a way to change the SpawnData of a spawner?
if (args[0].equalsIgnoreCase("reload")) {}
if (args[0].equalsIgnoreCase("setMaxMana")) {}
if (args[0].equalsIgnoreCase("getMaxMana")) {}
if (args[0].equalsIgnoreCase("executeSpell")) {}
if (args[0].equalsIgnoreCase("addSpell")) {}``` Is there a better way to do this?
could use a switch method
Not sure what a switch method is
switch (args[0].toLowerCase()) {
case "help": //code; break;
case "reload": //code; break;
}
lets ya concatenate recursive ifs
just remember to use a break after each case, else all lower cases get called
Oh ok, cool thank you
How would I check if the arg is null?
sorry first time using this switch stuff
Didnt even know it existed until now
check prior to this switch and do if (args == null) or (args.length == 0)
Oh ok that makes sense, thank
Also, if you're using Java 13+, you can do โ and avoid breaking entirely (+ a bunch of other cool 'enhanced switch' stuff).
switch (A) {
case 1 -> {
a();
}
case 2, 3 -> {
b();
}
default -> {
c();
}
};
?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.
I know java i was just wondering if there was a way to check for null in switch aswell
Fr?
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
Hey i want to declare a dependency in this case https://github.com/cabaletta/baritone/releases/tag/v1.9.1. how do i do it via build.gradle file
i could not find any useful forms
If its not on maven or another repository, youll have to add it as a system dependency
on gradle
how do i do it like ik i need to put it in dependencies but what is the code to add it
nothing i tried works
You add the dependencies in the build.gradle file
dependencies {
compileOnly 'org.spigotmc:spigot:1.18-R0.1-SNAPSHOT'
}
Example for adding spigotapi as a dependency
@quaint mantle
compileOnly because it's provided by the server. Not your plugin
I got a forge client and send a custom packet to bukkit server, how to receive it with plugin?
Can anyone recommend a good reference to create Custom GUI's for minecraft? I wanted to create a custom Admin window but a lot of material out there is outdated or doesn't really explain the concept very well.
hi!
wanted to ask if there is a way to cancel the magma block event?
like the buble column sucking entities down
(cz i am using boats with model engine that use zombies as entities and have a cusotm map generated with iris , but the map has magma block in water so boats sink)
replace the water block above the magma block with flowing water. Do keep in mind to use the 'no-physics-update' method
You can use the plugin messaging channel to communicate with the server.
To see how to implement it on the bukkit server side read the following. (Don't forget to use your own channel rather than the Bungee one) https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
On the Forge end you'd just register a SimpleChannel like normal. See https://docs.minecraftforge.net/en/latest/networking/simpleimpl/
Do make sure the channel names are the same on both Client and Server. So Spigot should have the channel <namespace>:<path>
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
so cool and detail, thank you very much
wont this cause lag ?
if the plugin replaces all the water blocks on magma blocks in world i my world is 10k x 10k
You shouldn't replace all the water
Just where the zombies are
and then replace it back when they move
Hey guys just as a sanity check (as a "before we accommodate this" sorts deal) .
Back end wise what are the downsides of having 2600 bees in say a 10 chunk radius?
And how much would those be mitigated if we disabled AI and collision under say 18tps?
Gut is telling me one thing but wanted a sanity check from u lovely folk before commiting haha
reckon this is a #help-server thing
its not programming related though, is it?
I figure between the general community and the devs, fellow devs would have a better lick on its repercussions resource wise.
Why do you need that many bees
It's what we have predicted min maxers will do under our current system and we are debating whether to accommodate it or not.
Just getting a sanity check on how we approach it.
And if there are problems that'll creep up even if we disable ai and collision resources wise
If you disable the ai they will get stuck and do nothing
Keep the bees inside their hives if possible
Hey, I want to know if this is true:
Is it possible that PlayerInteractEntityEvent does not get triggered when a player removes a helmet from an armorstand, but subclass (of PlayerInteractEntityEvent) -> PlayerArmorStandManipulateEvent does get triggered?
Try and see?
I have tried it and it does confirm it, but I just want to make sure that I am not messing something up in the PlayerInteractEntityEvent (almost every other interaction seems to trigger tho).
Because due to that exception (and other subclass exceptions) I have a lot more code lines than I thought would be necessary
I think this subclass feels more as an "extension" in that case instead of a more specific part of the super class.
Which confuses me, hence I am asking if my approach (or perhaps reasoning) is wrong
PlayerInteractAtEntityEvent 
Is the PlayerInteractAtEntityEvent triggered when clicking on a mob with a name tag?
Do you guys use built in fileconfiguration to do your big configs?
Or what good alternatives is there
Uh sure, but I like to define a class that represents the config more accurately
For instance
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
Definitely not what I asked
Cause I was thinking right, if I have a messages.yml and I want to use those, I need to make a string object for each line
Is that not a waste? is there better ways of doing it
that link I gave you covers all of it. Exactly what you asked for. Using custom configurations