#help-development
1 messages · Page 1690 of 1
Yes if a plugin performs a player to chat on the server thread then it’s going to be fired on the server thread lol
You just said "might" so just thought it should be clarified when it's async and when it's not.
For normal messages from player's it's always Async so
Any idea about the question I had?
using the getNavigation().moveTo() has the entity properly pathfind to the desired location, but always stops a single block before the actual target
Are you adding .500 to the locations x and z to get the center?
It's not stopping on the edge of a block, but in the middle of a previous block
But yes, it is a block position
Can you not just make the goal 1 block further than what you want?
Then they'll stop 1 block closer than that, which is where you want.
That's not really solving the problem, is it
It is if they walk where you want them to go 
And I'd also have to determine the direction from with the entity pathfinds from
Which is insanely inefficient
Do all entities stop 1 block away?
I don't know, I can only send this debug render packet for my custom entity
Can you change it to another mob such as a Skeleton? I'm wondering if it's using some minimum range and stopping there.
Nope, it's not that
This is not a zombie anyway
It is just borrowing the assets from one
Whats the underlying entity
A custom one
Doesn't the move to path only check for the block next to because they can attack from 1 block?
That's what I thought, hence the Skeleton suggestion.
It would stop further away if it had a bow 
if you're using the navigation anyway, have you checked if the generated path is already wrong? so e.g. getNavigation().getPath().getEndNode() and getNavigation().getPath().getTarget()
package de.leleedits.lobbysystem.commands;
import de.leleedits.lobbysystem.util.Constants;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class BroadcastCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;
if (player.hasPermission("lobbysystem.broadcast")) {
if (command.getName().equalsIgnoreCase("broadcast")) {
if (args.length == 1) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < args.length; i++) {
stringBuilder.append(args[i]).append(" ");
}
String msg = stringBuilder.toString();
Bukkit.broadcastMessage("§7§l[§c§lBroadcast§7§l] §a" + msg);
} else if (args.length == 0) {
player.sendMessage(Constants.PREFIX + "§cPlease use §6/broadcast <MESSAGE>§c!");
}
}
} else {
player.sendMessage(Constants.PREFIX + "§cYou are now allowed to do this!");
}
return false;
}
}
Why can I only use one word in my /broadcast command?
because you check if you pass exactly one argument (aka word) : args.length == 1
oh, my fault, sorry
The debug renderer displays the entire path
Open and closed set including
ah I see
This is a mob entity however, not a monster
So I see no reason why'd stop one short
how large is the bounding box of the entity? because that's the only other thing I can see that would mess up the target location
ok so not particularly larger than usual
That entity is targeting me, with the moveTo(Entity) method
It still stops one block short
at least that part is consistent then
Is there a way to make a client render something?
No
This is a client mod that re-introduces the debug renderer for pathfinding
Minecraft has a dedicated plugin channel set up for it
With a texture pack that has the assets?
Probaby
I am not modifying the target position, and the entity type has no influence on the pathfinding
So what could be the problem here
Get the side the entity is on and add 1 block in the opposite direction
With what you're showing... its that easy
You know that is possibly the most simply case of pathfinding, right
Do you even know how MC does pathfinding
I mean you could just write your own move to block goal
each and every goal would eventually boil down to using the navigation, which is creating the issue in the first place
You people really need to learn the difference between a goal and pathfinding
I am explaining that like once a day
A goal is a thing that tells a entity where to go and what to do
Pathfinding is the thing that actually determines the path and makes the entity go to the spot
And the latter is the issue
dont build pyramids
Playing the race card. Nice lol
Caused by: org.gradle.api.GradleException: This version of Shadow supports Gradle 7.0+ only. Please upgrade.
Gradle 7.2
Build time: 2021-08-17 09:59:03 UTC
Revision: a773786b58bb28710e3dc96c4d1a7063628952ad
Kotlin: 1.5.21
Groovy: 3.0.8
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_302 (Amazon.com Inc. 25.302-b08)
OS: Windows 10 10.0 amd64
gradle shadow not working
and gradle is 7.2
ugh
Based on the fact that skeletons and zombies use the same ground navigation, I doubt it's a problem with the navigation
But a zombie does damage by colliding with the player
So I struggle to see the issue
I've looked over the source a couple of times now but I'm having a hard time to find anything that would really make sense
I doubt it's skipping the last step, because getting into such a state is highly unlikely
R u using the wrapper or not? What version of shadowJar
Also what’s not working
@halcyon mica what exactly are you trying to do?
so the only other option is that (1) it sets the location of the last path node wrong and then (2) thinks it already reached it (or maybe not and is just stuck?)
but to the the path node one whole block off would require quite a large bounding box, which also isn't the case
I'm much more of a debugging guy but I'm not in a position to whip up a quick test case so I'm at the end of my capabilities for this one
How can i check if a player is in a worldguard region called "safezone"? I've been searching around, but can't find a clear up to date answer
for (ProtectedRegion rg : WGBukkit.getRegionManager(p.getWorld()).getApplicableRegions(target)) {
if (triggerRegions.contains(rg.getId().toLowerCase())) return true;
}
i hope its still recent
I think it's outdated, WGBukkit doesn't seem to exist
WGPlugin?
ah
public static WorldGuardPlugin getWorldGuard() {
final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
return null;
}
return (WorldGuardPlugin)plugin;
}
im stuggling through the spaghetti
🍝
Could not HEAD 'https://jcenter.bintray.com/org/jdom/jdom2/2.0.6/jdom2-2.0.6.pom'. Received status code 403 from server: Forbidden
Disable Gradle 'offline mode' and sync project
gradle
Disable offline mode
beep beep beep
uhh this havent found a way to make this shorter
private void teleport(Player p, String name) {
UUID uuid = p.getUniqueId();
if (!CommandMagmabuildnetwork.getBypassingPlayers().contains(uuid)) {
if (uses.containsKey(uuid)) {
if (uses.get(uuid) < 2) {
uses.put(uuid, uses.get(uuid) + 1);
} else {
long timeLeft = System.currentTimeMillis() - cm.getCooldown(uuid);
if (TimeUnit.MILLISECONDS.toDays(timeLeft) < 1) {
Utils.message(p, "&cPlease wait&e " + Utils.millisToHumanReadable(TimeUnit.DAYS.toMillis(1) - timeLeft) + " &cbefore reusing this command!");
return;
}
}
} else uses.put(uuid, 1);
}
Location loc = getLocation(p, name);
if (loc != null) {
loc.getChunk();
p.teleport(loc);
cm.setCooldown(uuid, System.currentTimeMillis());
Utils.message(p,"&aTeleported to " + name);
}
}
You think?
private void teleport(Player p, String name) {
UUID uuid = p.getUniqueId();
if (!CommandMagmabuildnetwork.getBypassingPlayers().contains(uuid)) {
if (uses.containsKey(uuid)) {
if (uses.get(uuid) < 2) uses.put(uuid, uses.get(uuid) + 1);
else if (TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - cm.getCooldown(uuid)) < 1) return returnMessage(p, Utils.message(p, "&cPlease wait&e " + Utils.millisToHumanReadable(TimeUnit.DAYS.toMillis(1) - timeLeft) + " &cbefore reusing this command!"));
} else uses.put(uuid, 1);
}
Location loc = getLocation(p, name);
if (loc != null) {
loc.getChunk();
p.teleport(loc);
cm.setCooldown(uuid, System.currentTimeMillis());
Utils.message(p,"&aTeleported to " + name);
}
}
public boolean returnMessage(Player player, String message){
player.sendMessage(message);
return true;
}
🔥
jcenter also got shutdown, so you might want to remove that repository from your gradle config
and maybe use a stringbuilder for this?
Stringbuilder would likely not be any faster
you should really only use it when concatenating collections
if (location.getWorld() != null) {
RegionManager regionManager = container.get(BukkitAdapter.adapt(location.getWorld()));
ApplicableRegionSet set = regionManager.getApplicableRegions(BukkitAdapter.asBlockVector(location));
for (ProtectedRegion r : set) {
if (r.getId().equalsIgnoreCase("safezone")) {
event.setCancelled(true);
attacker.sendMessage(ChatColor.RED + "Can't attack palyers here");
} else if (!(r.getId().equalsIgnoreCase("safezone"))) {
attacker.sendMessage(ChatColor.RED + "You're now in combat, logging out will cost you!");
player.sendMessage(ChatColor.RED + "You're now in combat, logging out will cost you!");
}
}
}
}
For some reason the else if gets executed as well, it triggers the "you're now in combat message"
second test for !"safezone" is pointless
I know, i was just testing it. Was hoping it'd work lol
Could you give full method?
and do a early return is region is null
it just means you have more than one zone and its not called safezone
just put an else
Guys how to know server plugins and u are not op there
what
@EventHandler
public void entityDamageEvent(EntityDamageByEntityEvent event) {
if (event.getEntity() instanceof Player) {
Player attacker = (Player) event.getDamager();
Player player = (Player) event.getEntity();
Location location = player.getLocation();
WorldGuardPlatform platform = com.sk89q.worldguard.WorldGuard.getInstance().getPlatform();
RegionContainer container = platform.getRegionContainer();
if (location.getWorld() != null) {
RegionManager regionManager = container.get(BukkitAdapter.adapt(location.getWorld()));
ApplicableRegionSet set = regionManager.getApplicableRegions(BukkitAdapter.asBlockVector(location));
for (ProtectedRegion r : set) {
if (r.getId().equals("safezone")) {
event.setCancelled(true);
attacker.sendMessage(ChatColor.RED + "Can't attack palyers here");
} else {
attacker.sendMessage(ChatColor.RED + "You're now in combat, logging out will cost you!");
player.sendMessage(ChatColor.RED + "You're now in combat, logging out will cost you!");
}
}
}
}```
And it should look like this https://gyazo.com/23571fd44af9f5e949f72782139b978d
A lot of servers block it
Bcz I think they have some mob spawn plugins which they don't tell me
And how does the normal spawns are in spigot I think they are different
Wait
If you are sure that this region is called "something"
You could get it by regions.getRegion("something");
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionManager regions = container.get(world);
which probably
could
Entity herobrine = blockPlaced.getWorld().spawnEntity(blockPlaced.getLocation().clone().subtract(0,3,0),EntityType.ZOMBIE);
herobrine.setCustomName("Herobrine");
herobrine.setCustomNameVisible(true);
herobrine.setHealth(100); /* this is the line
Cannot resolve method 'setHealth' in 'Entity'
i don't understand, what am i doing wrong?
only living entities have health
so it shall work or i have to do something else..?
you need to cast it as a livingentity because right now you're just working with a simple entity
Is there a way to apply the crossbow animation while not having a cross bow in your hand? I assume you'd use packets for this?
just create a new class to hold the two values or a record now that they're available
they're new in java14 if you want to look into that, otherwise a class is just fine
Hello, somone can help me ? I got this error
Here is the code corresponding with this error
Is that the only code?
No but with this error, i think it's become with these few lines of codes
Any lines in between?
No
Nope, it doesn't work
I'd argue it's best to call getBlock() once and handle it as a variable
Should resolve any issues you're having
saving this
Hey short question: I would like to create a config with my plugin, and also add and read values in it.
For this I have already written the following in my Main class in the onEnable method.:
FileConfiguration config = getConfig();
config.addDefault("test", "this is a test");
saveDefaultConfig();
I also created the config file in my resources folder and deleted my config file in the server folder after the last failed attempt. However, the config is still empty after a reload. Can anyone help me there?
I think something is wrong with my custom item code
saveDefaultConfig() saves the default config file that you ship with your plugin, i.e. a concrete file that is inside your jar. you're working on the normal configuration instance instead, so saveConfig() is what you're looking for
How to move a entity?
Ok now i changed it to
FileConfiguration config = getConfig();
config.addDefault("test", "this is a test");
saveConfig();
but the config is still empty :/
oh right I forgot, if you do the defaults that way, you need to do config.options().copyDefaults(true) before calling save
alternatively you can use the saveDefaultConfig() by providing a complete config.yml inside your plugin so you don't need to set it manually like this
yeah now it works, thank you
i already tried that but then my config was empty
/shruxx
oh
¯_(ツ)_/¯
another question: I would like to read the contents of the config in another class and have already written the following:
public static Main main;
FileConfiguration config = main.getConfig();
System.out.println(config.getString("host"));
System.out.println(config.getInt("port"));
System.out.println(config.getString("database"));
System.out.println(config.getString("user"));
System.out.println(config.getString("password"));
I get an error there. Does anyone know what I could have done wrong here?
Looks null to me
Is there a way to create a cheat plugin?
depends on what you mean by cheat plugin
👌
But most cheats are client side. Like baritone, x-ray, fullbright (or whatever its called)
And doesn't query stay opened if it fails?
async™️
500ms is very low
i think the default is 5000 per connection in hikari
or 30000
one of those figures is correct
that looks like a nightmare
where are you calling bdGet
and, is there any reason you can't do this in one query
So you're teleporting on join?
what does your schema look like
You are. At least in the code
Why do you do DOUBLE_NUMBER???
since you're getting all those columns anyway, why can't you select * rather than each individual column
Why not just use a json string at that point?
and why is the player username the PK
🤦
you need your money back
I have never worked with mysql and I know thats all fucked up xD (I know the bare minimum)
a resultset
it will have all the columns for each matched row
resultSet.getString or getDouble or whatever with the column index
Does somebody know when when using NMS to add a custom entity in 1.17 i'm getting a null error?
?paste
https://paste.md-5.net/cetovohawa.bash stacktrace
WorldServer world = ((CraftWorld) player.getWorld()).getHandle();
world.addEntity(new CombatLoggedPlayer(player.getLocation()), CreatureSpawnEvent.SpawnReason.CUSTOM);
What are those things that start with Craft?
yes
the craftbukkit implementation
insert into ... values (?, ?, ?, ...)
What are the differences between the normal one and craftbukkit one?
bukkit provides a bunch of interfaces (an 'API'), this is what your plugin is programmed against
craftbukkit is the actual implementation of said api to work with the minecraft server and is version specific
nothing is stopping you from directly using craftbukkit and nms, except the fact that your plugin will break every version and defeat the point of an API existing in the first place
I'm sort of braindead right now but really want to get this done before bed, how can I set the facing direction from blockdata? can I just cast it if it's an instance of directional?
the api docs are looking real blurry to me rn
line 19
of
me.johnny.clwocombatlog.nms.v1_17_R1.CombatLoggedPlayer
ye
I am curious
I got my plugin on spigot for few years
and my name is unique
and now some one makes some project online with that same name
of my project
do I got any right on it
i still need help
please do
actually please do if you can tell me how to improve them step by step cause im a dum dum
private Main pluginInstance = Main.getPlugin(Main.class);
``` why are you doing this? You should be using DI
```java
private static final Set<Integer> allowedSlots = Sets.newHashSet(11, 12, 13, 20, 21, 22, 29, 30, 31, 24);
``` why static?
```java
player.getItemOnCursor().getType().equals(Material.AIR)
``` never ever use .equals on an enum. Use reference equals (`==`)
Store `e2.getSlot()` , `e2.getClickedInventory()`, and each of the items as a variable. The reason why nobody is helping you is because that code is horrendus to read, and hard to help someone with.
// top row
slots[0] = e2.getClickedInventory().getItem(11);
slots[1] = e2.getClickedInventory().getItem(12);
slots[2] = e2.getClickedInventory().getItem(13);
// middle row
slots[3] = e2.getClickedInventory().getItem(20);
slots[4] = e2.getClickedInventory().getItem(21);
slots[5] = e2.getClickedInventory().getItem(22);
// bottom row
slots[6] = e2.getClickedInventory().getItem(29);
slots[7] = e2.getClickedInventory().getItem(30);
slots[8] = e2.getClickedInventory().getItem(31);
``` also
use a loop here
really no need to insult y'know
I'm not insulting, this is constructive feedback
i do not know what that means in english, english is not my main language
lemme google real quick
I'm also not trying to insult you rn. I am just pointing out the obvious and trying to lead some pointers to help clean up your code. That way, other people are more willing to help you.
i'm only gonna change this: player.getItemOnCursor().getType().equals(Material.AIR)
why?
no offense of course but i do not find the other suggestions reasonable to change
static = one variable throughout infinite instances
But wtf getPlugin(Main.class)
i doubt you're creating multiple of these instances though but, its fine
on the Main class
Lmaoooo
the classic class loader instance grabber
private static 🌚
You should be using DI
DI is too complex of a concept for a beginner programmer to understand.
That's a field.
I said "static local variables"
as in this cursed goodness:
void fuck() {
static int i = 0;
}
:)
Fair.
ok this is the new code
https://paste.md-5.net/kowudutixe.java
now the 1 item recipe also requires an update by clicking on an allowed slot ):
bc i would be changed every time the function is called
it's a difference between stack memory and static memory
meaning
i keeps its value between function calls :)
tbh i dont see any difference between that and keeping it as a field
tho
besides visibility ig
but if its private
who else is gonna access it
separating the needs of a single function from the needs of the entire class?
it's not exactly a useful feature
(unless you're working in a non-OOP lang)
god no
C++ and Globals is like
a horrible combination
in any other language, globals either
- don't exist
- are better bc bytecode lang
so can anybody help?
is there a spigot event for players moving items in their inventory
that im just not seeing
There isn't, you have to use inventoryclickevent
does that work with players using number keys to move items around in the invenotries
and drag event
.
????
basically im trying to make a plugin that prevents you from putting things in chests, but you can take things out
????????
??????????
LMFAO
How could I get an itemstack with Custom Model Data? In Minecraft then I can do this:
/give @s minecraft:light_gray_stained_glass{CustomModelData:1} and if there is a texture pack then it will texture the item.
ItemMeta#setCustomModelData
You need a "JavaPlugin" object, listener by default does not provide this.
You'll have to pass whatever class extends JavaPlugin, and get the config from that
o
package me.lowjunnhoi.hardcoredeathrespawn;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.configuration.MemoryConfigurationOptions;
import org.bukkit.plugin.Plugin;
import java.io.File;
public class Death extends JavaPlugin implements Listener {
FileConfiguration config = getConfig();
private final Main plugin;
public Death(Main plugin) { this.plugin = plugin;}
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer();
p.sendMessage(config.getString("changing-gamemode-message"));
Bukkit.getScheduler().runTaskLater(plugin, () -> p.setGameMode(GameMode.SURVIVAL), 0L);
p.sendMessage(config.getString("gamemode-changed-message"));
}
}
public Death(Main plugin) { this.plugin = plugin;} you initialize the config here like so
public Death(Main plugin) { this.plugin = plugin; config = plugin.getConfig();}
Also "Main" as your main plugin class is bad practice, use your plugin name instead
Yes, your IDE should allow you to easily rename it within the IDE however
unless you're using like...idk... notepad
ok
That sounds like the worst time ever
It probably is
Death.java not main
package me.lowjunnhoi.hardcoredeathrespawn;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.configuration.MemoryConfigurationOptions;
import org.bukkit.plugin.Plugin;
import java.io.File;
public class Death extends JavaPlugin implements Listener {
private final HardcoreDeathRespawn plugin;
public Death(HardcoreDeathRespawn plugin) { this.plugin = plugin;}
FileConfiguration config = getConfig();
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
config.options().copyDefaults(true);
saveConfig();
Player p = e.getPlayer();
p.sendMessage(config.getString("changing-gamemode-message"));
Bukkit.getScheduler().runTaskLater(plugin, () -> p.setGameMode(GameMode.SURVIVAL), 0L);
p.sendMessage(config.getString("gamemode-changed-message"));
}
public FileConfiguration getConfigFile() {
return config;
}
}
still the same error https://paste.md-5.net/kikaxurodi.xml
the main file
package me.lowjunnhoi.hardcoredeathrespawn;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
public final class HardcoreDeathRespawn extends JavaPlugin {
public void onEnable() {
System.out.println("Plugin enabled!");
getServer().getPluginManager().registerEvents(new Death(this),this);
}
public void onDisable() {
System.out.println("Plugin disabled!");
}
}
if its not your main why does it extend JAvaPlugin?
only your main should extend JavaPlugin
My eyes, why do you use the scheduler to schedule a task 0 ticks later?
You can't have your Death class extend JavaPlugin, therefore you can't use getConfig() and should use what optic said
Also a useless FileConfig getter
There are legitimate uses for this
And this isn't one
There is no way he knows any legitimate reason for it if he is extending 2 classes with JavaPlugin
Maybe, but if you told me you can't change someone's gamemode during the respawn event I would believe you
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
That's first
anyone have any idea on which plugin here mess with a fireball damage changer plugin?
Lmao
whats so funny
That's the most ridiculous thing to ask us
If you don't need only config,
public ClassName(FileConfiguration config) { this.config=config }
And in main class, instead of this, set getConfig()
ReduceFireballDamage
use getLogger().info(); to send messages into console
Yeah I'm assuming that's the plugin in question
Presumably wouldn't be interfering with itself
One would hope, at least
thats the plugin in question
it doesnt XD
save config in main class, don't need save config in event listener
it worked fine when i tested it
Regardless it's ridiculous to expect us to just know which of a long list of plugins is messing with your oddly specific plugin
oddly speific..
its just a event
of the highest priority
that sets the damage
You haven't told us how it's being interfered with
And even if you did I doubt anyone would be able to just point it out in a list of plugins
Well that's not something we can help with
well someone might have knowldge on how those plugins work
We're not wizards
eg i dont use essentials
If I wanted to override a vanilla command like /give or /list then do I need to do anything special or can I just make the command?
No clairvoyance
does essentials mess with damages
i dont think so?
Pretty sure you can just make the command
Thanks.
indeed indeed
how can i initialize an empty set of
Collection<ProxiedPlayer>
?
sure
Exception in thread "main" java.lang.NoClassDefFoundError: org.bukkit.plugin.java.JavaPlugin
at java.base/java.lang.ClassLoader.defineClassInternal(ClassLoader.java:491)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:452)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:1137)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:924)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:832)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:790)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1108)
at de.straussfalke.plugin.test.main(test.java:14)
Caused by: java.lang.ClassNotFoundException: org.bukkit.plugin.java.JavaPlugin
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:792)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1108)
at java.base/java.lang.ClassLoader.defineClassImpl(Native Method)
... 10 more
I don't know how the hell this would happen other than maybe shading the spigot jar
thank you 🙂
How could I change the color of a players name in the tab list?
Set a prefix for a team and add the player
You do this with the scoreboard
Bukkit.getScoreboardManager().registerNewBoard()
#registerTeam
#Team.addEntry(player.getName())
#Player.setScoreboarf
you can append a color in front of the player list name
My plugin isn't working 🤔
package me.lowjunnhoi.hardcoredeathrespawn;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.Plugin;
public final class HardcoreDeathRespawn extends JavaPlugin implements Listener {
FileConfiguration config = getConfig();
public void onEnable() {
System.out.println("Plugin enabled!");
config.options().copyDefaults(true);
saveConfig();
}
public void onDisable() {
System.out.println("Plugin disabled!");
}
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer();
p.sendMessage(config.getString("changing-gamemode-message"));
Bukkit.getScheduler().runTaskLater((Plugin) this, () -> p.setGameMode(GameMode.SURVIVAL), 0L);
p.sendMessage(config.getString("gamemode-changed-message"));
}
public FileConfiguration getConfigFile() {
return config;
}
}
You forgot to register the listener
also - don’t sysout, use your plugins logger.
uh will one of this methods save the object to the file?
well not directly, but they'll be used when the configuration they're contained in should get saved. so partially yes.
No
They just do the serialization work for you
so i should never call those methods?
Wat
correct, they'll be called for you
ok
Well yeah in Bukkit context probably not
@tardy delta have you registered the ConfigurationSerializable?
Else it won’t use those methods
?paste
FourteenBrush in onEnable add smtng like
ConfigurationSerialization.registerClass(Home.class);
ok
@gray zodiac this inside the listener is referencing Death which is not your plugin, and thus the cast fails. you need to prefix it with your plugin type aka HardcoreDeathRespawn.this to get this to point to the right thing in that instance
how 🤔
aka
HardcoreDeathRespawn.this
Main.getInstance() uwu
like this?
getServer().getPluginManager().registerEvents(new Death(), HardcoreDeathRespawn.this);
no, when you do the cast, where the error happens, L36
you're doing (Plugin)this, but this is pointing to the instance of Death which is not a plugin
do you have a static method inside your main class which returns the class instance?
what's that, I'm new to java
make a private static field called instance or something inside your main class
FourteenBrush don’t teach him a static singleton
It’s a pattern that shouldn’t be used just like that
i use it 😖
literally just need to change the one word and it'll work :(
Yes because you don’t know why it’s bad presumably
that
First of all spigot provides a singleton already that does not break the pattern, JavaPlugin::getPlugin
with Main.class as argument?
Yes
hmm if thats better
It guarantees the right plugin instance will be returned, aka the one instantiated and loaded from plugin startup.
That is not a guarantee by using these custom singletons
so like this
public static Main getInstanceTwo() {
return JavaPlugin.getPlugin(Main.class);
}
ah i understand
Anyways I was really nitpicky now but yeah
so if i need to instance i make a field and assign it to JavaPlugin::getPlugin(Main.class)?
Yeah
Or course it might arguably be better to just pass the plugin instance through the constructor
But that’s one of the proper ways
oki thanks
is there a way to prevent anvils from being damaged?
@ivory sleet I got qustion on right about plugin name
my plugin has specific name
unique
I use it for like 5 years
and now I found out some one is using and branding it for last 3 weeks
for it self
can I act
against it ?
hello i needed help on the plugin Crates Plus-i wanted to ask that how can i give in-game currency in a crate
can anyone help me?
if it can run commands just run the eco give
DDX just pause
Please don’t ping people because you’re impatient, it’s rude
it’s the age of the internet, we have automated systems of finding resources, have you tried googling the most basic question?
yes there is a error it is not working
hello i have a problem with shadowJar in gradle
the relocate apears gray
and doesnt work
Try hovering over it Pmz?
you frustrate me with your lack of detail
i know this
“It’s not working” is literally the shittiest description
Try removing the () in front of shadowJar?
👏 at least you tried 🙂
How do i give a item with nbt data to a player ?
Why do you want to?
Hmm unsure, is it in spigot also?
nothing changed
the shadow jar relocate is not working
Well I’m not really the guy when it comes to licenses and copyrighting sorry
I was curious
Not sure, I use Maven so maybe someone that knows about Gradle can help out
What specifically goes wrong?
the relocate is gray
and it doesnt shade like maven
Well that’s not much to go on
with this build thing
ok let me test
if something in the gradle shows up weird in the IDE, it doesn't have to be an error, groovy is just notoriously hard to get right
thanks. worked
Yeah kotlin dsl much better
and how to change the output file name ?
just want to remove this all
shadowJar.classifier ''
bruh thanks
No worries
?
You are in the wrong channel for plugin support
how to give a player head item stack a texture value
If you use spigot you’ll have to use reflection
Like if you want to set a specific head texture
yes..good ol reflection
or skullmeta
Hmm pretty sure google can help you here
private void buildMedPack(){
ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
GameProfile skin1803103601 = new GameProfile(UUID.fromString("f017c5f5-e70e-4b16-9cb7-a82fcb1af9c3"), "skin1803103601");
skin1803103601.getProperties().put("textures", new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTU4OTcyOTE0Nzk5MiwKICAicHJvZmlsZUlkIiA6ICJhNmE3MzI2NjZhZTI0YjIwYWQyNmIzYWZkZWZjNmM1MCIsCiAgInByb2ZpbGVOYW1lIiA6ICJNeXN0aWNHYW1lck1hbiIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lNTgwYzBlYWYzZTFkMGFlNWE0MmQ5NjY0MWJlZGMyNTFhZGQ2ZjA5NzI1NDI3OWJhYTJmNjI5OWNjZTYzMjcwIgogICAgfQogIH0KfQ==", "rXy8bq+RjMJiawajWDm2+N7jV+kCGwqYSmOLth5A7is0uyR8Aqe9DDcxUdAAdHJd+JOx5/KY9EmO8ExobQ0kt2sarJLlnkVQa3o+gEeadFj9DA6VwsWWki2qqAvgZQsQOe3w41UF9M3C96Z/EIBR8hZp8kG73WKwA3xQ9b6juk5PxDSGEuJbnpYZW5fxraOSmElMFqWJelU22z15I1nqk6aWzwa9WHh/ywX0Hy4BvqWvwqNhBoxHREwQ8TOLyairKxlo9YX/Q+0OaRHa120vynLKH2jtBH3qD2XUugnopyN4eoCos2uOkFE2T4zeBKkUSE10xNuMpowKXZlmXEi4qGh+KGcY1b284vvXX4Muztx8kxp+xSe5vAxVGSVqkRR7gt0yK1DCxlkgBCWERoNoBR81oNqON6Ild/rdhQBEZsTW/SuCsPTQa+GR6uOeNadyXSM6tSG8CAxaon0urrbNoy9rud3dQCrcwbkpzhdsQwaROWGhsdUaHfrSZ6z7wxHQTiAC8QLiy4NukyHfp5w3vMbUbs+6LCT774MdSo4hioCKalwHXfaDXHrXxPKjsfYCmDTRehBBioQpBakIv4vb3upWdo7WFgjzau83PljVP4lYfqaO3bktZtcLWT0VtYAbsbXH6JROrhNH1LIeGomUcP5ZjJeTYCc9IqbbvEV1oyQ="));
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
try {
Field profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, skin1803103601);
} catch (IllegalArgumentException | NoSuchFieldException | SecurityException | IllegalAccessException error) {
error.printStackTrace();
}
headMeta.setDisplayName(ChatColor.GREEN+"MedPack");
head.setItemMeta(headMeta);
medpack=head;
}
ignore the bigass texture property

well this might have some problems in 1.17 idk if they changed internals
i should just change the value ?
i mean... yeah
only texture one tho
if you have a specific skin in mind use mineskin to get texture
MineSkin.org allows you to generate skin texture data for Minecraft which is signed by Mojang.
private ItemStack skull(String value, SkullMeta headMeta){
ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
GameProfile skin1803103601 = new GameProfile(UUID.fromString("f017c5f5-e70e-4b16-9cb7-a82fcb1af9c3"), "skin1803103601");
skin1803103601.getProperties().put("textures", new Property("textures", value));
try {
Field profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, skin1803103601);
} catch (IllegalArgumentException | NoSuchFieldException | SecurityException | IllegalAccessException error) {
error.printStackTrace();
}
return head;
}
is it ok ?
nope i dont think the skullmeta thing is ok
thanks anyway
you never created a meta in the first place..
@ivory sleet how does one make a List containing days of the week?
Hello all!
Was curious if there was a more efficient way to get a 10x10 radius in front of an entity and 'mine' it.
My current code (working but inefficient):
Location loc = new Location(world, mule.getLocation().getX(), mule.getLocation().getY(), (mule.getLocation().getZ()-1));
for (int ii = 0; ii < 5; ii++) {
for (int i = 0; i < 10; i++) {
// Destroys column in front of location
loc.getBlock().setType(Material.AIR);
loc.add(0,1,0);
}
loc.add(1, -10, 0);
}
loc.add(-5, 0, 0);
for (int ii = 0; ii < 5; ii++) {
for (int i = 0; i < 10; i++) {
// Destroys column in front of location
loc.getBlock().setType(Material.AIR);
loc.add(0,1,0);
}
loc.add(-1, -10, 0);
}
It's meant to function as a drill.
Currently does: https://gyazo.com/0fc79ba0524c724054aeff912a8ab334
Thank you!
(also only works in the North direction)
the skin values require internet connection ?
there's a type for day of the week in java that you can use https://docs.oracle.com/javase/8/docs/api/java/time/DayOfWeek.html and make a list of that
Directional directional = (Directional) dispenser.getBlockData();
BlockFace face = directional.getFacing();
Vector vector = face.getDirection();
Location location = dispenser.getBlock().getRelative(face).getLocation();
BlockIterator blockIterator = new BlockIterator(dispenser.getWorld(), location.toVector(), vector, 0, 10);
while (blockIterator.hasNext()) {
Block b = blockIterator.next();
if(b.getType()!=Material.AIR){
break;
}
for(Entity entity : dispenser.getWorld().getNearbyEntities(b.getLocation(),1,1,1)){
if(entity.getType()!= EntityType.PLAYER) {
entity.setVelocity(vector.clone());
}
}
}
}
``` all you need is to get the facing direction
also ignore the entity loop
Thank you!
Server with protocollib is crashin on 1.17
What can I do?
I use the latest version of it
Please help me 😦
ask in the right section,also dont just 'its crashing' paste actual error logs
Why do people hardcode texture properties
Just have the texture in a resource file, and load/cache it when necessary
where is it?
Easier to update, maintain and modify
Where can I paste the log?
not much of a diffrence if its hardcoded its gonna stay the same forever
It's longer than 2000 letters 😦
which section?
ah, #help-server ?
Plus, hardcoded textures make dynamicially generated ones impossible
Guys does it exists a method to know which dimension the world is?
dimension? So not spigot?
What's the best way to check if the player value in an hashmap has died? I'm puzzeling around, but can't get it right
I mean nether or end
I'm trying to send a message to the key (Player) of the hashmap once the target player (hashmap value) has died,
Thank you. I was searching on the doc words like dimension, nether, end. I even though of cheking the biomes.
Didn't think of Environments
if you're only using that map for that purpose, wouldn't it make more sense to switch the order around? so the player that dies as a key and the player(s) to notify as value
That's a good idea tbf
how do i make so that users dont see a message from someone?
im creating a plugin, where the user needs to send his nick when he joins first time
thats the reason
you can clear the recipients in the chat event
ok, how?
well ... you get the recipients and clear the set getRecipients().clear()
how do i check for placing a sign with protocollib
When does entities despawn?
If anyone can show me how to get an entity to walk to a location on 1.17 using NMS (or otherwise) I'll PP you $5
6000game ticks or 5minutes if they're being loaded
Ok ty. Another question. Does the server load back entities if the server restarts?
Just cancel the chat event
not sure... I can test it if u want
I can also test. Ty anyway
Yes entities are saved between restarts.
Ohh, ty
figured it out
anyone that have a good punish manger with web interface?
How can I send a Player to another Server with Spigot plugin command
So I’m trying to figure out a way to pathfind off the main thread possibly on a completely different server. Weather I create a application that takes a world or a list of chunks and then calculates, returning a path. Or even just run another Spigot server on another machine and send data between the servers basically using one server just for performance heavy calculations(not sure if bungeecord is capable of this I’ve never used it as I have always just used spigot). Has anyone ever attempted this, does it sound possible, and are there any issues to using a method like this that come to mind? I’m no expert and any ideas to help me get started would be appreciated.
for (Player key : this.main.bounties.keySet()) {
for (Player p : Bukkit.getOnlinePlayers() ) {
if (this.main.bounties.containsValue(player)) {
this.main.bounties.remove(p);
this.main.bountyDeathCheck.get(player).sendMessage(ChatColor.RED + "Your bounty " + ChatColor.GOLD + player.getDisplayName() + ChatColor.RED + " has died, bounty has been nullified");
this.main.bountyDeathCheck.remove(player);
}
}
}
What would i run a nullcheck against? it returns null when there's multiple this.main.bounties.keySet
When doing a nullcheck on this.main.bounties.keySet it'll say it's always null.
First you can;t remove from a set you actively looping without using an iterator. Secondly, if it says its always null, you didn;t initialize the set
Removing seems to work just fine?
you said it was null, so theres nothing to remove
when there's MULTIPLE instances it seems to return null
also, why are you looping all online players for every entry in yoru keyset?
then you ignore the actual keyset and never use it
Is there a way of getting the landing spot of a dragonegg?
what exactly do you mean?
in think it can only teleport a few blocks
iterate over the chunk until u find the egg
dont know if it will work
can tp 7 blocks in xz
max
dont knoe if theres an method for it somewhere
BlockFromToEvent
That fires before it teleports.
You can cancel it
But it's not predetermined afaik
so it is possible to get the location before it is clicked?
Well not before it's clicked, before it teleports.
okay
Changed the code a bit
if (this.main.bountyDeathCheck.containsKey(player)) {
for (Map.Entry<Player, Player> entry : this.main.bounties.entrySet()) {
if (entry.getValue().equals(player)) {
this.main.bounties.remove(entry.getKey());
}
}
}
}
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1584) ~[?:?]
at java.util.HashMap$EntryIterator.next(HashMap.java:1617) ~[?:?]
at java.util.HashMap$EntryIterator.next(HashMap.java:1615) ~[?:?]
at com.odyssey.events.OnDeath.onDeath(OnDeath.java:42) ~[Main-1.0-SNAPSHOT.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor4186.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.1.jar:git-Paper-259]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.1.jar:git-Paper-259]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.1.jar:git-Paper-259]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.1.jar:git-Paper-2```
You can't call remove inside the loop when you're iterating over the Set.
As I said earlier, you can;t remove from a collection you are looping ConcurrentModificationException
Gotta use the good ol Iterator 
Use an iterator or note what needs to be removed and remove it when finished
Hmm
Can't removeIf work here too? Might be a better option.
prob
I'll take a look
Agreed
using ConcurrentHashMap fixed the problem
Breh
You should really be using a normal HM unless you’re using it concurrently across threads and need the thread safety
How do i make Hex Color in chat?
ChatComponent ?
You’d pass the ChatColor instance to the ChatComponent then
i have no idear how this works
What are you doing more specifically?
Making some sort of chat format plugin
i want to replace hashtag+1559fbb with color
You can use RegEx
yes
Yeah use regex like dessie said
wut regex?
Regular expressions
How do i add something to config when a player joins
For example, i want to add a field to the config, thats is called Players.playername
Get the config, set the value for the given path, save the config
Ok
Tho you should really isolate the config from the player data
or use Adventure/Bungee Components
If i'll set something in the config and get it, will there be any issues?
just want to use spigot and not bungee components thank you
Listen to AsyncPlayerChatEvent, get the message, use regex to find the hex colors or iterate through the string as a char array, parse, rebuild the message, set it back
The ChatColor bungee component is built into Spigot
No but it’s not a smart idea to deal with the player data in the same file as the config, I don’t know if you’re interested in why but lmk and we can debate your choice, anyways as I said just simply use ConfigurationSection::set and then Plugin::saveConfig
Not Conclure using C++ syntax 
Method reference > javedoc grammar
So everything i need is in chatcolor?
Ye
and no fancy compont stuff and .build stuff?
Nope
Nope, literally ChatColor.of("#ffffff") would give you white iirc.
Thank you!!! :)))
Tho if it’s like to parse the chat, you still need to find where the colors are
You just need to find all the HEX colors in the String
Yeah ^
That's where RegEx comes in
I'm asking that because i tried to create a field in config called Players.playername.registered that is false by default and then save it, but when i tried if(!this.plugin.config.getBoolean("Players." + event.getPlayer().getName() + ".registered")) { event.getPlayer().sendMessage("hello"); } on the player join even nothing happened
anyone know why I cant see the npc's after I die or go through portal and come back
Because your client unloads them and the server doesn't know they exist, so it's not resent
I've tried re injecting the packets
doesnt work
oh actually its just that somehow when I inject in the respawn event it doesnt work
I made a Player Join event, where I tried to create a field in config called Players.playername.registered that is false by default and then save it, but when I put if(!this.plugin.config.getBoolean("Players." + event.getPlayer().getName() + ".registered")) { event.getPlayer().sendMessage("hello"); } into the code to check if it runs, when the player joined nothing happened.
Print what the boolean is
Okay
in general loading your config somewhere is better
wise words from 7smile7
What does that mean
like making a list with everything from your config
tbh in general it makes it easier... idk how and why it helps the server
¯\_(ツ)_/¯
Respawn event runs before the player respawns. Add a delay.
kk gonna test that ty
np
eyy it works tyty
np
Guys i'm stupid, haven't used maven for a long time.
Pom: https://pastebin.com/PjcWM9J2
Error when using anything: https://pastebin.com/xAzFgWxn
My editor sees it and stuff so it's probs compiling or whatever but im stupid XD
please help
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
you need to actually define the maven-shade-plugin for it to shade your dependencies
does an nms has ai by default or we have to set pathfinder goal ?
if want it to have its default ai if it doesnt have by default
Entities have default AI yeah
If the speed modifier is public you can get the goal instance and set it, or remove that goal and re-add it with your modified speed.
How would i use a getConfig() in a method . When i try i getjava: non-static method getConfig() cannot be referenced from a static context
how to
i havent used pathfinders at all
Make the method non-static or get an instance of your Main class
package e.e;
import net.minecraft.world.entity.EntityCreature;
import net.minecraft.world.entity.EntityTypes;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
public class CustomEntity extends EntityCreature {
public CustomEntity (EntityTypes<? extends EntityCreature> type, Location loc) {
super(type, ((CraftWorld) loc.getWorld()).getHandle());
this.setPosition(loc.getX(), loc.getY(), loc.getZ());
}
}
this is my current class
Idk what the obfuscated name for the goalSelector is, but basically you need to find that and then you can add/remove Goal instances.
if i use the a method
will it remove the current ai of the goal and not other ai ?
Well look what a() does.
what goal shod i set
What are you trying to do
simply change its speed
Like, it's walking speed?
yes
Oh. You can just use Attribute Modifiers for that.
and how to do that ?
LivingEntity#getAttribute()
its nms entity
Are you only setting it's speed?
yes
Yeah you can do all that with Spigot
is it possible with a normal entity
?
like customizable
getting the type from config
like tht
is it possible with spigot ?
Like getting an entity type from a config and spawning it?
yes
I think you can do that 
ok but how
World#spawnEntity(). You just parse the EntityType from whatever value is in the config.
and edit is attributes ?
Yes
I told you, getAttribute()
should i cast the entity i spawned to livingentity?
and how to edit the armor
like i have this
if i actually want to use one of f.e. vault's features, should i check if the plugin itself != null or if the plugin is enabled?
don't you just use the service manager?
which would only exist if the plugin exists and is enabled
is it right ?
e.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(1);
would this check if the plugin is enabled?
getServer().getPluginManager().getPlugin("Vault") != null
just softdepend the plugin
uh yeah i did
im just testing
but like if there is an error loading that plugin its not fully functioning
this will check if its enabled
hmm
im not familiar with shaped recipes - what would this look like?
i thought like this but it doesnt work
should be second + third row, you made the first row empty
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i dont know if it helps
Hey Quick question: How can you call the Config.yml of the plugin if you are not in the main class? In the main class you can do this with this.getConfig Does anyone know how I can use this in another class?
<Main class>.getInstance().getConfig() i think
youre gonna have to set a variable as "instance" with the main class
and make a getter to retrieve it
this works well
so i tried to import the same map twice (called island1, island2) but as soon as i try to /mvimport island2 normal it fails
uh i'm back, which event priority is executed after the others and decides whether the event should be cancelled or not?
did you put the jar under your dependencies?
How to get a Material from config (name/id)
ok so
System.out.println(Main.instance.getConfig().getString("host"));
System.out.println(Main.instance.getConfig().getInt("port"));
System.out.println(Main.instance.getConfig().getString("database"));
System.out.println(Main.instance.getConfig().getString("user"));
System.out.println(Main.instance.getConfig().getString("password"));
should be right?
Material.fromString or valueOf or something
because when i run this i get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org.bukkit.plugin.java.JavaPlugin
at java.base/java.lang.ClassLoader.defineClassInternal(ClassLoader.java:491)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:452)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:1137)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:924)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:832)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:790)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1108)
at de.straussfalke.straussfalkeserverplugin.test.main(test.java:13)
Caused by: java.lang.ClassNotFoundException: org.bukkit.plugin.java.JavaPlugin
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:792)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1108)
at java.base/java.lang.ClassLoader.defineClassImpl(Native Method)
... 10 more
Nottingham works ... all prints out a null pointer
use a getter for the instance but yeah
Also tried... the same error
Please never call your main class main
I think i have already a getter for instance:
public static Main getPlugin() {
return instance;
}```
@burnt current I’d recommend using Dependancy injection to get an instance of your main class
Instead of using a static singleton
Makes it much cleaner when you’re adding to the constructor
ok i will have a look at this thank you for the tip
okay just try
Pardon?
How do i create a plugin that support mutiple versions?
if you use the spigot api, there is compatability between version with the exception of certain things (like methods removed/added, etc)
if you use NMS, you must provide an implementation each time the server revision changes
This one
Wasn't your last message referring to me?
yea
it was for you... lmfao
Oh, ok. Then why do you write Pardon?
ok so I tried with the getter now, but the error still comes up
You should name it as a name of your plugin / short version of it
yeah I do not care 🙂
Die
Die even faster
No
Can someone spoonfeed me what im doing wrong?
https://pastebin.com/Wq0QjfJe <- pom
java.lang.NoClassDefFoundError: club/minnced/discord/webhook/WebhookClientBuilder <- error
Just need an example
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Idk about spoon feed
What's the best way to detect a block within a specific area/BoundingBox?
My exact use case is I need to check if there's a protected block (using BlockLocker) within the bounds. Would I need to iterate through every single block and check if it's protected?
shade the dependency
how
(yes im noob with maven)
https://www.spigotmc.org/threads/maven-shade-dependencies.375696/
"Yeah, just add the shade plugin to your pom and it shades the dependencies that dont have the provided scope"
it does have the provided scope
Gradle (:
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
change mainClass
no
tysm
How do I make a list of strings in Java?
you google
being able to gather information/skills as easy as that through various search engines is a pretty important part of being a developer
Arrays.<String>asList(string,string2);
how can I send a player to another server by clicking on an item
By using a plugin messaging channel
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Thx
Hey, I want to get player's location to check if he enters/leaves an specified area. Is it more efficient to get the everyone's location like each 1 second, or to check it separately for every player on PlayerMoveEvent, Join Event, etc. ?
how precise does it have to be?
No need really, I want it to display bossbar in the area
If you use Chunk mapped BoundingBoxes you can easily get away with the PlayerMoveEvent.
If you just want a rough estimate then using a scheduler and distanceSquared is
a good option.
Thanks for help/opinion!
Quick question: I have created a config.yml which looks like this:
MySQL:
host: localhost
port: 3306
database: database
user: user
password: password
then I added the following line to my onEnable method:
this.saveDefaultConfig();
i also created the following variable:
public static Main instance;
instance = this;
a getter also exists:
public DataSource getDataSource() {
return dataSource;
}```
and then tried to read out the data from the Config with the following method:
```java
public static void main(String [] args) {
System.out.println(Main.getPlugin().getConfig().getString("MySQL.host"));
System.out.println(Main.getPlugin().getConfig().getInt("MySQL.port"));
System.out.println(Main.getPlugin().getConfig().getString("MySQL.database"));
System.out.println(Main.getPlugin().getConfig().getString("MySQL.user"));
System.out.println(Main.getPlugin().getConfig().getString("MySQL.password"));
}```
but if i run the method i get the following error:
https://hastebin.com/cefurucobe.csharp
does anyone happen to know what I did wrong?
(Sorry if it got a little texty but, as it's a few minor code snippets I thought it was the best way to do it.)
Hello, I'm trying to find a way to prevent players from leaving a region. Here's what I've done so far:``` @EventHandler
public void onPlayerMoveEvent(final PlayerMoveEvent event) {
final Player player = event.getPlayer();
final ElementalSettings settings = ElementalSettings.getInstance();
if (settings.getLobbyRegion() != null) {
if (!settings.getLobbyRegion().isWithin(player.getLocation())) {
event.setCancelled(true);
}
}
}```The problem with this is that as soon as players leave the region they can't get back in, could you help me find a way to prevent players from leaving a region as if there were a wall in front of them?
Öhm
Why tf do i See an Standart construxtor
U Sure the Plugin is Setup correctly
which constructor do you mean?
Not construxtor
Ur Main function
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Because of does Not find Java Plugin class
you mean because my Main has the name "Main"?
For some IDS reason
Yop
Sure u Made IT correctly
yes
Because it seems like it's not an valid plugin
Could u supply the whole main class
With that it extends etc
Well that's just wrong
Look at my link please
I send
That's how u setup a blank spigot plugin
From what I can see u did that wrong
as I said. You can make it automatic in Intellij with the Minecraft extension and that's what I did. Everything has worked so far
then u made it wrong
Well then it's not making sense that it's complaining about not finden the JavaPlugin class
finding
Please send main class
Via pastebin or hastebin
the entry point of a plugin is not main(String[] args) because it is not a traditional java application
eh, if it worked before, I'd make sure that both the plugin or dependency support the same compilation jdm. I have no clue what you are talking about, though, so I'ma stay outta this xD I just know I've had to update quite a few things in some some projects due to it not 'finding classes' only cause I was compiling in a newer version and needed to update my dependencies.
Asking me? Yes. Just, for example, lombok didn't compile with me in 8.12 version, but changing it to 8.20 did due to java version.
got it
Lombok go vrooom
That is looking ok
This was a method in an extra class, with which I wanted to check whether everything could be read correctly from the config.
U use maven?
when you say "run" are you literally running that method from within your IDE
And this not work
yes
lol
i wanted to print the content from my main in the console of my IDE
yo lmb, you think I could send instructions to other servers through a database
that sounds like a terrible idea but there is no reason why you can't
i can’t use messaging cause there’s not gonna be players on my second server
i’m trying to get a group of players on a lobby server, then once they’re all together i wanna send instruction to my second server to then get the game setup
if you can't use the PMC then consider a messaging queue like rabbitmq or redis or a socket based setup
ight i’ll look into it
oh... that makes sense
uh is there a vanilla mc console command that allows me to dm a player as console?
/w ?
probably not then other than tellraw
uh really
well i know tellraw can be used from commandblocks so i do not see why the console can't
ok so I would like to use the whole thing for my MySQL database. But somehow it doesn't work and I don't know if the config is simply not being read or if some other error is to blame... so I tried to test whether the readout works like this
so stick it in your onEnable and test it like any other plugin
you mean I should try the sysout there?
yes
Maybe this sounds dumb, but is there any way for me to see if a float variable was set/updated if that makes sense
float example; // By default the value is '0.0'
if () { // Check if variable 'example' was not set/updated
// Execute code if true
}
// Later down the line, variable 'example' is updated & possibly can be 0
you can't leave a primitive uninitialized in java
bruh
have a boolean somewhere or something as a flag for if you do set the float
You can't, seemingly I can for some reason? This is Java 8
it is not uninitialized, the JVM will initialize it to 0
if you attempt to use an 'uninitialized' local variable then your program won't compile
typical way is to make the variable only accessible by a single method and set an additional value there
what is the maven path to where artifacts are?
Thanks guys for the info/help
github requires authentication if you use their publishing
yes
No files were found with the provided path: target/*.jar. No artifacts will be uploaded 😦
@sly bison Might want to look at Observables as well but thats a lot more advanced
thank you!!
And you cancel the original PacketPlayOutNamedEntitySpawn for the player entity?
should work with cancelling the original PacketPlayOutNamedEntitySpawn and replacing it. But keep in mind that approach might crash the client because some packets might contain unexpected data as they are intended for a player object and not a mob
The PacketPlayOutPlayerInfo will be sent as well to show tablist-info. Did you look at that as well? That one needs modification at least to spawn fake-players
(that being replacing the player, otherwise detection of hte new load is PacketPlayOutNamedEntitySpawn)
private UUID lastJoined = null;
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
lastJoined = event.getPlayer().getUniqueId();
}
save to a config on disable
There is also player.hasPlayedBefore if you only want new players
true