#help-development
1 messages · Page 1477 of 1
I think HumanEntity represents a human entity and the player is an entity with a player connection or smtng
I believe it might be an nms design which spigot just forwards
Sorry for posting again but I think nobody saw my message:
So I wanna replace the inventory the player's opening when interacting with an ender chest with a custom one.
However when I set the InventoryOpenEvent to cancelled the ender chest block just stays open and is never closed. Is there any way I can force it to close when the player closed the inventory?
so you can open it but not close it?
no I just cancel the event and that results in the block still looking like it's open
and never closing
oh its a visual bug?
yes just visual
sorry no idea how that works
Still need help with that
Use PlayerInteractEvent and check hasBlock and then check the block and the action also
I mean I want the ender chest block to open up for as long as the player is in the ender chest inventory, like it usually does
check if attacker is on ground
When a player uses a critical hack it is on ground tho?
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.k_() && !this.V() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag && f > 0.0F) {
f *= 1.5F;
}
@quaint mantle
think its mostly a packet hack
ok
sending that slight above the ground location
Been this long and still no boolean for critical though lol
Would be a useful feature
I try to increase the speed of the player when he is in the water. I tried to use velocity in a PlayerMoveEvent, but even if I move more with my keyboard, the player keeps moving with velocity (and the event is called continuously)
is there a way to paste a schematic of WE without WE ?
is event.getInventory().getTitle() removed?
so like this?
public void onPlayerInventoryClick(InventoryClickEvent event) {
if ((event.getView().getTitle().equalsIgnoreCase("Trade")) {
}
try it
how do you get the arrow shot from the bow's velocity
the velocity
rn im doing this
public class ShootBow implements Listener
{
@EventHandler
public void ShootingBow(EntityShootBowEvent event, ProjectileLaunchEvent event1)
{
Player player = (Player) event.getEntity();
float speed = event.getForce();
player.sendMessage("You have shot a bow!" + "Velocity: " + speed);
Arrow arrow1 = player.launchProjectile(Arrow.class);
Arrow arrow2 = player.launchProjectile(Arrow.class);
Vector v1 = player.getLocation().getDirection().clone();
Vector v2 = player.getLocation().getDirection().clone();
v1.rotateAroundY(0.1);
v2.rotateAroundY(-0.1);
arrow1.setVelocity(v1);
arrow2.setVelocity(v2);
}
}
idk if it will work
guys
oh if you're using the EntityShootBowEvent you shouldnt need the ProjectileLaunchEvent
oups
yeah
am i no longer verified? :p
String.valueOf(float);
String.valueOf(float);
why did it reply to that
tf
Impostor?
would this work? string speedS = valueOf(speed);
also, you're casting the entity to a player without checking that it is actually a player
yeah true
im just tryna get the basic code working
then ill check for all that stufdf
String speedStr = String.valueOf(speed);
trust me
I prefer C# anyhow
There's no such thing as a Language > Another
nobody would want to be me so it's fine :p
you can be sure i'm the one
You don't seem to be experienced in Java tho
you'll need to learn java before making comparations
c++ is far from perfect either
i havent worked in java for over a year
it lacks safety
how so
java's mistake is that it feature null
but c++ has a lot of things like that
c++ doesn't feature type safety
you can use an int as a boolean
why would you
C++ just lets you to do Unsafe stuff
You need to be a good programmer to protect your code about bad practices
^
ah well
{
@EventHandler
public void ShootingBow(EntityShootBowEvent event, ProjectileLaunchEvent event1)
{
Player player = (Player) event.getEntity();
player.sendMessage("You have shot a bow!");
Arrow arrow1 = player.launchProjectile(Arrow.class);
Arrow arrow2 = player.launchProjectile(Arrow.class);
Vector v1 = player.getLocation().getDirection().clone();
Vector v2 = player.getLocation().getDirection().clone();
v1.rotateAroundY(0.1);
v2.rotateAroundY(-0.1);
arrow1.setVelocity(v1);
arrow2.setVelocity(v2);
}
}```
i give up
somebody tell me how to set the 2 other arrow's speed to the main one
Cap
this is a default BungeeCord server message right?
*** SERVER IS RUNNING OFFLINE/INSECURE MODE!
The server will make no attempt to authenticate usernames. Beware.
Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted,
it also opens up the ability for hackers to connect with any username they choose.
It isn’t
you don't need to clone the direction
it is already a new vector
yeah i heard about that
only clases start with Uppercase
the documentation for spigot is trash
so you don't confuse them
i gotchu
well
i wish it was better
i'll rather have no comment than one that is half the truth of what that method does
oh
and the biggest thing
public void ShootingBow(EntityShootBowEvent event, ProjectileLaunchEvent event1)
this won't work
it looks only for the mono parameter methods
so you want to rotate it?
@sly storm
?
if so
use the first parameter then
and get the projectile via event.
then rotate that
not rotate
get the velocity
rn i got the force of the arrow
from getForce();
now i need to set that value
to the other arrows
do i store that in a Vector?
give it to the other arrows
if you're using the launchprojectile
i think it has a second parameter to where you can give a default velocity
if not spawn an entity arrow
and give it there
is there a faster way to put this? for example i want to put number 17 - 28
Hello, I'm using Lua to make a program, and I want to make a platform appear a dissapear. But it won't work... Can anyone point out a possible mistake, please?
`local platform = script.Parent
local function disappear()
platform.CnaCollide = false
platform.Transparency = 1
end
local function appear()
platform.CanCollide = true
platform.Transparency = 0
end
while true do
wait(3)
disappear()
wait(3)
appear()
end`
loops
is it worth it to implement sql or should i just storage info in the config file
wich one is better
owh yea
like this its a trade gui
you could use a loop with column and row extemption
uhm i dont how to do that
well
int slot;
int row = slot % 9;
int column = slot / 9;
for (int i = 0; i < inv.size; i++) {
if (row == 0 || row == 1 || row == 5 || column == 0 || column == 4 || column == 8) {
//Do something
}
}
Arrow arrow2 = player.launchProjectile(Arrow.class, event.getEntity().getVelocity());```
i tried what you said
does it work?
it has that parameter?
ah 🤔
soo
maybe's PlayerLaunchEvent
Is event.getEntity the player?
If so, that would only be a very low amount of velocity, if any
yea
i tried Vector arrowSpeed = event.getProjectile().getVelocity();
its giving the correct speed
but now the arrows are being spawned in the same location as the first 1
also Lua isnt the same as roblox's lua, albeit quite similar, and this channel is for plugin dev :)
Yo, could anyone help me understand this code?
public static int rainbow(final int delay) {
double rainbowState = Math.ceil(System.currentTimeMillis() + delay / 2L);
rainbowState %= 360.0;
return Color.getHSBColor((float) (rainbowState / 360.0), 0.2f, 2f).getRGB();
}
I dont understand the logic behind it
thats all
And Color.getHSBColor is something i dont understand aswell
anyone know how to add an arrow trail
spam particles behind it every second
use a runnable to spawn particles behind it periodically
new BukkitRunnable() {
public void run() {
// your code
}
}.runTaskTimer(YourPlugin.getInstance(), startDelayInTicks, periodInTicks);
or use Bukkit.getScheduler or whatever it is
how do i do the particle part
the .runtasktimer doesnt work
some particles require extra data
1 sec
kk
doesnt work in what sense
idk how to use it
which part of it
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
BukkitRunnable's runTaskTimer: the first parameter is an instance of your plugin, the second is a long, which is the amount of ticks before it starts, third being the delay in ticks before it repeats
use this tho
would this work
.runTaskTimer(new TripleArrows(), 0, 1);
TripleArrows is the name of the plugin
kk
and for the record, no that woulden't work
dependency inject
I do this but idk if its the best way
private static TripleArrows instance;
public void onEnable() {
instance = this;
/* the rest of ur onEnable */
}
public static TripleArrows getInstance() {
return instance;
}
and use TripleArrows.getInstance()
yup, not the best
thought as much
you should just expand with constructors
create a chart in order to separate and isolate components
if you feel like it
aight
is it possible to attach a particle to a player so whenever he moves so does the particle?
my idea was add the player uuid and the particle he has to a list, then every 1 second or so spawn all particles under the player
yeah
but idk how friendly this is
and making the particle follow the player is way better
I mean sure
Lmao delayed
...
ive done this so many times before it has always worked but for some reason is not working now, if someone could help me spot something that could be causing the program to not output the message to the user using the command /discord
https://paste.md-5.net/arutukifek.java
did you register the command in the main class?
im so retarded, thanks
No real need to do that
well its not working for some reason anyways
You don't need the requireNotNull
yeah i know
Send your main class if you can
like this? ```
package mc.polarfps.triplearrows;
import org.bukkit.plugin.java.JavaPlugin;
public final class TripleArrows extends JavaPlugin {
private static TripleArrows instance;
@Override
public void onEnable() {
System.out.println("I'm Working!");
instance = this;
getServer().getPluginManager().registerEvents(new ShootBow(), this);
}
public static TripleArrows getInstance()
{
return instance;
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
also, you are checking if the label is discord, when the command is discord
so label is already discord
ignore that last comment that was deleted of mine misread that
@quaint mantle
yeah i also just fixed that too i kina pasted it from something else and i mixed it up
While returning true is for the most part good, you need to make sure they know why to return true and when to return false. If you return false it will send the usage message that would be provided in the plugin.yml, It won't send anything if that usage doesn't exist
thank you, we all need a second eye sometimes
indeed
you should also add something like
player.sendMessage(convert("message here"))
public String convert(String s){
return ChatColor.translateAlternateColorCodes('&',s);
}
I mean you could return false if you want to return the usage stated in the plugin.yml
No i just had all that extra stuff there from pasting other code but yeah true
thats why you never paste code lmao
ok still does not work for soem reason
show code
package me.grindinghalt.outputtochat;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
}
@Override
public void onDisable() {
//shutdown
//reloads
//plugin reloads
}
// /discord <-- discord srvr link
public boolean onCommand0(CommandSender sender, Command cmd, String label, String[] args) {
if (label.equalsIgnoreCase("discord")) {
if(sender instanceof Player)return true; {
//plr
Player player = (Player) sender;
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f<&1&l|| &3 &c&l<- click link"));
return true;
}
}
return true;
}
}
what happend to the onEnable()? lmao
wait i deleted it after i tried it
if(! <---sender instaceof Player) return true
that turns the if condition
what you are doing now is
if sender is a player then return True
if(!sender instanceof Player)return true; {
so its clean
yes
just checking this
public void onEnable() {
getCommand("discord").setExecutor(new Main());
why Main()
i just want it to be in one
this works
oh my god its still not workin
package me.grindinghalt.outputtochat;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
getCommand("discord").setExecutor(this);
}
@Override
public void onDisable() {
//shutdown
//reloads
//plugin reloads
}
// /discord <-- discord srvr link
public boolean onCommand0(CommandSender sender, Command cmd, String label, String[] args) {
if (label.equalsIgnoreCase("discord")) {
if(!(sender instanceof Player))return true;
//plr
Player player = (Player) sender;
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&f<&1&l|| &3ht://discord/FGJGKAQ &c&l<- click link"));
return true;
}
return true;
}
}
ok ill try again
you can simplify if conditions into a single line
for example
if(!label.equals("discord")) reutrn true;
and mix that with the player one
so
so like this
if (label.equals("discord")) {
if(!(sender instanceof Player))return true;
oh i see wait
if (!(label.equalsIgnoreCase("discord")) || !(sender instanceof Player)) return true
you are missing the @Override
on top of the onCommand
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
just on top?
yup
like that
you should add a desc to your command in the plugin.yml
finnaly it works
nice gj
thx man
np
I am trying to use this really old language detection library however i keep getting this error:
Caused by: java.util.MissingResourceException: Can't find bundle for base name com.cybozu.labs.langdetect.util.messages, locale en_GB
I have the code here where they load the resource file:
private static final String BUNDLE_NAME = "com.cybozu.labs.langdetect.util.messages";
However as far as i can see there is a file at that file path:
I cannot really change the src files as i have installed them to my maven repo and am just shading them
I wondered if anyone knew why the file wasn't being picked up?
Just out of curiosity, shouldn't the resource bundle classes be able to achieve localization
Not really sure what that means tbh :-))))
Its just been a real pain to try and integrate this into the plugin
do mobs in minecraft regenerate hp naturally?
afaik, no
It's only me who heard that protocollib has been compromised and it's update is ratted?
potentially fun bug for someone to look into https://hub.spigotmc.org/jira/browse/SPIGOT-6486
lol
anyone know a good place to start for creating my own mods
how do I change player tabs and display names / prefixes to be individual? Basically one player might see everyones name as red and another would see it as blue
yes fabric or forge?
hmm Idk if scoreboards could do the trick else packets might be a last resort
I dont know what those are sorry.
would you happen to know any resources on working with packets? I never have before
AsyncPlayerChatEvent
Sweet, looks like forge is more im depth, with what i want to do, i may prefer that
Unless you think starting with fabric is worth a shot
i managed to make it work, thanks though
how do I check if a player opened there inventory
can't
i mean if they interact sure, but if they just open their inventory there isn't anything called
there is a inventoryopenevent
and that doesn't get called when a user opens their inventory
it is handled client side
thanks
how to make some code execute when holding a certain item without clicking?
why are the gamebanana servers so bad
its gonna take like 3 hours to install a 200mb file on gamebanana
any idea why cancelling an EntityAirChangeEvent doesn't stop the air from decreasing?
Has anyone here ever implemented placeholder support for one of their plugins?
Yes
Yes
Yes
Yes
you've said yes already! 👀
Maybe I've done it twice👁️👁️.
yes
using BukkitRunnable, afaik.
idk what's the other best options.
Maybe ItemHeldEvent?
that could work too.
First getItemInHand and check the meta
Yes
I'm having trouble wrapping my head around what placeholders are and how I can implement support for them in my plugin. I did notice that there was a plugin on SpigotMC called PlaceholderAPI. Is this what I am supposed to use? Any and all help would be appreciated 🙂
https://www.spigotmc.org/resources/placeholderapi.6245/
Yes
I'll check out the Wiki for that API then 😉 Thanks!
Player.send(text);```
btw forgot
to define text
lmao
why did you message that 3 separate times dan
You should ask in their discord for more help
At first I didn't reply to you, and then the automoderator kept removing my message.
They have a discord? I'll definitely look into that! Thanks!
Yeah
xD
someone know how to cast bukkit chunk to nms chunk ?
Just a quick question regarding Sets.
After removing an element of a set, does set.size() still work and returns 0 or null, after deleting the last element?
Can you not just cast it to craftchunk?
i try
you cant do CraftChunk#getHandle?
He should be able to
i do and it work thx
my genius saves the day once again
i just can't seem to think of any instance where this would be useful
I have used NMS chunks for asynchronous raytracing before, so there are a few use cases
here in italy something is happening, people are literally spamming that spigot is ratted with malicious plugins, and that they are injecting stuff into well known plugins
Well you could just decompile and take a look yourself
Only download from Spigot.
Optic fusion is also working hard on removing potentially bad plugins
Is there an "easy" and "conventional" way of telling whether an Itemstack has changed? As far as I see I could probably do some really unsafe shit with Server#getItemFactory, but is that a good idea?
wdym changed
Changed type or item meta
changed type?
like you mean you want to see when a plugin calls setType ?
yes
though setType isn't too much of an issue for me since I can do that myself easily, itemmeta is a bigger concern for me
no and item factory wouldnt help
why does your pdc need to change every time the item does?
The PDC doesn't need to change but I need to refresh my caches since the cached itemstack would be invalid
just do that when you read from the cache?
the item wont be .equals to whatever is in your cache and therefore automatically replaced
you shouldnt even need to do anything unless your cache is really broken to begin with
isSimilar clones itemmeta, which would be pointless for me
sorry I still dont get your issue
from what I'm seeing ItemStack#setItemMeta0 calls this.meta = Bukkit.getItemFactory().asMetaFor(itemMeta, material);, so my thought was that I could simply change the server and relay all calls and intercept getItemFactory#asMetaFor
yeah but I dont see what this has to do with your cache at all
I want to do optimisation by cutting down on itemmeta clones by doing caching
if the item is changed it will no longer be in your cache
because your cache would be by hashcode/equals which changes when the item is changed
So items are immutable?
equals and hashcodes sadly do exactly what I wanted to avoid, at which point I could just drop it alltogether
Looking at the ItemStack class I could obtain the meta field via reflection and perform instance comparison to check validity which might be the easiest in both codewise and speed
I dont get why you cannot just use a clone as your cache key
hashcode invokes getItemMeta() which invokes this.meta.clone(). My main concern with the whole operation was to cut down on meta.clone() calls, while the rest of the logic is still a bit expensive, meta.clone() is the most expensive part, so I want to reduce this and only call it whenever needed
I'm calling these methods like 6 times per player per tick and per event, which is not the best thing to do. I could just use bukkit events to know whether the item changed but those are not the most reliable thing with other plugins that I cannot control
cant you just call getItemMeta once?
that is my idea
I mean like why do you call it 6 times now
once for every armor slot, offhand and hand
pretty sure hashcode and equals both call meta.clone twice
I cannot do that without altering spigot code
once for item damage and a second time for comparing the actual meta
well you could alter spigot code and then open a pull request so everyone can benefit
@wraith rapids that'd be a nice thing for you to fix. I assume the durability check is only needed if the item is legacy
myes, it would be a rather easy fix
I'd dig a NNY spigot contribution
it would also be a rather easy fix to make equals and hashcode use the cached itemmeta instance
since mutability isn't an issue there
you should do these things
perhaps
Has anyone worked with translate components and know if you can use them within Container Titles?
iirc yes
at some point you couldn't but I think the client supports them now
it should support them just about anywhere where text is involved now
I think there are a few exceptions
container titles might be one of them, but I cannot say for sure
What’s the best way to covert the translates into a string so the container can use them?
if anything, just try and see
they definitely used to be an exception
the server only bundles in the us_en localization
so you'll just have to hammer the translatable component into that
is spigot 1.17 in the workings? 😳
TranslateComponent t = new TranslateableCompenent (“offset.-4”, “this is text”)
gui.updateTitle(t.toString)
Just returns the long breakdown? Am I going at it wrong?
You are importing this to string. Use packets for json using in titles
or use paper which has component setters for container titles
or search the spigot api for one, it might have one too
remember to check under rocks and any spigot() methods you might find
To change Inventory titles with spigot you have to reopen the view
Action.RIGHT_CLICK_AIR does not want to be detected with an empty hand. There is alternative?
the client doesn't send a packet for that iirc
Anyone able to give me an idea what to look for as I have no clue how to do or work with json
Read the javadoc for the event and you'll see how to handle it
i'll try
gud
@EventHandler(ignoreCancelled = true) breaks all. With right-clicking on air PlayerInteractEvent won't run.
true is default, set to false
You do you
The evetn he's talkign about ignores canceled
and it isn't working
boolean ignoreCancelled() default false;
This event will fire as cancelled if the vanilla behavior is to do nothing (e.g interacting with air). For the purpose of avoiding doubt, this means that the event will only be in the cancelled state if it is fired as a result of some prediction made by the server where no subsequent code will run, rather than when the subsequent interaction activity (e.g. placing a block in an illegal position (BlockCanBuildEvent) will fail.
that should usually work
@EventHandler(ignoreCancelled = false)
you can omit the ignore cancelled
that's by default
So how can i create/play custom sounds?
If ignoreCancelled is true and the event is cancelled, the method is not called. Otherwise, the method is always called.
WTF MD
This has to be the worst design of all humanity
Okay, now that I think of it
The name is bad as it is ambigious
People love to argue
.
wtf
ignore cancelled means ignore cancelled event
check java docs of playsound
Not ignore cancelled state
yes
Really ambigious
ignoreCancelled is false by default
public void onInteract1(PlayerInteractEvent event) {
Action action = event.getAction();
Player player = event.getPlayer();
if(action.equals(Action.RIGHT_CLICK_AIR)){ teh code}
}```
that is, event handlers, unless you specifically tell them to ignore cancelled events, will not ignore them
Can't without resource packs
iirc the client just doesn't send any packets for rightclicking air without an item in hand
forge mods might work
forge is incompatible with bukkit
Wait really?
¯_(ツ)_/¯
deleted
bad
xD
Idk I even played amogus thing using forge
i can't detect it?
well yes but that involves running a not-bukkit server
it's very bad, if it is
i'll try check packets with ProtocolLib. Wait a second
is there something that limits how quickly entities can deal damage?
like a hard cooldown between damage hits?
(non-player entities)
How can I do that with resource packs though?
iirc entities become invulnerable to damage for a short time after getting damaged
thanks
I have code where an entity damages multiple players in a single tick, but it looks like for whatever reason the code tends to only run for one of the players in range
Probably overriding some "useless" sounds, but don't ask
it's confusing because it's a really straightforward piece of code
Hey guys, how can we reset a player's inventory?
Is there a method or we need to make a foreach loop ?
Inventory#clear()?
Thansk
getPlayer().GetInventory().clear
not exactly this code
why tis no compile
Nvm
a String is not a char
new String(new char[]{'-'}) 🤡
char c = "-".toCharArray()[0]
based and redpilled
yo guys I want to make bedwas plugin how i make 1 plz btw what is string
it's what you put on a guitar
oh thx U so mach love you <###
anybody happen to know a priority queue that's optimized for almost-sorted input
i don't think my rolling binary heap impl is going to fly
Hey guys, how can I add an item to a player without making a new stack in its inventory, I mean, if a player has 15 wool, and I give him 1 wool, it's going not going to put it in the same stack as the 15 wool, how can I change that
it should
It doesn't with wool
how are you adding it
1.8 plebian detected
yea
@crude hound help your fellow 1.8 plebian
the infamous NNY list of 1.8 users
Try using setItem
oh
I mean I use it than addItem
I think it's because my first stack of item has a itemmeat
meta?
ItemMeta*
MEAT
Cool
yeah, items must return true for isSimilar for them to stack
Hello! I have just programmed a join listener, which opens a GUI for the new joining player. In this gui I wanted to put a custom head from Minecraft-heads.com. I then took everything I needed from the website. However, when the gui opens, the head is still a Steve Skin ... Does anyone happen to know what I could have done wrong?
I can also send my code
?paste
Try SkullMeta And setting the skull owner to an IGN, this might work
A valid Minecraft account username
just note that if the skull owner isn't cached, it will make a blocking network request to mojang to fetch the profile
i assume you're using the same texture each time though so that shouldn't be a big issue
you can get the player's selected locale with the api btw
no need to make a gui of your own for it
i wanted to use this gui as an exercise.
fair i suppose
I use itemMeta.setOwner
¯_(ツ)_/¯
easier
Can somewon help me with args can u dm me
no
):
Youtube.com for java tutorials
ask your question
someone may answer it
nobody is going to bother to DM you to ask you to ask your question
pretty sure that spigot does not fill a skull textures when setting the offline player
i have a args
.
problem
describe your "args problem"
what
i do
i cant make it easylie
upload the image elsewhere and link it
I cant send screenshot
verify 😏
How to use e.setDropItems(false); for spigot 1.8 because there's not this method in 1.8
update
no
funny
backport it to 1.8
1.8. combat is the reason 1.8 is still alive
or actually do something useful and backport the new api to 1.8
so people can use it
hi, im looking for an event triggered when someone trades with a villager.
PlayerInteractEvent or smt
or InventoryClickEvent
try TradeSelectEvent, not sure if that's what you want
but i mean when trade is complete
i didn't see any other trade related events so you might be sol
can i somehow detect if something is bought in that event?
or soemthing
not sure if PlayerInteractEvent works
I have now added your suggestion to my code. My code is now the following: https://paste.md-5.net/irizetomog.java
thank you @coral sparrow
when the gui opens now comes the head of my Minecraft character
np :)
Because you set "StraussFalke" as the skull owner and you are "StraussFalke"
i thought i should put the owner on some player?
If you want the skullowner to be the player who opens the Inventory aka the GUI
Go to the event method and itemMeta.setOwner(event.getPlayer.getName)
if (HeldItem.getType().equals(PlacedBlock.getType())) {
System.out.println("Placed");
}```
it doesnt print anything and im confused
Umm
Where are you sending the message
to the player right?
it's remarkable how many things you were able to do wrong in just 1 line
ikr
no I would like The Skull to get a custom texture from Minecraft-heads.com. For this I have created the method germanHead
console
Bukkit.getConsoleSender().sendMessage("e");
I thought Player xd
try this btw
thank you But the head I want to use already exists. I would like to import actually only its texture
i dont think the printing is the problem
the code above it is
Nah I thought you were trying to send it to the player
@feral estuary Could you share the whole code
Morning guys, is it theoretically possible to have all entities (ex chicken, zombie) be aggressive/charge at you like a creeper and then explode? I don't see any of them having the explode method outside of creeper so maybe I can replace that with a TNT?
package me.vexvr.actest;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.*;
import org.bukkit.inventory.*;
public class Scaffold implements Listener {
@EventHandler
public void onPlayerPlaceBlock(BlockPlaceEvent event) {
Player player = event.getPlayer();
ItemStack HeldItem = player.getInventory().getItemInMainHand();
Block PlacedBlock = event.getBlock();
if (HeldItem.getType().equals(PlacedBlock.getType())) {
System.out.println("Placed");
}
}
}
Uhh Like
He places the block and should it detect that he has the item in his hand?
Is there any way to change Java version of "minecraft-server-1.8.8-SNAPSHOT.jar"? I'm trying to build custom jar for a project but I couldn't use Java 16 due to the jar. Is it because of the Mojang built in Java 8 and there is no source code for that?
??
1.8 plebian detected
lmao
tryna make a patch for scaffold
oh yeah its not supposed to be proffessional
its just for fun
and learning
will a 1.8 jar still run on 16 with the new security changes?
What are you trying to do
bump
a anticheat for scaffold
most likely yes
I just wanted to use Java 16 features in the source code but if it's not possible, I'll probably do what you said.
That's what I am doing...
your plugins can use new features just fine as long as the JRE you run your server on supports those features
I mean currently what you doin
I meant to say spigot fork, not a plugin. I'm trying to edit source code of the spigot as a fork.
when the player places a block
if they are holding the same block they placed
it prints
im gonna do the kick later
ohkay
then there shouldn't be any issue?
Since Minecraft 1.8 default server is not support Java 16, I cannot build the jar :/ So I'm asking if there is the way to upgrade default minecraft server jar to Java 16
What error are you getting? @echo ether
then you presumably did something wrong
HeldItem.getMeta.Getdisplayname.equals(PlacedBlock.getType())
try this
Basically the spigot itself uses minecraft server as a base. In the picture you can edit "AttrivuteRanges" but you CANNOT do that for extended class which belongs to default minecraft server.
I'm getting error in AttributeBase.
comnparing a strign to an Enum will fail
So I cannot do anything about it...
what error
Do you even know Java?
this guy has never seen a line of code in his life
PlacedBlock.getmeta.getdisplayname.equals
HeldItem.getType() == PlacedBlock.getType() is probably what you want
pain
yup
ok let me test 1 sec
I thought you making an anticheat lmao
i am
Good lord
lmao
it didnt work 0-0
So you're telling me this guy is making an anticheat with 0 experience with spigot
let alone java
What are you trying to do?
its not proffessional
so if a player places a block, if the block they placed and the block they held are the same, it prints a string
even if you are trying to make a plugin.. You have to learn java
tell you what, it's not even going to work
also why are villager deaths in console so long
Villager EntityVillager['Villager'/248, uuid='b5e10a84-fe70-4bae-b8c7-f22417c189f6', l='ServerLevel[paper_1_16_4_1273551]', x=-287.43, y=70.00, z=309.64, cx=-18, cz=19, tl=121638, v=true, d=false] died, message: 'Villager was slain by Zombie'
but that will always be true?
god this is painful to read
goodbye
cya chad
He was making a scaffold check where the client doesn't set their selected slot before placing the block below the player
oh well then
Learn packets
Guys I have a question, so I'm making a KnockBack FFA Server it's just like we're in a platform and we need to put people off with a stick, but, I created that when someone falls, if its Y position is < 100, he get teleported to the spawn, but before he get into the spawn, how can I get the people who knocked him?
Pretty sure event listening is enough
getKiller
oh nvm
But he didn't die
yea
He just got teleported
DamageEntityByEntityEvent#getDamager
iirc
Have a hashset where you simply store their last attacker
Is there a way to get the user protocol version from protocol lib in bungeecord ? From the functions i see, getProtocolVersion(player).getVersion() only accepts a "player", which is not defined in bungeecord
Protocol lib is not for Bungee
Do you know any other simple way to just get the protocol version from bungee ?
or the minecraft version
getVersion on the Proxied player gets you the protocol version.
yea Connection#getVersion() returns the protocol number
Is there something to automatically respawn a player who dies without getting the screen "respawn | back to the menu" for 1.8 without using something like tping him or anything
yeah
set the player health to 20
...
when the player dies that is
altho it introduces some side effects it is the only way iirc
You have to check in the damage event as the dies event teh player is already dead
You can;t tp a dead player
the death event works fine for that actually
it does?
Thanks conclure
And I have another question
How to kill a player
is there a method or I should set the player health to 0
from what I remember I did rely on pde just fine elgar but yeah using the damage event is definitively less bug prone
If I set the player health to 0 will it trigger PlayerDieEvent*
@austere cove @eternal oxide sorry to bother, but i might not understood where the function is
Thank you!
anyone?
I think you can just spawn a PlayerDieEvent if that is your intent
Can we "spawn" a PlayerDieEvent?
no
no dont
Firing a death event yoruself will do nothing to the player
^
So how to kill a player and triggers PlayerDieEvent
set health to 0
how do people normally deal with return values of file operations? Here is an example:
conditional
i just don't see why i should additionally return or throw an runtimeexception
its kinda just annoying
uh you should
if(!dataFile.createNewFile()) {
//Print out an error to the console
}
wouldn't that trow an ioexception
yeah it should
Returns:
true if the named file does not exist and was successfully created; false if the named file already exists
Or false if the file couldnt be created
from some ioexception
and it throws
but not sure
then it doesn't return? It would throw the exception
need to check
i think it throws the exception actually
the boolean only checks if it exists
i just read docs
yeah. I hope javadocs don't lie there
I usually use the Path api but you could just go ahead and do smtng like
if (!datFile.createNewFile()) {
new IOException("File already created").printStackTrace();
}```
but even so it might not be needed to give the user a stacktrace but simply use Logger#warn or smtng
i kinda like it too, but the bukkit api is just mostly file based and toPath() is another additional step
for the config file?
it takes a reader
Files.newBufferedReader(path, StandardCharsets.UTF_8) or smtng
yeah
I mix those also sometimes lol
hmmm
String
true lol
or you could technically
do smtng like
Files.newBufferedWriter(path).write(config.saveToString());
hm. Yeah you can do everything with paths instead, but in the end the old school file system is a bit more convenient there?
🤷♂️
I mean yeah it might be more consistent using File instead
is there any performance wise improvement?
There's a decent performance increase in deez nuts
Prior to the Java SE 7 release, the java.io.File class was the mechanism used for file I/O, but it had several drawbacks.
Many methods didn't throw exceptions when they failed, so it was impossible to obtain a useful error message. For example, if a file deletion failed, the program would receive a "delete fail" but wouldn't know if it was because the file didn't exist, the user didn't have permissions, or there was some other problem.
The rename method didn't work consistently across platforms.
There was no real support for symbolic links.
More support for metadata was desired, such as file permissions, file owner, and other security attributes.
Accessing file metadata was inefficient.
Many of the File methods didn't scale. Requesting a large directory listing over a server could result in a hang. Large directories could also cause memory resource problems, resulting in a denial of service.
It was not possible to write reliable code that could recursively walk a file tree and respond appropriately if there were circular symbolic links.
from oracle
I mean yeah but File is fine needless to say
🤡
what are difference betweeon com and me
different tlds
what is tlds
Ok
i recommend using io.github.username if you don't own a domain
oops
how to i github domain
oh that is make me very sad
why is com not an option?
github pages made no more redirects for com
and also sonatype and the central disallows it now
you have to use io
it is fine in the extent how bukkit is used where its most likely not used in anyway where it was lacking (oracles justification for replacing it). Quite frankly a spigot developer only uses it to create a file or a directory in which the File class works more than fine
as that is the proper extension for pages
ig
but for big projects 🤡
yeah its not scalable at all
i want to make a plugin that resets a world (e.g. overworld, end, nether) to the latest save a player made by using /save-world command, would this work with unloading the messed up world and loading the saved one?
World w = p.getWorld();
getServer().unloadWorld(w, false);
p.getWorld().getWorldFolder().delete();
WorldCreator wc = new WorldCreator("world");
wc.copy(w);
getServer().createWorld(wc);
this is just a placeholder btw
ignore the fact that wc opies the same world
np
do you own the domain
nope i found it in paper discord
i want to buy the domain
lol
tho it has a pretty shit infrastructure
and people would not put trust in it
due to the free status
but for a mc server it's fine
hm. Just invest some money and use namecheap lol
domains don't cost that much nowadays
except the ones i want to buy
😆
i swear i have seen domains being sold for way more
Anyone knows why when I put player.setHealth(20) in my onPlayerDeath it continues to get the GUI screen "respawn | back to menu"
then try EntityDamageEvent
But it'll trigger when someone get damaged?
So I guess I got to check their life and if it's 0 then reset it to 20?
And in EntityDamageEvent can we get the "killer" with player.getKiller() ?
if (event.getEntity().getHealth() - event.getFinalDamage() >= 0) {
event.getEntity().setHealth(event.getEntity().getMaxHealth());
}```
maybe
and yeah check if its a player also
How do I find the maximum durability for an item?
How do I get every player on the server that has a specified scoreboard tag?
Material#getMaxDurability
It just keps spamming "<name> died" and I have the GUI
?paste
How do I whitelist paste md5 in Malwarebytes ;/
Same error
nvm did it
I mean thats not an error but it keep spamming <name> died & it shows the GUI
p.getHealth() - e.getFinalDamage() <= 0
uh thats weird
Ok no
your things is working
But when you use
p.setHealth(0) in another void to kill the players
the glitch starts
I'll try to be more clear (I'm sorry for my bad English).
I'm making a simple server where people needs to knock in the void other people with a stick. So when someones moves, if his Y position is less than 30, I want him to be killed so I can know who pushed him to the void. If we use p.setHealth(0) it's going to make the glitch. Is there any others option I could use
Well you shouldn't set player's health to 0. There are a lot of options for that.
If you want to keep it basic, you can use HashMap or even metadata(not recommended) to set last attacker.
and not set player's health to 0
what's the the point?
Thanks, that was what I needed.
Is there any good way to get the repair type for an item besides making my own map?
Like diamond for diamond gear?
Can't i use the /kill command?
That's the basic of the Java. If that's the point, I'm sorry I cannot help you.
Ok i'll try to be more clear for other people, how to kill a player without using p.setHealth(0)
an alternative is to deal an magnanimous amount of damage with the damage method
Nvm I found out