#help-development
1 messages Β· Page 1377 of 1
sure why not
package com.deathlimiter.main;
import java.io.File;
import java.io.IOException;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
private static Main main;
public File ymlFile;
public YamlConfiguration ymlConfig;
@Override
public void onEnable() {
System.out.println("[DeathLimiter] Loaded.");
Bukkit.getPluginManager().registerEvents(new onDie(), this);
getCommand("resetdc").setExecutor(new resetDC());
getCommand("setdl").setExecutor(new setDL());
initYaml();
}
public File getYML() { return ymlFile; }
public YamlConfiguration getYmlConfig() { return ymlConfig; }
public void initYaml(){
saveDefaultConfig();
ymlConfig = (YamlConfiguration) getConfig();
}
public static Main getMain() {
return main;
}
}
π€· should be fine, thought you should read up on Dependency Injection ;)
lets https://tryitands.ee
getConfig() returns a FileConfigurations so use a FileConfiguration not a YamlConfiguration
no casting
Yeah, I would also advise against casting
casting it wont do anything to it
Other than a ClassCastException
it extends FileConfiguration
The implementation might have it as a YamlConfiguration right now, however in the future it might lead to very hard to debug exceptions
If you cast a FileConfiguration to a YamlConfiguration it will throw a CCE
package com.deathlimiter.main;
import java.io.File;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
private static Main main;
public File ymlFile;
public FileConfiguration ymlConfig;
@Override
public void onEnable() {
System.out.println("[DeathLimiter] Loaded.");
Bukkit.getPluginManager().registerEvents(new onDie(), this);
getCommand("resetdc").setExecutor(new resetDC());
getCommand("setdl").setExecutor(new setDL());
initYaml();
}
public File getYML() { return ymlFile; }
public FileConfiguration getYmlConfig() { return ymlConfig; }
public void initYaml(){
saveDefaultConfig();
ymlConfig = getConfig();
}
public static Main getMain() {
return main;
}
}
```like this?
Similaraly, if you cast an Integer to an ArrayList it will throw a CCE despite it being both an Object
You can cast them to Object though
YamlConfiguration extends FileConfiguration
integer and arraylist analogy isnt the same scenario
thats like saying you cant cast a list to an arraylist
Integer extends Object
yeah i was saying you can, the example is flawed
Vector is the best example for that
You can cast a YamlConfiguration to a FileConfiguration, not the other way around.
You cannot cast a Vector to ArrayList
(though for that no cast is needed as the java language automatically does that)
how can i get statistics?
declaration: package: org.bukkit, interface: OfflinePlayer
Hello,
Im still stuck on my gradle issue but i progress.
Now the project compile but i just need find the good configurations for shadowJar
Currently i have jetbrains annotations in my jar but i think i don't it.
And how i can publish an shadowed version for the api ?
My project : https://github.com/orblazer/gradle-bug
Thanks by advance
So how do I fix the plugin AuctionHouse because whenever I join my server (Deop) or anyone else joins my server the /ah, auction house gives, "you do not have permission to use this command!" But when Oped it works perfect no problem any help someone could give?
Give the correct permissions and ask for help in #help-server
Any idea what's the offset between armorstand foot and it's display name
wym shadowed version
an jar with dependencies like configurate or acf (not included right now in the github project)
but after thinking its probably useless because the dependencies is always declared
You can declare a dependency twice under two scopes iirc
you wanna shade in configurate and acf?
frame.getPersistentDataContainer().set(holoDisplaykey, PersistentDataType.STRING, Utils.holoLocationToString(frame.getLocation(), signLocation));
System.out.println("frame was given key");
frame.getPersistentDataContainer().set(holoTypeKey, PersistentDataType.STRING, "item");
frame.setVisible(false);
frame.setInvulnerable(true);
frame.setFixed(true);
UUID frameUUID = frame.getUniqueId();
new BukkitRunnable(){
@Override
public void run() {
Entity checkFrame = Main.getPlugin().getServer().getEntity(frameUUID);
if (checkFrame != null){
if (checkFrame.getPersistentDataContainer().has(holoDisplaykey, PersistentDataType.STRING)){
System.out.println("frame has key!");
} else {
System.out.println("frame has no key.");
}
} else {
System.out.println("the frame no longer exists");
}
}
}.runTaskLater(Main.getPlugin(), 100L);
I'm trying to save some data in an item frame entity but it seems like it keeps disappearing shortly after, anyone have a clue why?
using this same code on armor stands works but on item frames its just inconsistent for some reason
yes for shared the version in my other project and have an util method like an ConfigurationManager for case of configurate
I mean its just unclear what you want
for the api (i keed only that module for clear explain), i want only include that part in my other plugins like an lobby plugin.
And if i shade the common dependencies i can have an util methods like i have said for configurate and reduce the plugins sizes
After its propably not the best but i don't know how i can make other way ^^
Idk still what you need but use the shadowJar plugin to shade in and then declare your module as implementation in the project that is responsible for producing the final jar
ok so in shadowJar i need use configurations = [project.configurations.implementation] ?
anyone aware of a method of scaring animals without using LivingEntity#damage as that knocks them up
vanilla entities, so cant set ai
im still confused ^^ and the doc of shadow plugin is not updated for gradle 7
can you just try to explain what exactly you want? I am sorry but your explanations so far have been quite dim and confusing
Anyone know any good json config api?
configurate
ok, sorry i don't know every word in english π but i can try in other way.
- I want to include in my
core-apithe common methods for the other plugins likeconfigurateand so have an util methods like anConfigurationManagerfor easier make the plugins - The
coreis for implement the methods like an database manager - So in my
lobbyplugin (for example) i want includecore-apiand so have an easy way to have configuration like i simple useConfigurationManager.createand no remake everything in all plugins
does anyone understand this behaviour with item frames?
https://cdn.discordapp.com/attachments/551613805176815655/831826052963631104/unknown.png
https://cdn.discordapp.com/attachments/551613805176815655/831826103365533746/2021-04-14_11.37.38.png
https://cdn.discordapp.com/attachments/551613805176815655/831826216746745876/unknown.png
https://cdn.discordapp.com/attachments/551613805176815655/831826239110774799/2021-04-14_11.38.59.png
do one of these options "reset" the item frame properties or something?
its also unable to store the keys i gave it with persistent data container
and if you prefer with dependencies specifically :
core-api:configurate: can used in other project (plugins)acf-paper: can used in other project (plugins)acf-bungee: can used in other project (plugins)
core-common: implement all common methods for bukkit and bungeecordcore-bukkit:paper-api: provided (so not included in final jar)
core-bungeecord:waterfall-api: provided (so not included in final jar)
So the plugin (the final jar builder) : include core-api, configurate (relocated), acf-* (relocated), core-common, core-bukkit, core-bungeecord
But maybe my logic is wrong and maybe could not work due to relocation. Im really confused with the relocation (i prefer use an custom plugin system in JavaScript and im really more comfortable ^^)
maybe its setItem or setFacing try to move options after each and look when that work
thats kind of the weird thing though because that seems to be the case for setvisible, setinvulnerable, setfixed, but not for persistent data container
the persistent data container is never saved
How would I teleport a player between worlds without multiverse. I've tried player.teleport(Bukkit.getWorld("worldname").getSpawnLoaction() but it doesn't work
well maybe it is, but it seems to reset shortly after
i have never try the persistent data so i can't help with that
its generate an exception ? because that its right
Wait there i'm going to see if I can create some tests without a ui at the moment
Then I'll tell you if there is an error
@olive badger Here is the code and error so far
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (event.getView().getTitle().equals(ChatColor.DARK_GREEN + "Select a game!")) {
event.setCancelled(true);
if (event.getCurrentItem() == null) return;
if (event.getCurrentItem().getItemMeta() == null) return;
if (!event.getCurrentItem().getItemMeta().hasDisplayName()) return;
if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.GOLD + "" + ChatColor.BOLD + "Knockback Arena!")) {
//new WorldCreator("knockbackArena").environment(World.Environment.NORMAL).createWorld();
player.sendMessage("Test");
player.teleport((Bukkit.getWorld("knockbackArena")).getSpawnLocation());
player.closeInventory();
}
}
}
error:
Could not pass event InventoryClickEvent to WolfPVPMain v1.0
org.bukkit.event.EventException: null
I'm sure its because of this line
player.teleport((Bukkit.getWorld("knockbackArena")).getSpawnLocation());
what is line generate that exception ?
line 25:
player.teleport((Bukkit.getWorld("knockbackArena")).getSpawnLocation());
says this
at GUI.gameSelectorListener.onInventoryClick(gameSelectorListener.java:25) ~[?:?]
ok so its because the world is doesn't load
I don't know how to load the world other than using world creator
//new WorldCreator("knockbackArena").environment(World.Environment.NORMAL).createWorld();
The line i took out since it creates another error
I could send it if you want
The process cannot access the file because another process has locked a portion of the file
Now nothing happens when I click the item inside of my gui
Check if the world exists before trying to load it
you need load it before with Bukkit.createWorld(WorldCreator.name("worldName"))
I wouldn't need to since it hasn't been loaded anyway
It is because of the file permissions, and maybe my code
If it says the file is busy it has been loaded
CHeck if its loaded before you attempt to create/load it
It doesn't have permission
Because:
The process cannot access the file
I can't load the world because of the perms
if you have make an copy of the world you have probably copied an loaded world and you have an .lock file
no
nor would I be able to create a world
Ok
I'll check
I see session.lock
if (Bukkit.getWorld("namehere") != null)
what do I do with it
^
you can delete it
I'll see this too
Ok
YES I found out why
World knockbackArena is a duplicate of another world and has been prevented from loading. Please delete the uid.dat file from knockbackArena's world directory if you want to be able to load the duplicate world.
Finally gave me english
Perfect
Loads the world
Thanks guys
I have also added this in to check whether it hasn't been loaded
@ivory sleet so finaly the only want know its what i need set in each configurations in shadowJar and what i need to define jetbrains annotations dependencies because currently is included in the final jar
https://paste.md-5.net/axoyabafel.cs. This current code is setting all blocks in a chunk to AIR using packets and I want it to set the blocks to AIR If the y level is above 63 for example, how can I do that? (I don't really know about packets and I'm currently modifying a plugin)
https://wiki.vg/Chunk_Format might be of note when working with these packets, though I do not know how much of this is hidden by the packet implementation for you
This is the source code If needed https://github.com/IntellectualSites/PlotHider.
Or I want it to place a grass block in y 63, so it'll look like a default plot.
Does anyone know any Library (ideally one that is packaged in Bukkit) that uses longs for Hashmap hashcodes (or removes the need of it entirely without reducing performance to ashes)? Right now I'm trying to make a claim plugin however I have a 1:1625 (while for a 64-bit hashcode it would be 1:2642245) chance that a claim hashcode collides, which I deem to be too low for it being safe to use
line 115 to 132 is where you gotta modify it. how you keep track of the actual Y level is up to you, but you could probably do it by keeping track of the amount of sections (16x16x16 areas) it already ran through
I changed my mind. I want to first remove all blocks and then set a block on y63.
Well you got the remove part already and for adding a new row, you could do something like
y = 63;
BlockStorage section = array[Math.floor(y / 16)];
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
section.set(x, y % 16, z, BLOCK_ID);
}
}```
Not 100% sure about the math, but enough to give you an idea. That would set the whole chunk layer to the new block.
Idk if you could use the TLongObjMap<V> by trove which is shaded into spigot I think
It does not appear so (unless that has been changed recently), but I'll try it either way
I still don't understand how you can set the block, the set method 4th parameter is for the state, what is that mean?
Block state ids. You can find whichever one you're looking for in your version over at (https://pokechu22.github.io/Burger/1.16.5.html)
At least that's my first guess
The "Numeric ID" correct?
I'd use the state ids
It means it has 2 states (with snow and without) that range from 8 to 9 (bot inclusive it appears so)
Though the server should store the global palette somewhere however
So If I use 8 or 9 the block will be grass_block?
numeric id is base, then you add whichever state you want on top of it
so 8 for normal grass, 9 for snowy
No, 9 is default
at least according to https://gitlab.bixilon.de/bixilon/pixlyzer-data/-/raw/master/version/1.16.5/blocks.json
"minecraft:grass_block": {
"id": 8,
"item": 8,
"default_state": 9,
"class": "GrassBlock",
"tint": "minecraft:grass_tint",
"states": {
"8": {
"properties": {
"snowy": true
},
"render": {
"model": "minecraft:block/grass_block_snow"
}
},
"9": {
"properties": {
"snowy": false
},
"render": [
{
"model": "minecraft:block/grass_block"
},
{
"model": "minecraft:block/grass_block",
"y": 90
},
{
"model": "minecraft:block/grass_block",
"y": 180
},
{
"model": "minecraft:block/grass_block",
"y": 270
}
]
}
}
π€·ββοΈ try both, you'll find out
an update for my gradle issue : i think im near to an working configuration.
BUT i just don't know how i can make that closure https://github.com/orblazer/gradle-bug/blob/b0fa5c4f4c69effa023e3908962561db24b9c10b/bungeecord/build.gradle#L14 extends the global closure https://github.com/orblazer/gradle-bug/blob/b0fa5c4f4c69effa023e3908962561db24b9c10b/build.gradle#L78
How do I prevent a particular mob from attacking the player with pathfindergoal?
this.goalSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityHuman>(this, EntityHuman.class, false)); isn't working
I have a problem and its only a small one,
code:
player.teleport(Bukkit.getWorld("LobbyMain").getSpawnLocation());
Error:
Could not pass event PlayerInteractEvent to WolfPVPMain v1.0
org.bukkit.event.EventException: null
The world that i'm trying to load is the main world
?paste send entire stacktrace
I'm still struggling to get the location.
not code, I said stacktrace
its look like the same issue that you have solve previously (for knockbackArena world)
Could not pass event PlayerInteractEvent to WolfPVPMain v1.0
org.bukkit.event.EventException: null
the shit that comes after this
No, the knockback world works
So the entire error
yeas
yes but with your code the only possible Null is the Bukkit.getWorld
so that is because the world is not loaded
I think I may have found the prob,em
problem*
brbn
I have fixed it. It's because the else if wasn't in the right place
I'm not that great at this π
bump!
if you clear the goals, not specifying any attack goal at all is the solution. The mob won't do anything if it doesn't have the goal to do so ~
Anyone know how to get from a block the Drops with a luck pickaxe?
Thank you. So there is no way to erase a specific pathfindergoal in a mob, but the only way to erase all pathfindergoal in a mob?
ofc u can inject
but tbf just use a new GoalSelector
Hey, I would like to check if someone is in some square area, the only way I can think about so far is checking the location of every player, but it feels kinda dirty, could there be an other way of doing it ?
There are methods to remove certain path goals. The ones you're looking for are in the targetSelector.
targetSelector.a(PathfinderObject o); will remove it. (at least in 1.16.5, you'll have to look for yourself if it doesn't work for you)
thanks so can I know how to do it? π
thanks so can I know how to do it? π there is no results on google
Hey, I've made a Tablist plugin but whenever I try to Build it It gives me 4 errors, And I don't really find the problem :
I'm using the 1.12.2 API
And CraftBukkit.1.12.2 in my build path
I would say that you need 1.12.1 Craftbukkit on build path
But am coding in 1.12.2
then change it to v1_12_R2
I do not have NBTTag in my Sourcecode why how to add it?
R1 is correct so idk why it gives you that error. You using maven/gradle?
maven
Can you post your pom?
Alright
My guess is that either you do not declare the cb jar in the pom or you have not the cb jar in the maven local repo
It's more than 2k characters..
?paste it then
Yeah geol was right, you didn't declare the craftbukkit jar
How do I declare it?
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
For spigot (dont't ask how it is performed for cb)
how to know if a player is in a xxx chunk?
Location loc = player.getLocation();
int chunkX = loc.getBlockX() >> 4;
int chunkY = loc.getBlockZ() >> 4;
After that you can do the rest of the magic
I'm coding in Paper not Spigot
This is the Spigot discord lol
I mean that code didn't work
Also, paper is a fork of spigot, so there shouldn't be all to many differences
It didn't find the 1.12-R0.1-SNAPSHOT
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
This is the code right?
This belongs in the dependency block of your pom
If that does not work then you are fully lost because neither paper nor spigot are going to help you with
a) An ancient version
b) A fork of spigot
Though chances are that you did not run BuildTools
Hey sigot! How do you remove pathfindergoal from a particular mob? I've seen several threads of spigot, but I don't understand. I'm sorry.
"sigot"
What latest version of the Java Runtime and JDK that Spigot is compatible with?
Java 16
How can I give players permissions
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: nos/myfirstspigotplugin/MyFirstSpigotPlugin has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
any ideas?
I know, do you use eclipse
Im using Netbeans v. 10
You are running an outdated JRE, consider updating it
ππΏπππΏ
ok
This installer should automatically update Java
^
bullshit, download Java 11 or 16; Java 8 is pretty much unnecessary weight nowadays
When I tried to use Java 11 or 16, it always gave me that error until I switched to java 8
Because your JRE was still at Java 8
Oh shoot
You only updated the JDK (javac)
That makes way more sense
Ok
Imma fix that real quick lmao
Is there a way I can give players permissions
Player#addAttachment is likely what you are search for, but Vault is suggested as it is the bigger permissions compat API
Hi, how do I make an item open the tebex buy gui?
So when you right click an item, you want it to open a gui, am I correct @tender bronze
yup*
Do you have any code written at the moment
when u first join the game u get the item thats meant to open the gui
so there is already a command to open it
which is /store
but when i try to run that inside the console
that doesnt work
so i dont know what to do
You just press t or /
Oh
Ok
Thank you
store:
material: ENCHANTED_BOOK
amount: 1
slot: 1
display_name: "&cGame shop"
lore:
- "&7Right-click to open the game shop!"
actions:
- "[CONSOLE] store"
where can i run the command
instead of the console
is there a way i can run it in the command bar inside the script?
heard of it but im not using it
does the PlayerMoveEvent not get fired when a player is a passager? even if they're moving their cursor?
Wait there
Don't you have code like this for instance:
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = (Player) sender;
return false;
}
Java
No?
i added the code inside the config file
bump
ok
I don't know how to help you because I have never used deluxehub and whats ironic is that I'm learning config files because I skipped out on them
Why can't you just write you code in eclipse or intelij
eh
bro
its easier in the config
Send me your code
Take a look at DeluxeHub wiki.
ikr
And also that's not coding xd.
its literally just inside the deluxehub config
^
Learn it
and it takes time to learn java
good for u
no ones the same
Go to #help-server
Even DaBaby can learn java
You can ask that in #help-server
Because this isn't code
wouldve been easier if u told me in the first place
I thought you were normal and used java
not write "code" in config files
Your choice
i didnt mean to word it like that
sorry
#help-server Is where you should be at
chill, he's just in a wrong channel.
No he was just a little toxic earlier and my mistake if I took it the wrong way
Could you stop arguing about who's toxic?
bump
Guys is there a simple way to check if a player is holding a piclaxe, axe or shovel. And I want to check every material type like iron, wood etc.
use player#getInventory()#getItemInHand()#getType
Example:
// put
}```
love how you go from # to . so late
xD
oh
Bump
for example you can check like this Material.STONE_PICKAXE.IsItem();
please use == to compare enums
but I want to check if he is holding an iron or wood or netherite pickaxe
How to get the drops from a block?
Material.IRON_INGOT , Material.OAK_LOG https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html
declaration: package: org.bukkit, enum: Material
is there no way?
@quaint mantle https://www.youtube.com/watch?v=Fnonn5chXk4&ab_channel=CodedRed i think this is only the way
Custom pathfinder goals is here! I went very in-depth the best way I could to explain how custom pathfinders work. I hope you all enjoy and understand the video :D Thanks for watching!
P.S
Sorry about the damn zombie noise in the background forgot I had my mc sound on :(
Want more videos?
Become a Patreon support to gain access to more videos!...
thankkss bro and I already watched this video, and there is no explain to remove pathfindergoal
i guess you need to overwrite some methods
how do i? π
hi guys i have a custom itemstack with fancy lore and everything, tho this item has a durability, and using .equals() will stop it from working since it just gets the item with a full one, how would i fix this?
@Override annotation
Check everything except durability, or abuse the PersistentDataHolder API / NBT if you don't have that API yet.
to initpathfinder?
so i should make my own Method?
public void initPathfinder() {
super.initPathfinder();
}``` sadly, but I already have it π¦
yes but i have my items in a list how would i do this. get every item and then check in a async task?
If all you do is check for a few ItemStack properties it should be fine to do it synchronously (You can start being worried if you exceed like 50k items)
yeaaaaaaaaaaahhh about that
@Override
public void initPathfinder() {
}
100% smarter to use some custom nbt in that case.
that should remove default pathing goals
What is the difference between the Shaded and non-shaded Spigot API? I see the file size of the shaded is much larger.
is there any way to get rid of the items name when it is hovered over, atm i have it so it is "=" but i don't want it to have any type of name or hover info
also hate that the equals is not aligned
Set it to just a ChatColor. meta.setDisplayName(ChatColor.BLACK.toString());
The non-shaded jar is the jar with just the pure code and without any libraries. Shaded means it also contains all the libraries it needs to run.
@quaint mantle https://i.imgur.com/IXE3FAf.png this is how those methods looks inside
ok, guessing thats the closest you can get to removing it
Thanks.
There's some nasty inventory title tricks (used for those fancy custom GUI interfaces), but yeah, I personally think the empty name is fine enough.
if you will do sth like that, there will be not pathfinding at all ``` @Override
public void initPathfinder() {
} @Override
public void a() {
} ```
ok, thanks!
thanks, but erros on @Override above a()
method does not override method from its superclass
public void initPathfinder() {
//super.initPathfinder();
}
public void a() {
}```
and no public void a?
sure
mob still attacking me π¦
public VindicatorAI(Location location) {
super(EntityTypes.VINDICATOR, ((CraftWorld) location.getWorld()).getHandle());
this.setPosition(location.getX(), location.getY(), location.getZ());
}
@Override
public void initPathfinder() {
//super.initPathfinder();
}
```
this is full code
okay
public VindicatorAI(Location location) {
super(EntityTypes.VINDICATOR, ((CraftWorld) location.getWorld()).getHandle());
this.setPosition(location.getX(), location.getY(), location.getZ());
}
@Override
public void initPathfinder() {
super.initPathfinder();
}
``` still attacking me
π¦
i will check it on my own
Would anyone mind looking at my code real quick to see why the broadcastMessage(msg) isn't working when I /reload the plugin in game?
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class MyFirstSpigotPlugin extends JavaPlugin
{
@Override
public void onEnable()
{
if(Bukkit.getOnlinePlayers().size() == 1)
{
Bukkit.getOnlinePlayers().forEach((player) -> broadcastToServer("Hello " + player.getName()));
}
else
{
broadcastToServer("Hello World!");
}
broadcastToServer("Hello World!");
}
private void broadcastToServer(String msg)
{
Bukkit.broadcastMessage(msg);
}```
Set a listener to check for player join. You're running the method on enable so Bukkit.getOnlinePlayers().size() wouldn't be valid
@quaint mantle in my case everything works ``` public class CustomZombie extends EntityZombie
{
public CustomZombie(Location location)
{
super(((CraftWorld)location.getWorld()).getHandle());
this.setPosition(location.getX(), location.getY(), location.getZ());
((CraftWorld)location.getWorld()).getHandle().addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
}
@Override
protected void initPathfinder() {
}
}```
@quaint mantle
hmm
thanks but super(((CraftWorld)location.getWorld()).getHandle()); is error
and spawnreason is already custom :0
but thanks
what verion of spigot you use?
1_15_R1
ok i am v1_16_R3
also instead of /reload, look into how debugging / hotswapping code works
@quaint mantle i use there the Spigot Location class not NMS
<?xml version="1.0"?>
<project name="${pom.properties.artifactId}" default="Build">
<--- How to replace this line above <project name =.....> --->
<xmlproperty file="pom.xml" prefix="pom" keeproot="false"/>
<condition property="serverPath" value="${pom.properties.server.path}">
<os family="windows" />
</condition>
<property name="foundation.version" value="${pom.properties.foundation.version}"/>
<target name="Build">
<jar jarfile="${serverPath}\plugins\${ant.project.name}.jar" basedir="./target/classes/" includes="**/*">
<zipgroupfileset dir="${user.home}/.m2/repository/com/github/kangarko/Foundation/${foundation.version}/" includes="**/*${foundation.version}.jar" />
</jar>
</target>
</project>
what is that?
i got my persistant data set, everything works great but the helmet doesn't seem to get removed after the durability goes to 0
You need to remove it manually, as far as I know the server does not do that until the tool is used again
how would i remove it manually?
?jd
package index
does p.updateInventory() do p.closeInventory() and p.openInventory() at the same time
??
Intventory#remove
its what i did ._.
Also in your damageItem implementation?
How can i get the item stack of an item from the armor contents of entities?
but why i am using a event listener that everytime an event occurs it removes the durability
But something's not working
you said that it gets removed if the durability is higher or equal to 2
event.setCancelled(true);
}```
in the isCrashItems boolean
``` try {
item.getItemMeta();
} catch (Exception exception) {
return true;
}```
is not working
it doesnt check of a item an entity has throws an exception
nop, it gets removed if it is not higher or equal to 2
are you sure?
yes
pls someone
Try setting the ItemStack amount to 0. I'm not entirely sure if setting durability to 0 breaks it too, but amount at 0 will definitely remove it. Or setting it's type to AIR will work too.
How can I check if a player sent a double in AsyncPlayerChatEvent
just parse the message
use Double.parseAsDouble() i think
and if it throws number format exception it means its not a double
Am I right in thinking this is the place to put in the "front page" of your plugin which normally has fancy graphics etc...?
Yes
mkay, thanks
Yeah, I've sussed that out - I just expected it to be a bigger box I guess
oooh that would make sense
how would i ignore durability when checking between two itemstacks, i made my own method but doesn't seem to work
So i know for commands you have to put them in the plugin.yml file, but is there a way to put all these commands in another yml file so the plugin user can change the names?
just register them via bukkit and link everything trough config
there are guides
howd the fuck is it giving an error
show entire method
Kind of. But changing command names/aliases is messy and requires NMS/Reflection and to properly display them (if they changed) server restarts.
I see && a.getItemMeta().getDisplayName() above
Which is not a boolean. It's a String
eyes of an eagle
MY BAD i didn't put a != null lmfaooo
tyvm
Any reason why I do not get the playername on my array ? Player name is stored on the 3th column of my database
how do I check if a player is in a hashmap(uuid, string) and how do I remove him
Try ResultSet#getString("column_name") instead
I assume it would be something like if (hashmap.remove(player.getUniqueId())) {/* had entry */}
Try setting the item amount of the left hand to 0
Did that way before
and it the issue is still the same
why set it to null? and not air
Because air didnt work
Setting it to null should work
Don't set the type to null
Set the actual item to null
wdym?
for loop on the object?
Guys, it's now been a while I'm searching on internet and I didn't want to ask for help but I can't get myself through that...
Anyone knows how to make a player shoot a guardian laser beam when right clicking an item?
I really don't like asking for help but never found about that specific projectile
Is there an easy way to find which direction a player is facing without having to do an entire function for converting the yaw and pitch to something usable?
wait nevermind found that player.getFacing().getDirection().getX() works pretty good
is is possible that: assert x = 1 && y= 1 only checks first value
If x != 1 it will only check the first value
Sure. A simple conditional statement only checks values until it reaches a stable state.
So in
int v = 4;
int x = 10;
int y = 20;
boolean j = v < x || v < y;
only v < x is checked because that always satisfies the condition
And checks are from left to right
In this case it's an and operation, so if the first one is false there is no reason to check the second one
i mean i have this assert
assert Megarena.getPlugin().Game.get(p.getUniqueId()).equals("megarena") && e.getItem() != null;
switch (e.getItem().getItemMeta().getDisplayName()) {
but the item is null
it performs as many checks as it needs to
asserts are killed at production runtime btw
@EventHandler
public void onMove(PlayerMoveEvent event){
Player player = event.getPlayer();
List<Entity> entities = player.getNearbyEntities(20,20,20);
for(Entity entity : entities){
if(!(entity instanceof ArmorStand)) return;
ArmorStand armorStand = (ArmorStand) entity;
if(armorStand.getCustomName().equalsIgnoreCase("hello")){
Location location = event.getTo();
location.setY(location.getY() + 10);
armorStand.teleport(location);
}
}
}
Im a bit confused, this code^^ seems to tp the player to the armour stand, not the other way around. What have i done wrong? π. It is supposed to keep the armour stand 10 blocks above the player at all times
You can simply make a simple KNF DNF forming from
v < x || v < y to !(v >= x && v >= y)
You are modifying the target location. So do a simple Location location = event.getTo().clone();
Ive looked into the nms code of the guardian and the answer is: Tons of packets. You need a lot of packets for creating, moving and updating the beam.
if you are having issues with your condensed check, break it apart then.
have you checked to see if it's the item that's null or the item meta that's null?
The item is null the check is apparently not picking that up
should read the comments π
I personally would simply never use assertions in java
Aren't they generally used for unit testing
They are good to clear up misconceptions for the IDE
yeah i replaced the assert with if x==nullreturn
You would need to run the jvm with the -enableassertions flag to even make use of them
And they dont throw exceptions but extend Error. Better use a fail fast approach or in your case simple null checks.
Is it possible though?
Anything is possible with enough jank
How can I prevent players from taking items from inventory? Even if I cancel the InventoryClickEvent, players still can take items using shift + fast inventory close
Sure
You can cancel event from InventoryDragEvent I think
I'm never gonna make it but I'll try thanks
There's a resource that covers 99% of it https://www.spigotmc.org/threads/laser-guardian-beam-1-9-1-16.348901/
Thanks guys, sorry for taking ur time should have Googled better
Lol... the newest snapshot introduced a Marker entity. It can hold all the nbt data you want without being ticked. So we now can easily write data to a position without having to spawn an invisible ArmorStand. Imma find out if it can be named because then its a nice alternative to ArmorStand based holograms...
Wait thats server side only. Still nice.
which is actually handy
Sounds like a decent way to store data on arbitrary locations
instead of putting the data on all the blocks or data about the blocks, you could use marker entities for that instead
this way when the blocks are ticked, it doesn't need to tick all that data until the plugin/server actually needs it
see it being useful for those who like making protection plugins π
in general it would be nice to be able to hook into quite a few things
True
If I click the slot 3 times, it still passes the event.setCancelled(true) in an inventoryclickevent
and I can place an item in a specified slot
Make sure you cancel the InventoryDragEvent too
Show your checks pls.
If the click is cancelled then the drag doesnt even have a chance to be triggered
That's what I figured
Yea true ;/
The only issue I have had is opening inventories while in a bed
I click a slot twice and it gets cancelled, but for the third time it just bypasses that.
Whats your version?
Paper π
No luck so far sight
It's 1.16.3 paper
Should be fine. Never had a problem with click event bypassing on versions on 1.12+
You... didn't do... what I asked you to try though...
It's super weird. Any ideas how can I avoid that?
Oh it's the result slick I tought the statement
Since you're using Paper go to their discord
Or test the plugin on spigot and see if the issue still happens
Cancel the inventory click event
It also might be worth trying to put back ticks around your table name and column name in the statement string.
.prepareStatement("SELECT * FROM `" + MySql.BAN_TABLE /*constants are supposed to be uppercase*/ + "` WHERE `UUID`=?;");
I remember using this plugin https://www.spigotmc.org/resources/lib-hates-mods.78202/ which helps detect forge clients and clients with the fabric api joining the server. It supports a way to check if the user has a certain blacklisted mod and if so, kick them. You can try decompiling the plugin and see what it does.
its made by libraryaddict, the same dude who made Lib Disguises
np
hey can anyone help me
?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.
i want to make a Gamemode Gui i Have the /Gm working for my self but i cant seem to get the /gm <playername> working propely i can open the gui but i cant make it change the other persons gamemode how could i referance the other players name in the listener, i have the gui working but the bit i cant get working is the geting the name from the command class to the listener class i.e: /gm ArcaneLegend then in the listener class arcanelegend.setgamemode(Creative);
how would i do that
Looks more like decompiled than obf
i dont get that to be honest the map system
Great thanks for that info!
Hey, Since JRE 8 support is going done, should I code in JRE 11 as well?
I would love to see more plugins requiring java 11
All right
For personal use def a higher version
Ok thank you
Java 7 is best
I would use 6
More compatible with Windows 95 systems
You should use Java 16 to bork your gradle install
v 1.0
you don't necessarily need to require java 11 unless you are making use of java 11 specific things
most of the time you won't be, so its perfectly fine to target Java 8
as far as installing Java on servers, they shouldn't be using Java 8 since like 2-3 years ago
maybe longer
Yeah it lost LTS
16 does introduce some cool features ngl
Am I the only one to code my minecraft server in Javascript?
What does this mean? org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
?paste
Is that the only error you have?
This is the whole error https://paste.md-5.net/jebitazoba.sql
And yes
Does your main have a nullary constructor?
Let me check
If not then make sure to add one
This is the only one that is in my main public SlipStuff(SlipStuff plugin) { this.plugin = plugin; }
You don't do that, that is what onEnable is for
And it makes your plugin abnormal
Okay
Is there a way to set the player camera somewhere else? like just offset it?
Thanks @ivory sleet & @dusty herald for your help!
I'm not sure if spigot can't handle that
But what do you mean by offset the camera
Like seeing your player from somewhere else?
like the camera is say 5 blocks up
i tried with the cam packet however that fixes the movement
Nope. You would need to clone your player, create an NPC that mirrors the user, then make the actual user a spectator.
bruuuuuh, thanks anyways
That's kind of what I was thinking too
With the citizen plugin you could work pretty easily around that
Depends on what you want to do with the camera
Just like you were playing normally but the cam was somewhere else
Like controlling your player from somewhere else or just having it?
Yeah but working out a proper camera position is pretty complex and requires some math.
controlling
java 16 has linux socket support. So now you can use them natively in java π
Yea sure
Try searching on Google, maybe some people have done that before
I think it's actually possible but pretty complex
And foreign memory access in in first incubation. So now you can finally tinker with the whole memory and read data from other programms.
ah yes that too
Maybe controlling a npc clone of your player would be easier
And this beauty:
if (entity instanceof Player player) {
player.sendMessage("Hi");
}
That is actually nice and like they added that
I mean, its not something I really cared for too much, but it is still nice nonetheless π
Yeah, just to test i tried this:
CraftEntity e = (CraftEntity) entity;
final PacketPlayOutCamera packet = new PacketPlayOutCamera(e.getHandle());
CraftPlayer p = (CraftPlayer) player;
p.getHandle().playerConnection.sendPacket(packet);
However this freezes the cam, is there like a way to take the player's movements and apply it to the entity?
unfortunately because linux sockets are in Java 16, can't really PR to spigot to update connection code to make use of it when servers are on the same host π¦
This isnt something you can do in one method. You would have to create a whole NPC class, then listen for incoming packets
that change the position/direction of the player and delegate them to the NPC.
hmmm, true
imma hit the hay and think bout this at a later time
thanks for the ideas tho
what does this do? "player.getCustomName()" is this just a way of getting someones nickname?
Gets the custom name on a mob or block.
declaration: package: org.bukkit, interface: Nameable
ah thanks
How do I make it so then all of the content is sent back to the player using args.length, if so is there a simple way to do this?
you mean like this?
command: /msg username hello buddy
returns to the user username:
hello buddy
idk
No like /testcommand hi returns hi back to the player after they have executed it.
So basically returning the message back to the player
just use String.join() if there's multiple args
How do I use that @glass sparrow?
What does .trim() do?
method removes whitespace from both ends of a string
Hey everyone
Hey
I would like to replaceAll(), but not if there is a backslash before what I am trying to replace
I'm not very familiar with regexes, is there any way to do this without iterating through all occurances?
So, for example, if someone types "RED" I want to replace it with ChatColor.RED + "", but if someone types "\RED" I don't want to replace it
@woeful crescent can you assume RED will have whitespace around it?
You mean spaces?
yea
no I can't assume that
someone would probably just type GREENhey guys I can type in green
I think theres something wrong with spigot... I am setting an entities yaw (armorstand this case) with entity.setRotation(newYaw, 0). Then, the entity rotates, but only a bit. When requesting the entities yaw, it seems to be correctly set. When I look at the actual result in game though, it has an actual yaw thats only a fraction of the rotation. https://imgur.com/a/P9jC4TR
I am also riding the armorstand, it has a model, its invisible and it is invulnerable (fyi)
Spigot seems to correct itself after a few seconds though (usually around 30 seconds later). It then corrects the yaw to the expected yaw in game
Also i use paper spigot
wrong channel one min
Tfw just realized Hypixel scales 100k players by having many bungee proxies and having a DNS load balancer that connects users to different proxies. Most of their modifications to spigot/bungee allow them to run seamlessly in kubernetes or swarm which allow communication between servers on different systems. Everything past that point is decently vanilla when it comes to the jar and everything that comes after is a plugin that uses class injection to replace spigot functionality when they need it
π
Hypixel does not need to run thousands of people on one core/jar/container, they need to run about 50 maximum at one time per core/jar/container
which is decently easy
the difficult part comes in balancing and communicating aka the kube part
and all their packet stuff they do with NMS and world loading with skyblock
Yea.. did you really think they did all on one dedi
No but people do, and i was like "hmm they cant all be connected to one proxy that connects to spigot servers. Even having one proxy with 10k people on it is gonna choke it to death"
People kept saying that they had some sort of proxy they wrote that was more scalable than bungee but thats bull
no matter what you do you cant hold 100k connections on one process
so they have many bungeecord instances with DNS balancing which explains ALOT
search up bungeecord
plugin messaging channel
he was asking how to send users to another server from the server they are on
as in the /server command provided by bungee
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
this would be better asked in #help-server
this is not a development question and the answers here wont be correct for your situation
no worries
if anyone uses protocollib's version of multiblockchange can you show me how you did it, it seems I either don't understand or it isn't working. 1.16.5
Show us what you got so far. Getting this packet right is pretty hard.
Packet moment
1s I'll get a pastebin
?paste
@bright jasper Just to complete what you said, they probably use multiple proxies. If you contact their dns at different times, they will give you a different ip every few minutes, probably depending on the load
Yeah they for sure do
Join the game and do
/proxy
it gives you your current proxy ID
π your method is even easier than asking the dns for an ip every few minutes ahah x)
if you did Block#breakNaturally() on a spawner, would it drop the spawner?
if not
how would i make it drop it
Chunk sections are 3 dimensional. They have x, y and z
It also looks like you are having a mismatch between your ProtocolLib versions
No, since the natural break assumes the player is punching it with a null item (his hand).
Check for the block break and spawn the ItemStack yourself.
CreatureSpawner can be obtained via block.getState and casting
oh lol
wait(1200);
p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 2));
wait(1200);
p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 3));
wait(1200);
p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 4));
wait(1200);
p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 5));
wait(1200);
p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 6));
wait(1200);
p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 7));
wait(1200);
p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 8));
wait(1200);```
would i do this if i wanted haste to increase every minute?
ok
Bukkit.getServer().getScheduler()
.scheduleAsyncDelayedTask(this, new Runnable() {
public void run() {
Delayed Task
}
}, (1200)L);``` like this?
What is that
uh yeah or as I do
this.getServer().getScheduler().runTaskLater(this,() -> {
//code here that should be delayed
},1_200L);
But yours works though I donβt know if itβs safe to use async in your case
Like what is the potion for?
my command
Ah nice
so mine will work?
Idk
Might get an exception.
k
Telling you it needs to be done on server thread
is Bukkit#getPlayer(name) case-sensitive?
No
//code here that should be delayed
},1_200L);``` how come this code doesnt work?
You didnβt put anything in the lambda
You have _
That works fine
what is "lamda"
between delay and thing
oh
oh
No Woods donβt listen to aglerr because 1_200L and 1200L is equivalent in terms of their functionality
oh my bad, i thought runTaskLater needs delay and period
But basically put your potion effect code inside the lambda
its says in runTaskLater that there isnt a method. i forgot how to make a method
i watched a 2hour video ive been all over the internet and i guess I STILL DONT KNOW??
```
My tip is to not watch videos but using learning sites
I would use BukkitRunnable instead and use runTaskTimer.
i think im gonna learn more java. but do u know a way i could learn java?
What is the problem?
alot
every time i try to build the project
it gives me a new exception
i have no idea how to learn java i thought i knew how to but nothing works? i guess
We have all been there. Try Jetbrains Academy (has a free trial or register for their student licence for free) (to woods george jr)
ok thanks Lynx
so you just want to code bungeecord plugins using gradle ?
I mean, just include the bungeecord repository and dependency in your gradle.build ?
neat xD
just make sure to compileOnly
don't want a copy of the bungee api included in your plugin
the gradle dependency scope ?
its the same as <scope>provided</scope>
in maven
basically you want to make it so you don't include
the api
Default maven scope is compile
Iirc you set it, there is no default
yeah ^
Maven without the scope tag will default to compile though
looks good π
I mean, newer minecraft versions may introduce new api in bungeecord
1.16 has new api for 1.16 minecraft
I mean, if you can you should always attempt to code against and run latest
Wait, bungeecord can detect that?
Looks like you can only get the name and version
Mod names have to be unique anyway iirc
I assume it's forge
Interesting method to block certain mods
Of course it's not super hard to bypass
It's a map <String, String>
So you can turn it into an array fairly easy
Bukkit.getPluginManager().registerEvents(new EventsClass(), this);
Doing this makes the class continuously run right?
Define continuously run
like it will check go through each public void? idk how to explain it
so like i have EventsClass() with all the public void onInteract(PlayerInteractEvent event)
do they have an @brave glenHandler
ye
ok, sorry for my poor explaination XD
it's so hard for me to actually help people here
instead of correcting their conventions
I'm trying to create a primed tnt entity, is there a child class to the abstract TNTPrimed class without abstract methods?
I don't want to manually set all the variables when I create an instance of the class
Also sorry in advance if I ask a few dumb questions, I'm just getting started :)
TNTPrimed is the interface provided by Spigot. You very very rarely implement an interface from Spigot.
You would spawn a primed tnt by simply calling the spawn method from a world.
So:
public TNTPrimed spawnTNT(final Location location) {
final World world = location.getWorld();
return world.spawn(location, TNTPrimed.class);
}
Or:
public TNTPrimed spawnTNT(final Location location) {
final World world = location.getWorld();
return (TNTPrimed) world.spawnEntity(location, EntityType.PRIMED_TNT);
}
@sinful python
Oh, thank you!
What are your takes on multi language support?
I would like to support multiple languages and thought about many different ways.
It should be
- Accessible (So something static or an enum)
- Scalable (Prevent boilerplate by annotation scanning for example)
- Robust (If public static then also final or generated static getters on private mutable static fields)
Are we talking spoken language or programming language
I personally speak Java
I honestly just wanted something that would provide me with messages from a file in a way that doesnt drain my will to live...
This was one consideration:
public class Language {
@Translatable(path = "some.path.for.explanation", base = "Some base value")
public static String COOL_VALUE;
}
Which i dont like because the fields are mutable this way.
Ill just use an enum for now.
if (messageMap.get(uuid) == message) {
}
So when both variables are equal to the same value lets say "R", the IF statement wont execute. Is there a difference to a String hashmap and normal String?
ah yes, totally forgot about that. Thanks
np
Hello, spigot I have problem with evoker
I cleared evoker's all pathfinders like this:
@Override
public void initPathfinder() {
super.initPathfinder();
Bukkit.broadcastMessage("A");
}
But evoker still summoning mobs (Vex, etc)
Also, thanks to @gleaming grove it works now!
thanks
it works
xD
hello spigot, I have problem with my mob.
I removed all ai and added attacknearplayer pathfindergoals like this,
@Override
public void initPathfinder() {
this.goalSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityPlayer>
(this, EntityPlayer.class, true));
}```
But my mob not attacking players
and my mob's ai is all removed (I want to add this.goalSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityPlayer> (this, EntityPlayer.class, true)); )
hello, does anyone know a method of licenses to prevent piracy of Premium plugins that does not violate the terms of use of spigot?
piracy in this case is to put free download on leaked plugin sites
some people buy the Premium resource and put it on leaked sites
I'm aware
My point still stands
This means that after I remove all the pathfinder in the mob with the following code, the new pathfinder does not work even though I added a new pathfinder. (Not all pathfinders in the mob apply)
@Override
public void initPathfinder() {
this.goalSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityHuman>
(this, EntityHuman.class, true));
}
here ^
In all seriousness, spigot adds a bit off protection to your plugin when it's downloaded, and you can do some basic obfuscation to slow down leakers
But you will never be able to stop them, even with the best licensing system
even the biggest companie's games with millions of $ poured to anti-piracy get cracked
You could pursue legal action, but it's up to you if that's worth it
In the end I advocate for open source, pay for support
this is not feasible. I will think about leaving open source
this is a mistake because the developers lose out
Go talk to MD about it
but thanks for the tip
I'm sure he will enjoy having that conversation again
many developers abandon spigot because of the lack of protection against piracy and leaks
Spigot doesn't make any money of premium plugins, so I doubt MD cares that much
I understand
<#general message> Here is the start of the last conversation about it
I'd rather having an open-source and paid for supports.
Agreed
Instead having anti-piracy i guess.
Or you can pay to not have to compile it
It'll take more time, setupping etc, paying web hosting maybe.
Any reason why my code isn't working ? Still saying that array is empty.
Yeah I've tried creating locations but it just keeps giving me errors
Hmm nevermind I seem to have gotten it
hey fellas, I'm trying to make it so that if a player uses a certain bow, then an explosion will happen where that arrow lands. so far I got everything working, except there is an error whenever a skeleton fires an arrow from a bow. I figured I should check whether the arrow is null and if the shooter is a player, but that didn't fix the issue. here's the error
and here's my code:
@EventHandler
public void onArrowBomb(ProjectileHitEvent event) {
Arrow arrow = (Arrow) event.getEntity();
Player player = (Player) arrow.getShooter();
ItemMeta item = player.getInventory().getItemInMainHand().getItemMeta();
Location arrowloc = arrow.getLocation();
if (arrow != null && event.getEntity().getShooter() instanceof Player) {
if(isCooldownOverApollo(player)) {
if (ItemManager.apollo.getItemMeta().equals(item)) {
World world = player.getWorld();
world.createExplosion(arrowloc, 2, false, true);
startCooldownApollo(player);
}
}
}
}```
You need to check if the shooter is player.
You need to do that on the start of the method.
You're already getting the player while you haven't checked the shooter first.
Does the block break function record the position of the broken block?
yup, that did the trick! thanks
do I still need to check if the arrow is null?
Arrow arrow = (Arrow) event.getEntity();
Player player = (Player) arrow.getShooter();
Both of these are unchecked casts that can and will throw ClassCastExceptions
mhm, i see
No, the getEntity() method is @urban grotto
Check if the entity is instance of Arrow instead.
I would like to argue that they should expect this using that name :p
@sinful python yes
Hmm, do you know how I would access that information?
BlockBreakEvent#getBlock
Thanks! :)
π
Does anybody have any good tips/examples of organizing an oncommand method for a command with lots of different arguments and different prerequisites to use the many arguments
I saw some people talking about using a map but Iβm not sure where to start with that
You would have a Map of String -> Consumer or Custom class that handles a single argument
?paste
Here is an example I made a while ago https://paste.md-5.net/catisoqozo.js
Using abstraction.
Looks like what I showed with more code :p
And a list which requires a loop and is therefor slower
Is it gonna make a lot of different in performance?
Ah alright, I will consider using Map instead.
Anyone know why it's giving me a warning Boolean method 'willDropCoins' is always inverted, what is that mean?
public boolean willDropCoins(){
return ThreadLocalRandom.current().nextDouble(101) <= (getChance());
}
im trying to share my project on github but intellij is saying my authentication is invalid
can i post a screenshot of it here or smth
you're trying to post a repo on github?
yeah
hey spigot !how to bypass spigot the recived string length is longer than mixium allowed?
when I create npc
you can add the npc to a team and put a prefix and suffix
which means you can have like 48 chars
im trying to add vault as a dependency to a maven project, here's what i added to my pom.xml:
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>```
and ``` <dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>```
when i try importing something from vault, such as `import net.milkbowl.vault.chat.Chat;`, nothing works. what am i doing wrong?
try mvn clean
and mvn install
is your IDE saying you have an error importing the xml?
intellij is saying that i can't do the actual import statements in the java file
nope
tried restarting IJ?
ill do that now
still getting yelled at
wait
it lied, it's all working now
god i feel dumb, thanks for the help
yeah lmao sometimes its just the ide
It has a chat and economy API
okay still going on about vault, i added this method as instructed by the github page. when i do it, the plugin disables, due to the second return statement. any ideas why?
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false; // returns false here
}
econ = rsp.getProvider();
return econ != null;
}```
It also has a permission API actually
Do you have vault and an economy plugin installed
thats not supposed to happenen
oh wait shoot economy plugin
that doesnt happen for me
And does your plugin load after vault
god im dumb
even if my pluugin is the only plugin it works fine
does it need to?
It should
okay yeah it worked now, forgot about the economy plugin lol
Yes but what do you do with the return of that code