#help-development
1 messages · Page 1840 of 1
yes, show me your pom.xml pls
That is it
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.github.grapeapplefruit</groupId>
<artifactId>hahgsdg</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Hahgsdg</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
This one?
yes
I have two, one for the errors and that one.
Yes
come PM for a moment
Ight
Can anyone help with these errors when downloading the api?
Unresolved dependency: 'org.spigotmc:spigot-api:jar:1.18.1-R0.1-SNAPSHOT'
Unresolved plugin: 'org.apache.maven.plugins:maven-compiler-plugin:3.8.1'
Unresolved plugin: 'org.apache.maven.plugins:maven-shade-plugin:3.2.4'```
This is what I came up with @tall dragon
public static void main(String[] args) throws Exception {
double startUpgrades = 1.0, totalUpgrades = 1000.0;
double minimumCost = 100, maximumCost = 3000000;
for (double upgrade = startUpgrades; upgrade <= totalUpgrades; upgrade++) {
double progress = (upgrade / totalUpgrades);
double cost = quadraticBezier(progress, minimumCost, maximumCost, minimumCost);
System.out.println(((int) upgrade) + ": " + NumberFormat.getCurrencyInstance().format(cost));
}
}
private static double quadraticBezier(double t, double start, double end, double intersect) {
double scalar = (1.0 - t);
double firstToIntersect = scalar * ((scalar * start) + (t * intersect));
double intersectToSecond = t * ((scalar * intersect) + (t * end));
return firstToIntersect + intersectToSecond;
}```
It's not fantastic but it does give a slight gradual curve
You might be able to exaggerate the intersect a little more
Oh oops. I put the intersect at minimumCost. If it's set to 0 it's a bit better heh
hmm
Ignored my solution 
It's not great though. There's probably a better curve
Actually I calculated progress wrong
i actually don't think this will solve my problem though. because this will end up much more expensive
im meaning for it to cost 3million for all upgrades together
Oh. $3,000,000 in total
I want 3mil
Ehm, I'm not sure of a great solution to that
i'm tryna make rotation animations for items, but it kinda looks like it jumps as u can see in this clip https://youtu.be/IAeOqvFPFXY
public void rotateStand(){
final PacketArmorStand stand = new PacketArmorStand(player.getLocation());
stand.getStand().setBasePlate(false);
stand.getStand().setInvisible(true);
stand.getStand().setArms(true);
stand.getStand().setRightArmPose(new Vector3f(280f, 0f, 0f));
stand.setTool(player.getItemInHand());
stand.show(player);
new BukkitRunnable() {
int tick = 0;
final double rotationSpeed = 1.8;
final Location center = player.getLocation();
@Override
public void run() {
if(tick >= 360) this.cancel();
final Location center = this.center.clone();
center.setYaw((float) (tick * rotationSpeed + 90.0));
final Vector sphericalVec = VectorUtils.getSphericalVector(0.49, tick * rotationSpeed, 0);
final Vector offset = VectorUtils.getVectorLeft(center, 0.37);
center.add(sphericalVec).add(offset);
stand.setLocation(center);
stand.update();
tick++;
}
}.runTaskTimer(CosmicCore.getPlugin(), 0L, 1L);
}
sorry for the flood
wtf why does it not format
yh but your solution didnt really do what i want either right
hmmm, thats unfortunate. thanks alot of taking the time to try anyway
could be that the Item is falling then it jumps to place?
packetarmorstand is a class I use to manage armorstand animations with packets
kind of a wrapper for EntityArmorStand
stand.update() sends a relative move, equipment and metadata packet
alright but how will this work should the price change to for example 5 million
did the formula i gave you not work yesterday?
it didnt really work how i want it
well then you change that long decimal
ah aight
how will i calculate what it should be
yea i dont want to do that tho
hang on
what if a server owner wants to change the price
hes going to have to brute force it himself
stand gravity false?
then it won't fall the armorstand
the position is sent using packets so even if i stopped "teleporting" it the player would see it standing still in the air
setGravity(false);
lemme try anyways
When it tries to download spigot api it breaks
Can someone help
Could not transfer artifact org.spigotmc:spigot-api:pom:1.18.1-R0.1-SNAPSHOT from/to spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/): transfer failed for https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.1-R0.1-SNAPSHOT/spigot-api-1.18.1-R0.1-SNAPSHOT.pom
did i solve the problem for you? 🙂
Im trying to cancel block break event with a bukkit runnable
However it is not working I've tried setting period & delay to 0
what should i do...
You can’t cancel an event in a runnable
btw i tried using for
nope :c
How to remove all online players from the tab with protocollib?
you need to send playpacketoutinfo
and they must be remove player
or smthing similar
How would I get the player?
I need a WrappedPlayerInfo
But for that I need an entire array of info
what version?
1.8
why don't you use nms?
i tried this :
for (BoundingBox s1box = new BoundingBox(ArenaData.get().getDouble("arena.pos1.x"), ArenaData.get().getDouble("arena.pos1.y"), ArenaData.get().getDouble("arena.pos1.z"), ArenaData.get().getDouble("arena.pos2.x"), ArenaData.get().getDouble("arena.pos2.y"), ArenaData.get().getDouble("arena.pos2.z")); player.getLocation().getX() > s1box.getMinX() && player.getLocation().getX() < s1box.getMaxX() && player.getLocation().getY() > s1box.getMinY() && player.getLocation().getY() < s1box.getMaxY() && player.getLocation().getZ() > s1box.getMinZ() && player.getLocation().getZ() < s1box.getMaxZ(); ) {
e.setCancelled(true);
}
}
i doubt you need version compatibility
if you are coding on 1.8
i don't like protocollib much tbh
I tried this:
private static void removePlayers(Player receiver) {
List<PlayerInfoData> data = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player);
data.add(new PlayerInfoData(gameProfile, ((CraftPlayer) player).getHandle().ping, EnumWrappers.NativeGameMode.fromBukkit(player.getGameMode()), WrappedChatComponent.fromText(player.getPlayerListName())));
}
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
packet.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.REMOVE_PLAYER);
packet.getPlayerInfoDataLists().write(0, data);
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(receiver, packet);
} catch (Exception e) {
e.printStackTrace();
}
}
Doesn't work
i have tried often to use procollib but every time it was painful
how do i get the loop number in a for loop
like how many times the loop went
looping a list
btw
Define an integer and increase it in the loop
if you want to use NMS, this should work:
public void clearTablist(Player player){
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER,
Bukkit.getOnlinePlayers().stream()
.map(p -> ((CraftPlayer) p).getHandle())
.collect(Collectors.toList()));
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
is that necessary
if you use enhanced for loops, yes
yea
else use normal for loops
Or if youre iterating over the whole list…. Just use list.size or whatever
ojk
Nothing will tell you how many times an enhanced for loop ran unless you track it yourself
I have this scoreboard but there are som lines missing
header: "&c&lRetronix"
scoreboard:
- "&7=--------------------="
- "&6>> Rank: {rank}"
- "&6>> Tokeny: {tokens}"
- "&6>> Server: {server}"
- "&7=--------------------="
- "&c&lplay.mcretronix.eu"
- "&7=--------------------="
this is what config looks like
why I cant have two or more repeating lines in it
why
they are meant to display players
and you know a player can't a ppear twice
actually any entity
so how can I get around it?
it is already color coded and I dont want to make that scoreboard any longer
Is there anyone who knows how I set the skin in 1.18 from an EntityPlayer?
The DataWatcher is missing and I cannot find any method.
good idea
Not sure if it will work, but you can try
Edit:
I currently have the skin working (apparently the wrong parameter was given... 🤦♂️ )
But now it does not show the layers. As I do not have the DataWatcher, I have no clue how to solve this.
does this look good now? 😄
Send the error then?
Send ur plugin.yml
Oh yeah well, did you get any other errors?
nothing else
Also how do you build?
maven
No
i click the green arrow icon and it does it for me
idk how
in the tutorial it said that it complies the plugin
Because that sounds horribly wrong
then how?
in command prompt?
And then use the outputted jar from a target folder which gets generated
?
In the terminal
oh
Or with the IntelliJ maven user interface
Well look at the top right
there’s a tab called maven
Just click it and a window will expand
Then run clean
#922968081117114418 plsss
Consecutively run install
you have to expand the Lifecycle
Then fetch the jar from the target folder which gets generated
And then put said jar into your plugins folder
And obviously remove the old jar
hows to get that target folder?
where it located?
Myes
Well that tells you straight what’s wrong
how could i get the block in front of an entity?
Trying to use api version 18 on a 1.16 version
whats wrong?
but when i made the maven prohject
i made it the version 1.16.5
And?
it worked before
If your plugin is minimum 1.18 it won’t work
with that arrow thingy
That’s just an axiom 
whats an "axiom"
Okay but it doesn’t update your resources
axiom is something which is inherently true by itself
No worries neither am I
i dont understand
oh
okay
can you tell how to fix this error?
it was working before
the plugin
just that error
Send ur plugin.yml
name: Alma version: '${project.version}' main: Alma.Tanulas api-version: 1.16 authors: [ ferro31 ] description: tanulas commands: gui: description: Open a GUI
I mean it says something different in the logs but try to put the api version to 1.13
okay
And then run maven clean install
And take the jar again and replace it with the old one in the plugins folder
ok cool
only the error needs a fix
What error?
its not working
Not an error
Any errors?
…
nice
thanks for help
Have a good time (:
Can someone please tell me how to create a team in 1.16+?
And how to let players join the team
Like the /team teams
Isn’t like ScoreboardManager::getMainScoreboard and then ::registerTeam or ::createTeam
Ahh okay
How to remove all players from the scoreboard with ProtocolLib? I tried this but it doesn't work:
private static void removePlayers(Player receiver) {
List<PlayerInfoData> data = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player);
data.add(new PlayerInfoData(gameProfile, ((CraftPlayer) player).getHandle().ping, EnumWrappers.NativeGameMode.fromBukkit(player.getGameMode()), WrappedChatComponent.fromText(player.getPlayerListName())));
}
PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
packet.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.REMOVE_PLAYER);
packet.getPlayerInfoDataLists().write(0, data);
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(receiver, packet);
} catch (Exception e) {
e.printStackTrace();
}
}
help pls
Well
For 1 or 2 blocks tall entities?
Or more?
And entity may have more than a single block in front of it
@royal vale did this not work or you can't use nms?
Wait this is weird. I'm using the current method rn and the following happens:
Server version: 1.8.9
on version 1.8.9: I see the tablist, with myself and the gray/green fake players
on version 1.18.1: I see the tablist, without myself and the gray fake players, but the green ones are black
Don't mind the layout, still developing that
wdym with current method?
your method?
Yes
.
what's the issue? your player being in the tablist?
Yes
probably the packet changed in later versions
If I use this, will it work both versions?
worth a shot
Doing it
Nope doesn't work
does it do the same thing or doesnt work at all
Same thing
Is there a different method for 1.8?
Yea
the packet is the exact same
80 slots, first 40 for players, other 40 for placeholders
pls dont
hmm
i guess you are filling in the slots right?
with fake players
List<PlayerInfoData> data = new ArrayList<>();
for (int i = 0; i < 80; i++) {
WrappedGameProfile gameProfile;
if (i == 0 || i == 25 || i == 40 || i == 60) {
gameProfile = getGameProfile(limeSkinURL, i, "lime");
} else {
gameProfile = getGameProfile(graySkinURL, i, "gray");
}
WrappedChatComponent wrappedChatComponent = WrappedChatComponent.fromText("");
data.add(new PlayerInfoData(gameProfile, 1, EnumWrappers.NativeGameMode.SURVIVAL, wrappedChatComponent));
}
alrightt guess no one gonna help.
Quoting it
and check if the tablist still has you
i'm sorry but i don't know what's that
lol
huh
//
So I don't loose it lol
Also I made a funny mistake at the start
oh oke
someone managed to make a shulker open its lid 5 blocks
Oh so
or something like that
Wait no
Now 1.18 and 1.8 both have players
Ig my player was on slot 81 and not visible
On 1.18
Cuz of ordering or smth
oh yea
whats best way to drop random items not just 1 certain item every time
i'm not sure if you can remove the player itself from tablist tbh
make a list of items you want to be dropped and choose a random one
I did it before so I'm trying which method I used
if that doesn't work, i'm not aware of another method to hide players from tablist
like by making random number then doing if num == 1 drop this
anyways can't help rn, i gtg
or is there better way
how do I make my scoreboard update every 60 seconds using runnable
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); is right, right?
Yep
Bukkit.getScheduler(plugin, () -> {
//code
}, 20L * 60) // 20 ticks * 60 seconds
List<ItemStack> items = Arrays.asList(new ItemStack(Material.WOODEN_SWORD), new ItemStack(Material.STONE));
ItemStack drop = items.get(new Random().nextInt(items.size()))```
something like that
that looks like 1.17 remapped
in 1.18 it's different
Getscheduler().runTaskLater()
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@Override
public void updateScoreBoard(Player player) {
Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
@Override
public void run() {
createScoreBoard(player);
}
}, 0, 60);
}
I have this function, it never reloads
True lol
Yea hes on 1.8
how do i cut the first two args from a command and make the rest a string together
lmao
Ik it's outdated but the whole game is based around 1.8
Make a for loop with a stringBuilder
copy the array without the first 2 elements, then use String.join
or this
so?
Start the for loop with index 2 or whatever u wwnt
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
createScoreBoard(player)
}, 0, 20L * 60);
Intellij automatic
Or
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
createScoreBoard(player)
}, 0, 20L * 60);
I have managed to create a Team Using Scoreboards and managed to show a suffix+prefix+Color in the Tablist using it. On the other hand, it doesnt appear in the Nametag above the player. Is this a feature, or what did i do wrong?
player.setCustomName();
Thanks
Not sure if that works
Actually I don't think it will work
String.join(" ", args[2]) removes arg 0 and arg 1? so everything after is one string
@tender shard
i want everytihng after arg 2
to be one string
string join is shorter
Or use ::runTaskTimer (:
help pls
so?
Entity#getTargetBlock()?
so i cant figure out how to tell if maxhealth is 0
bad if... diehealthdone is a boolean, int?
it is a double
max health 0?
im recreating i lifesteal basicly
then if (variable == 0) {
i'm wondering too
I think it must be a positive value
so if they have 2 health left and i have it go down 2 will it go to 1 cuz it cant go any lower
then i can do this
That won't work
oh i know
StringJoiner joiner = new StringJoiner(" ");
for (int i = 2; i < args.length; i++) {
joiner.add(args[i]);
}
String str = joiner.toString();
Why do that when you could do
String joined = Arrays.stream(args).skip(2).collect(Collectors.joining(" "));```
Though you should clarify whether you want the argument at index 2 to be included
If not then change skip from 2 to 3
because not everyone likes lambda
Much cleaner though
Also there are zero lambdas in this code
So even if you don't understand lambdas you can understand what's going on
It creates a stream from the array, skips the first 2 elements, and joins the rest to a string delimited by spaces
perspective on that. Just because there is more lines does not inherently mean bad. Its like compressing pictures. You can compress all you want, but you lose information in the process of doing so. What you posted is alright as I do understand it. But I am sure you get the point though 😛 anyways continue on with providing your help XD
I think there's value in verbosity sometimes
And it's true that compressing the code down with streams can make it hard to understand
I do believe there is a balance between the two
But in the case of very simple operations like this, where you're joining all but the first 2 elements to a string
The verbosity is not necessary to understanding
exactly
So you shouldn't use streams for everything but they are definitely much cleaner for this
anyways that is my two cents worth until next year 😄
No reason to write so much more than is really needed
Quick question: I am trying to create a method to insert different values into my MySQL database table. This has also worked well so far. However, I have now added another column to the data table that is not to be filled by the method and accordingly can also have the value null. Since this column exists, I now get the following error message when trying to insert values there:
java.sql.SQLException: Field 'chunkid' doesn't have a default value
chunkid is in that case the table column I mean. Does anyone happen to have an idea what I might have done wrong?
is the new column called chunkid?
How can I summon an ItemFrame on a clicked block face instead ins8de of the clicked block?
if so, then it is saying that column can not be empty and requires a value, even if its just NULL
Use Block#getRelative
You can get the relative block for the face that was clicked
So e.getClickedBlock().getRelative();
getRelative(event.getClickedBlockFace())
Group chat?
like if a person clicked enter in a text field, it will get that text and send it to the other people with the app open
Yeah sort of
Hmm with java?
Yes
I believe Java has a datagram channels api you could look into
my first idea was databases but there is no events or listeners for when a new data is there
oh
Or like udp api
generally a centralized server
udp can have packet loss
so tcp is a bit better imo
It can have yeah
so is there a best option
I'd just have a domain (ips can change so dns handles that) that contains the chat backend
and the client would connect to that domain via a socket
and magic happens
only thing is I don't have a single clue on how to do that
I have 0 experience with sockets and packets and all that
well probably not 0 but very low
You can start by just trying to write a Socket ServerSocket mock system
Assuming you’re still going with Java
Yes I will use java
honestly im googling that and it doesn
t look promising
You would have to compare the item from the event to the main hand and off hand
super easy to create such a thing, however what would be better here is a restful api for your chat app. The restful api, can then communicate the payload to the MC server as it comes in. Obviously need a custom plugin, and that plugin not only receives the chat, but does the opposite and sends the chat back to the restful api server. Using a restful api solution lets you use normal webserver here. Or you can optionally create your own which I don't advice because I assume you want logins/security?
i suck at this
um what
uh this isnt a plugin
yes
Well, this channel is for programming related questions 
Well yes, but in relation to spigot though
not some random applications XD
the basic premise of creating a chat app @grim ice is the chat app itself, a server that receives and sends the messages. The server doesn't need to be created from scratch and again don't recommend it. What I said earlier still applies. Use a restful API setup which you have to create yourself. Just don't need to create the server it runs on from scratch. If you make that, it will make a lot of other things more easy to manage especially with keeping security in mind. If you want to do this in java, you could make use of Apache Tomcat or Jetty. Recommend Tomcat.
uh okay
the reason people can use things like %s is because the plugins are coded to handle those custom markers for formatting and then translating them to appropriate MC format. There is format API you need to make use of to re-format the string before sending
you could yes, but if you want to maintain the formatting you are going to have to parse the text to remove those things you see and/or apply the formatting expected. Or you can just strip those things all away. String has replace function and some other functions to make it easier to do things with strings 😛
Is there a way to remove the velocity from spawned particles?
get the particle and set its velocity to 0
They aren’t entities
There is a speed value in the spawnParticle method, setting it to 0 should work
Right forgot they are not entities XD
you can start with easy methods if you are just looking for an easy thing to create/understand. However if you are making something legitimate that you intend for others to use, then you are going to want to learn what restful api is and how you would create one.
restful apis can be ran on any kind of server you want, since you have to pretty much create it yourself.
I can't seem to find ot, but thank you anyways
It really depends on if you need chat history or not
Look at the javadocs
If you don't need chat history to be stored it's incredibly simple to create a chat server and client
Otherwise it's more complicated
well the reason I say restful api is because it makes it easier to store the chat to then send off to others
without compromising security
not necessarily for chat history although it can be used for that too
on bungee how can i modify commands sent to client?
in other words you don't need to program into the chat app credentials to the logging server for the chat 😛
Done it, isn't documented (or I did not see it) but it's after the offset values
Thank u
public void addNBT(final Entity entity, final String value) {
net.minecraft.server.v1_12_R1.Entity nms = ((CraftEntity) entity).getHandle();
NBTTagCompound nbt = new NBTTagCompound();
nms.c(nbt);
nbt.set("Pose:", new NBTTagString("Head:"));
nms.f(nbt);
}```
I have this method of adding nbt to entities, my goal is to take your nbt from this value and add it to another nbt, how could I do that?
Example: **addNBT(value)**, the purpose of doing this is to change the position of the head of an armor stand instead of using the .setEulerangle() methods
use nbt api or smth
and be aware that you can only use vanilla tags for (tile)entities
but i think it is already an vanilla tag so
Config
For data that's not going to take up all that much space and won't change often, config makes sense
Why is protection 20 same as prot 100??
Because the cap is 12
when is an itemstack's item meta null?
what it's air i guess
When it’s air
https://paste.md-5.net/mosarugene.nginx
Im so confused, the top one works, but the bottom one doesn't
is that the only case
yea pr much
ok good
i think the Waterlogged interface is broken
am i doing it wrong
cus it looks fine to me idk
oof everyone disappeared
Shouldn't it be Waterloggable
Oh I guess not
Slab extends Waterlogged
So casting to Waterlogged should work fine
Won't work as in what
What is the expected behavior and what is the observed behavior
the observed behavior is that any line of code after that one in the if statement doesnt run
including it
No errors?
let me look at them again
https://paste.md-5.net/bereriveya.bash its spamming this in the console
Can you show more code
Cause it seems like you are casting the wrong thing
MaterialData is not BlockData
Origins v${project.version} lol
Waterlogged data = (Waterlogged) block.getState().getData();
everything works perfectly until u introduce that line
This is your issue
wait let me fix that
You need to do block.getBlockData() not getState().getData()
getState().getData() returns a MaterialData
Which is not the same as BlockData
same exact error
let me paste
waitwait
nvm new error https://paste.md-5.net/ayununesih.bash
still being spammed as well
Waterlogged data = (Waterlogged) block.getBlockData();
Looks like you are trying to cast plain water
I assume that’s what CraftFluids is anyway
Block block = player.getLocation().getBlock();
yeah but idk why its doign that
i didnt
anyways here is the updated if statement, for good measure https://paste.md-5.net/fizavifide.rb
Waterlogged data = (Waterlogged) block.getBlockData();
You should really do a check before casting
If you're using java 16+ you can do
if (block.getBlockData() instanceof Waterlogged waterlogged) {
waterlogged.blahblah();
}```
No you're clearly casting before you do the check
You cast and have a check further down
dude its for testing
its not the actual code
it doesnt every work with the check
im keeping the lines that are commented to retest
wdym
im showing the problem at its core
if I uncomment all of the unnecessary stuff its more to look at
like it literally will not run anything after that line including the line itself, idk what im doing wrong
i thoroughly test things before asking here
and im using jdk 17 btw
@earnest tulip
@CommandHook("test")
public void test(Player player) {
Block block = player.getLocation().getBlock();
block.setType(Material.STONE_SLAB);
BlockData data = block.getBlockData();
Waterlogged w = (Waterlogged) data;
w.setWaterlogged(true);
block.setBlockData(data);
}```
This code works perfectly for me
Clearly it's not a problem with spigot, you're doing something wrong
I would guess it's the name of the command
Is there a way to use the //fill command through Spigot's API?
i need the name of plugin
Why
don't why me, if u know how tell me
Oh my god
Answer the question
I'm trying to help you
Why do people insist on refusing to answer basic questions when asking for help?
ok fine im trying to get a command owner by name
owner is the plugin
its ez on spigot i mean PluginCommand
Yes but it won't work unless you run it on a player who already has a WorldEdit selection
so... What's the code? Couldn't find anything about it online
Bukkit.dispatchCommand(senderHere, "command here excluding leading slash")
@waxen plinth every year, always rude people 😩
To send a command from console you can do Bukkit.getConsoleSender() as the sender
Otherwise you can pass a player
kk thanks
I am creating a shapeless recipe that takes two ingredients, an iron nugget and a dragons breath. Upon crafting and receiving the item, the crafter also gets an empty bottle. I'm confused to why this happens, but it seems to be related to the dragons breath being one of the ingredients.
Upon debugging, I can't see any mention of the glass bottle being there. Does anyone have any idea?
I'm not familiar with the bungee api but check the interfaces the target command implements
command implementation does not include the plugin
Bukkit has PluginIdentifiableCommand, you can print out the interfaces with .getClass().getInterfaces() I believe
Okay then you'll probably need to iterate over the bungee plugins and get the info from their bungee.ymls
Certain crafting ingredients return something when used
Milk buckets, bottles, etc
They return the empty container because they assume the "contents" of the item is being used
I don't know if there's any way around it
I get that, but I was surprised that dragons breath had that given that it doesn't have any "crafting" recipes.
¯_(ツ)_/¯
uhh bungee.yml never included commands...
hi guys how to get player inventory?
o thanks
How are they defined then
If they have fallback prefixes you could go based on that
registered using the api
bungee doesnt do that (looks like)
ye
when time to register i pass the plugin not in constructor
Do
JarFile file = new JarFile(new File(command.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()));```
This would give you the jar of the plugin
Then you could get the bungee.yml entry to get the name of the plugin
It's ugly but it seems like there isn't a better way
isnt there Plugin#getName?
Well you can't get the name of the plugin through that
You can get the jar the command is defined in
But not the name of the plugin itself
So you'll need to look inside the jar in its bungee.yml to grab the plugin name from that jar
Is there a way to get all events that are fired?
does that block the thread?
Since I'm not familiar with bungee it's entirely possible there is a better way but I don't see another right now
Yes but it's not slow
Why would you need to do that
I want to see what events aside from CraftItemEvent fired
When I craft the item
i mean who knows when this will be called, im afraid of slow loading, i use packets so this would go worse
InventoryClickEvent and PrepareItemCraftEven I believe
Then do it async
I mean you only need to do it once
i think im going to cache them
ye, i need the proxy ready event lol
Or better yet a map from the jar names to the plugin names
is it fine to do this on enable?
Sure
i mean plugin jars should have been enabled
also idk how to read yaml at all, what does bungee use
I'm curious
what is getProtectionDomain()?
i have snakeyml as dependency for another library
I've seen it a few times but honestly I don't know what it refers to
ye I know
dang I was like half right
yeah it's part of java.security
aaand
protection domains allow you access to code sources
which are basically just URLs + certificates & signers
how do i get intellij to stfu
go over the method call
Alt+Enter
go over to the warning
suppress for statement/method/class
Alternatively, you should probably store that into a boolean and use that in your logic
that would be the proper way
If !file.mkdir(), I mean, you're going to have to catch a SecurityException, right?
is there a way to make a 1.16 plugin work on a 1.17.1 server?
the two should work fine
I think
Java is decently backwards compatible and unless the plugin uses NMS then the versions should be fine
full error?
I'd rather that exception gets thrown and stops loading of the plugin, since it is an error that I don't intend on handling.
I actually throw a SecurityException purposefully if a dir doesn't get created most times
Could not load 'plugins\UberEnchant.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.18
at org.bukkit.craftbukkit.v1_17_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:358) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:414) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:322) ~[patched_1.17.1.jar:git-Paper-391]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:419) ~[patched_1.17.1.jar:git-Paper-391]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:287) ~[patched_1.17.1.jar:git-Paper-391]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-391]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-391]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
thats the problem
the .yml doesnt load
bc afaik there is no additional API for 1.18
so just use fucking 1.17 like I said
Where?
Looking here, it looks compatible for 1.18, is this not what you want?
Ohhh
THATS WHAT I AM USING
wElL Ya DidN'T MaKE thaT cLeAr
u didnt ask lol
also shouldn't you be in #help-server?
There is no getEntry() or Simmilar
i cant get the classloader of class it just gives null
Im confused
or use the actual Java nio api
yes, this is preferable
although NIO can be kind of a bitch sometimes
but it is better
NPE on getLocation()
is there a plugin that lets me bypass 255 enchants?
That sounds like a basic minecraft limit, you'd need a mod methinks
Can you not just check the weather of the world when handling an event
it was changed due to NBT changes
the data type for it changed
Still saved as a short
How would I turn a json formatted string into a chat component that I can send to a player as a title?
thought chat components accept JSON o.O
Doesn't look like there's a way to load one from json
I want to make something where I can use any method within the Player.java class in game. Is this a good use case for Java reflection?
Via commands I can use it I mean
Yes, or use MethodHandles
which are probably better in this case when executing the methods cause its faster
Sure there is, ComponentSerializer
Caching entity location
?
It doesn't look like titles take components though
The methods on the player entities only take strings
hello again, Vatuu
How would i check if a value of an attribute is null
Sup
since .getBaseValue returns with a double and i cant null check it
if its never null but instead can be 0, check for a 0 then
but all objects in Java can be null checked though
Well i tried to do
just without base value
but it wouldnt work
and would always catch on the null
tried to do what? o.O
Im using creaturespawn
and whenever a 50% chance is made
i want to change the creatures attack speed
which im trying to do with attributes
but the attribute constantly returns null
why not instead of doing this the hard way
well hmm I think attack speed is only changed via attributes
public void onCreature(CreatureSpawnEvent event) {
LivingEntity creature = event.getEntity();
if (creature instanceof Monster) {
Random ran = new Random();
int n = ran.nextInt(2);
if (n == 1) {
System.out.println("This is n " + n);
if (creature.getAttribute(Attribute.GENERIC_ATTACK_SPEED).getBaseValue() =! 1.0);
System.out.println("returned");
return;
}
Random rann = new Random();
int f = rann.nextInt(5);
System.out.println(f);
I used to try checking
== null
but u cant null check primitives
and without getBaseValue() It would always return null
i think
lemme check again
I was wrong
it doesnt return null
but then it returns null later and causes an error
then probably need to add some debug code to see where it goes null later
Any time i call getBaseValue()
why are you needing to grab info from the armorstand?
Does attackspeed usually have base value
well it has a range. Not all entities have the ability to attack
usually when dealing with doubles when it comes to ranges, the max range is usually 1
and then lower speeds being less then 1 like 0.5
Hi! I'm making a spawners plugin, how to check if there is a spawners block 5 blocks away
"block" is my block in the event ( Block block = e.getBlock() )
Finding it apparently its an only player attribute
it shows up for mobs but theres no base value
you are going to have to iterate through the blocks in the surrounding location. A bounding box can sometimes be what you need for this.
Hi guys! Does this make sense? I want to increase how much food is given to someone if they eat in direct sunlight. I'm especially curious about the event.getItem() call; is that a good way of determining if someone is actually eating something?
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerEat(FoodLevelChangeEvent event)
{
// If it's a player that eats the food
if (MUtil.isntPlayer(event.getEntity())) return;
Player player = (Player) event.getEntity();
UPlayer uPlayer = UPlayer.get(player);
// and the player is at least a level 2 Qadir
if (!abilityCheck(uPlayer, 2)) return;
// and the light level where the player is standing is high enough
if (player.getEyeLocation().getBlock().getLightFromSky() < ConfigQadir.get().heatAdaptabilityFoodIncreaseLightLevelMinimum) return;
// and it's daytime
if (player.getWorld().getTime() > 12000) return;
// and they are actually eating something (like food or a potion of saturation)
if (event.getItem() == null) return;
// And the food level would not exceed 20 already
if (event.getFoodLevel() >= 20) return;
// Set the amount eaten higher
int resultantFoodLevelAfterModification = (int) (event.getFoodLevel() * ConfigQadir.get().heatAdaptabilityFoodIncreaseMultiplier);
// If the resulting modification is 20, we will fully fill the player's hunger bar, otherwise, we will give them the amount that they'd get after the modification
event.setFoodLevel(Math.min(resultantFoodLevelAfterModification, 20));
}```
best way is to use reflection to hook into the network protocol and simply stop the packets going to which ever players you don't want to be able to see the entity, or modify the packet to those players and have it set that the entity is invisible.
well I don't really know of another way without using NMS
there is a few packets that players get that have something to do with entities too
Well I suppose the alternative is making use of scoreboard and teams
yeah then there is no other way I can think of since other then scoreboard and teams, there really isn't a method that exists for setting entities visible or invisible on a per player basis
In 1.18 there is Player#hideEntity
would Caching entity location do anything
is there a way i can reset my pom.xml on my kotlin project
it's all sorts of messed up
.
So when you run some plugins on decompiled CraftBukkit anything using reflection crashes because there is no NMS version in the package names. Anyone got around this?
Is there an event i can use to check when a player move chunks, im trying to temporarily delete all stone in a chunk when a player is on that chunk
You could do that with PlayerMoveEvent
Just get the chunk in getTo() and the chunk in getFrom() and compare them
If they're not the same then the player has moved chunks
you could use reflection on the reflection XD
Lmao
Man, I need to test some stuff with skins that requires two players, but I can't run offline servers because then skins disappear and I don't have a second MC account lmao
then e.setCancel or something similiar (e is event you may ask)
How to cancel the BlockPlaceEvent event?
e.setBuild(false)?
e.setCancelled(true)
just use fake players then
dont have setCancelled
?
is setBuild
Optifine lets you define custom item icons based on NBT data, so I had been setting NBT via nms in the past, despite using PersistentDataContainer for actual plugin mechanics. With the changes to nms referencing in 1.18 I don't really want to do this anymore. Does anyone know if there's a way to reference PublicBukkitValues in the custom item textures formatting in Optifine, or alternately, is there an in-API way to set a custom nbt value now?
yeah
but people still prefer optifine cit
because for some reasons idk
i forgot
why
Can anyone think of a reason that one of the NMS methods isn't being remapped? 
The class is remapped, and other methods/fields are remapped, but this one in particular just isn't, and it was in the past I think
Some respacks with Optifine features have items with hundreds of sprites, it also supports 3D models and animation
I'm using Mojang mappings for development, the issue is when it remaps back to Spigot's mappings.
It's ignoring some of the methods for some reason. It's happened twice now, so I assume I've just done something wrong 
It's odd that some of the methods and classes get remapped and some don't though. I can find them all in the mappings files. 
oh you mean the files when u use the classifier or something it didnt remap everything?
Yeah, it's not remapping everything
Yeah it's weird 
so theres must be errors when you run the plugin right?
Yeah, I get NoSuchMethodErrors
maybe you should give the pom.xml
im just gonna narrow down the issue, i dont use 1.18 so idk 😦
I'm using Gradle
i thought there are no plugin for gradle?

Did you remember to change from 1.18 to 1.18.1
Yes
Well you haven’t otherwise given much info
And I always use that variable
https://paste.md-5.net/tijekoxija.bash
That's the gradle task. The methods I've noticed aren't being mapped are
BlockPos#getX should be BlockPosition#a but maps to BlockPosition#getX
BlockState#getProperties should be IBlockData#s but maps to IBlockData#getProperties
You don’t include the jar in your classpath
Check the example commands in the thread again
Yeah, I tried re-adding them and it didn't seem to make a difference. I'll try it again.
Nice gradle config though
You can also use the specialsource from maven repo rather than tooling dir
Oh interesting, once I get this fixed I'll do that
https://paste.md-5.net/omesuyeguk.bash
Am I separating them wrong or something? Can't seem to get it to work.
Read the example
What character does it use?
Yeah I used a colon and got yelled at 
What yelled?
cant seem to find the old forum threads for my problem. how would i push a player forward according to their direction?
Is this the best channel to ask for help on setting up a spigot server?
no that would be #help-server
Step 1: download whatever version of spigot jar you want
Step 2: stick it in a folder
Step 3: make a file calledrun.bat
Step 4: click the file and click edit (in notepad)
Step 5: enter this in the file:
java -Xmx1G -DIReallyKnowWhatImDoingISwear -jar (name of whatever your server jar is, including .jar) --nogui
pause```
> Step 6: Run the jar. It'll fail the first time because you have to accept the EULA
> Step 7: Open the file named EULA, and change `false` to `true`
> Step 8: Run the run.bat again.
> Step 9: Connect to your server in game with the ip: `localhost`
I wouldn't give that flag to newbies
what flag
-DIReallyKnowWhatImDoingISwear
oh ye
Doesn't it just yell at your for using outdated versions
If you don't put that I mean
is there a way to create a custom PotionEffectType?
Moving to the #help-server
id have to give a custom PotionEffect?
im not sure
i got frustrated the first time i messed with potions and havent touched them since
the docs were confusing
Why is this so hard to do :/
imagine download spigot jar directly bruh
buildtools first
How can I list a full raw config.yml? I just want it's content fully raw
I am pretty sure it's possible If I can get the full path to a config.yml but I doesn't look as if spigot supports that
Not without a lot of hackery
A custom potion effect type? Like what? @winged anvil
For a custom potion effect you cannot do it afaik. You can create a BukkitRunnable function with a timer and the custom effect you want and display the time remaining and the effect name in the chat, tablist, scoreboard and or the thing above the hotbar.
any ideas why EntityExplodeEvent works fine in one world but not another? ExplosionPrimeEvent is fired, but not EntityExplodeEvent. Mob griefing is on
Another thing to note is that it works fine in 1.8 and 1.16, but doesnt work on 1.12. Any ideas or what a workaround might be?
This looks like a bug in 1.12 to me. Can you show your code?
@EventHandler
public void fireballExplode(EntityExplodeEvent e) {
System.out.println("explode!");
}
@EventHandler
public void fireballPrime(ExplosionPrimeEvent e) {
System.out.println("prime");
}
prime is printed, but not explode!
What entity were you testing it with?
fireball
Isn't fireball ProjectileHitEvent or something with projectile?
Yea it seems so. Try it with a creeper
it works fine with a ghast fireball in the nether
Pretty sure you go to use ProjectileHitEvent for fireballs. AFAIK the spawned in fireballs might be different than Ghast fireballs.
the same code works fine on 1.8 and 1.16. just not on 1.12 for some odd reason
ill test the spawned in fireballs in the nether
AFAIK the fireballs don't actually explode by default.
It just produces fire
Using ProjectileHitEvent check if Projectile is a fireball create an explosion then you should have a exploding fireball and then you can check it using EntityExplodeEvent
/summon Fireball ~ ~3 ~ {ExplosionPower:50,direction:[0.0,0.0,0.0]} use this command to summon a fireball in the overworld and check if the message comes
Soo any of my methods worked?
im working on it
how to set the mob type in itemstack spawner
#4 reply of that should work
ok, looks like i can actually detect it with ProjectileHitEvent, thanks
any idea how to make the fireball do the explosion without manually spawning in one?
ig worst case i could just remove blocks manually but eh
weird that it works fine in 1.8 and 1.16, but is all funky on 1.12
Detect it with ProjectileHitEvent and the create an explosion.
yea thats what i want to avoid
World world = e.getWorld();
so nothing other than that?
nope
ok, guess ill remove blocks manually then
But why?
.
its fireball with custom knockback and damage
spawning an explosion will mess that up
Why not just create a manual explosion with no power
if no power, how break blocks?
Or mitigate that damage and knockback
then theres also the issue of having two explosions (and sounds)
Using something like PlayerDamageEvent and check if the damage is explosion damage if it is cancel the event
that should mitigate the knockback and damage
yes, but theres still the sounds
Does someone know why is this returning true
int upgradeLevel = petPlayer.getUpgrade(upgrade.getName());
System.out.println("Max Level: " + upgrade.getMaxLevel());
System.out.println("Player Level: " + upgradeLevel);
System.out.println("upgrade.getMaxLevel() >= upgradeLevel = " + (upgrade.getMaxLevel() >= upgradeLevel));
Log:
[13:27:44 INFO]: Max Level: 10
[13:27:44 INFO]: Player Level: 1
[13:27:44 INFO]: upgrade.getMaxLevel() >= upgradeLevel = true
because the max level is greater than the player's level. > mean greater than
Yea there is that. You can ask the players to turn down explosion sounds in the settings or you could create a custom texturepack with that sound not added (bad idea) or you just manually remove the blocks
oh right, i'm so dumb lmao.. a lot of going on on my mind xd
ig ill just manually remove the blocks, thanks
happens to me too 😄
can anyone hop in a call and help me with my pluigin
Cannot go in a call but can help in chat
k
args 9?
oh
what if I want to count the whole word
like give = args 0 ig
and player = args 1
args = stuff after the initial command
args fullform = arguments. Which is the stuff after the initial command
if(Bukkit.getPlayer(args[1]) == null) {
sender.sendMessage(ChatColor.RED + "player offline");
}```
trying to make a command /give (player)
if(args.length == 1){
if(Bukkit.getPlayer(args[0]) == null) {
sender.sendMessage(ChatColor.RED + "player offline");
}
The (player) is args.length == 1 but it's args[0] if you know what I mean.
oh got it
thanks
ItemMeta Spawner_meta = Spawner.getItemMeta();
Spawner_meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&e&lDragon Spawner"));
ArrayList<String> Spawner_lore = new ArrayList<>();
Spawner_lore.add(ChatColor.translateAlternateColorCodes('&', "&a&L| &7Test"));
Spawner_lore.add(ChatColor.translateAlternateColorCodes('&', "&a&L| &7Test2"));
Spawner_meta.setLore(Spawner_lore);
Spawner.setItemMeta(Spawner_meta);
Bukkit.getPlayer(args[0]).getInventory().addItem(Spawner);```
When I try to run, it gives this error in console
at frolic.dragonspawner.commands.SpawnDragon.onCommand(SpawnDragon.java:24) ~[DragonSpawner-1.0.0.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]```
Does Material.ENDER_PORTAL_FRAME exist
also rename Spawner to spawner so you don't get a class when getting something
ItemStack spawner = new ItemStack(Material.ENDER_PORTAL_FRAME, 1);
ItemMeta spawner_Meta = spawner.getItemMeta();
spawner_Meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&e&lDragon Spawner"));
ArrayList<String> spawner_Lore = new ArrayList<>();
spawner_Lore.add(ChatColor.translateAlternateColorCodes('&', "&a&L| &7Test"));
spawner_Lore.add(ChatColor.translateAlternateColorCodes('&', "&a&L| &7Test2"));
spawner_Meta.setLore(spawner_Lore);
spawner.setItemMeta(spawner_Meta);
Bukkit.getPlayer(args[0]).getInventory().addItem(spawner);
}```
same with everything else and follow @winged anvil advice
ah The problem is with the item End portal Frame
