#development
1 messages · Page 125 of 1
d;spigot command#getLabel
@NotNull
public String getLabel()```
Returns the label for this command
Label of this command
I wouldn't be surprised if this is nullable
😛
my guess is that it wasn't registered in the plugin.yml
I think that method I use I should not need register inside plugin.yml, what info I get when google on it.
But I maybe made some mistake on they way perhaps.
i made my own command class i can extend to easy make new commands and also get tabcomplete and a register class I load on start.
you made your own version of that?
did you forget to pass a name to the constructor or something?
yes.
no, I added the name/command
why didn't you just extend that lol
or just not?
you don't need to even do that
you just need to implement I think it's CommandCompleter or something
CommandExecutor?
well no there's another one that combines TabCompletable and CommandExecutor
ah, I see
TabExecutor
make it more clean like this https://paste.helpch.at/itokitozeq.java
that's literally what the normal TabExecutor implementation looks like
what I see do most of the methods have args
uh
and you need the args
like this for example https://paste.helpch.at/isocidulaj.java
ideally, when you create your own command system, you most likely want to get something that allows you to use arguments such as onCommand(Player sender, String name, Material material, Integer amount)
oh my god what the fuck it makes a new instance
dude
don't mess with the command system
just use the normal TabExecutor interface
way? Should not be impossible to register with out need of use plugin.yml?
It probably isn't but you're doing some cursed shit
Just stick with the normal command stuff, it works perfectly fine
you're destroying all of the normal command system just to skip a few words in parentheses lmao
Any idea on this?
what's going on with that
can be true, But I think is not the main issue on the problem here. I will test something more could be 1 thing I messed here.
That is 100% the problem
You're registering commands wrong
Pretty much it’s not creating the user config files when a player joins the server. On top of that, the little broadcast I put to debug the on Player Join isn’t sending either. Not sure where the problem is at @dusty frost
You're missing the @EventHandler annotation
Are you shitting me
So you’re telling me I spent this entire time trying different things with the methods to figure out why it wouldn’t work
And I was missing a vital part of my listener the entire time 😂
This is why I should just go to bed and not stay up
yeah is what i mean and is not same class i register it in.
I work out the issue (I completely missed I also need set label also), I now need fix other things I see not work as it should (I can run the command with out set anything inside plugin.yml).
thanks for the help.
I could make it to one instance, but it I should do like you say it also will create new instance for every class I extend the commandExecutor/TabExecutor.
at least I have now learn almost all ways to get instance of a class .
How do you have it setup? are you using command, command executor, or just reading from chat?
As far as Ik the only command system that requires adding to plugin yml is commandexexutor. If you extend command you can just add the command to the command map itself
yeah that's what he was doing, just didn't add label field
okay has anyone used spigot's FileConfiguration#set to add comments before
if so how the fuck
you cant add comments, the only header
You can't
according to the sponge guys, yaml is very cursed when it comes to comments, there's so many possibilities of comments and they aren't linked to nodes somehow
is there any way to view nms changes from 1.18.1 to 1.18.2?
just generate a diff
It still isnt working. I added @EventHandler
Anyone else on have any clue
you are missing pdataconfig.load(file) ig
Does essentials api have like an event to see when /sell is run and get info, like how much it would earn the person and so on?
Can you provide more of the class? such as the internal variables of the object.
its in the OP but if you give me a minute I will grab
UserDataHandler.java: https://pastebin.com/P1pWt8Wc
PlayerJoinListener.java: https://pastebin.com/0HYYeu5S
This is in my onEnable():```java
getServer().getPluginManager().registerEvents(new PlayerJoinListener(), this);
Why isn't it creating the file for the player when they are joining the server? (`<uuid>.yml`)
This was the change I made
```java
public void createPlayerConfig() {
pDataF = new File(p.getDataFolder(), uuid+".yml");
if (!pDataF.exists()) {
try {
pDataF.getParentFile().mkdirs();
pDataF.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
pDataConfig = new YamlConfiguration();
try {
pDataConfig.addDefault("Bounty", 0);
pDataConfig.save(pDataF);
} catch (IOException e) {
e.printStackTrace();
}
}```
I also added the @EventHandler annotation to the listener
Remove extends JavaPlugin from your UserDataHandler @junior shard, as it should be only in your main class.
You also do not declare a instance to your CityRPBounty inside of your UserDataHandler initialization.
public class UserDataHandler {
CityRPBounty p;
CityRPBounty instance;
UUID uuid;
File pDataF;
FileConfiguration pDataConfig;
public UserDataHandler(UUID uuid) {
this.uuid = uuid;
pDataF = new File(p.getDataFolder(), uuid + ".yml");
pDataConfig = YamlConfiguration.loadConfiguration(pDataF);
instance = CityRPBounty.getInstance();
}
changes ^
Is there a reason why you have CityRPBounty p still?
It's used in here;
pDataF = new File(p.getDataFolder(), uuid + ".yml");
should I change that to just instance?
Yeah, you only need 1 instance variable.
Okay removed the p var, and changed pDadaF to pDataF = new File(instance.getDataFolder(), uuid + ".yml");
So did you re-add @EventHandler to your PlayerJoinListener class and retry it yet.
Trying rn, stby
As a FYI, you create the UserDataHandler object for the player in PlayerJoinListener but do not store it anywhere, so it'll be garbage collected after that event is fired. and created every time a player joins.
If it was supposed to be stored anywhere for obtaining information/storing information before saving.
It's still not creating the user config file
public UserDataHandler(UUID uuid) {
this.uuid = uuid;
pDataF = new File(instance.getDataFolder(), uuid + ".yml");
pDataConfig = YamlConfiguration.loadConfiguration(pDataF);
instance = CityRPBounty.getInstance();
}
public void createPlayerConfig() {
pDataF = new File(instance.getDataFolder(), uuid + ".yml");
if (!pDataF.exists()) {
try {
pDataF.getParentFile().mkdirs();
pDataF.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
pDataConfig = new YamlConfiguration();
try {
pDataConfig.addDefault("Bounty", 0);
pDataConfig.save(pDataF);
} catch (IOException e) {
e.printStackTrace();
}
}
package io.github.adrew1dev.cityrpbounty;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerJoinListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UserDataHandler userDataHandler = new UserDataHandler(player.getUniqueId());
player.sendMessage("Debug: PlayerJoinListener Works!");
userDataHandler.createPlayerConfig();
userDataHandler.saveUserFile();
}
}
you need to declare the instance before setting the file.
Otherwise instance is null.
instance = CityRPBounty.getInstance();
pDataF = new File(instance.getDataFolder(), uuid + ".yml");
pDataConfig = YamlConfiguration.loadConfiguration(pDataF);
Are you creating a file for every player?
or MySQL, as MongoDB is not usually offered at hosts if it's not on a VPS/Dedi, unless you want to do it in the cloud elsewhere.
I havent learned anything with MySQL yet thats why I didn't bother
It makes sense except you will have a impact to your performance writing/reading to files constantly, it may be easier as a beginner to do it via file, but should be moved to elsewhere.
if ya have relational data, yuh
but generally playerdata uses nothing relational
so my getInstance should be on top of all the file stuff
its essentially just for storing what players have a bounty and what players dont
without it resetting every time there is a server restart
well ideally you pass in the instance
not use a static getter
then it has to be valid!
Have not written plugins in a few years, so this could be likely heavily improved @junior shard, but it's meant to give a somewhat better concept. Here's a example that I wrote up via Notepad in a few minutes for two of the classes.
Main class
public class CityRPBounty extends JavaPlugin {
private final CityRPBounty instance;
public void onEnable() {
instance = this;
getServer().getPluginManager().registerEvents(new PlayerJoinListener(instance), this);
}
}
PlayerJoinListener class
public class PlayerJoinListener implements Listener {
private final CityRPBounty instance;
public PlayerJoinListener(final CityRPBounty instance) {
this.instance = instance;
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UserDataHandler userDataHandler = new UserDataHandler(player.getUniqueId(), instance);
player.sendMessage("Debug: PlayerJoinListener Works!");
userDataHandler.createPlayerConfig();
userDataHandler.saveUserFile();
}
}
Hopefully this helps somewhat to give a better idea as I am busy and cannot help for a few hours.
public final class CityRPBounty extends JavaPlugin {
private CityRPBounty instance;
[...]
public void onEnable() {
instance = this;
getServer().getPluginManager().registerEvents(new PlayerJoinListener(instance), this);
package io.github.adrew1dev.cityrpbounty;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerJoinListener implements Listener {
private final CityRPBounty instance;
public PlayerJoinListener(final CityRPBounty instance) {
this.instance = instance;
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UserDataHandler userDataHandler = new UserDataHandler(player.getUniqueId(), instance);
player.sendMessage("Debug: PlayerJoinListener Works!");
userDataHandler.createPlayerConfig();
userDataHandler.saveUserFile();
}
}
oop
well
No clue what I did?
But it's creating the file now
Literally didn't change anything, just came back an hour later and joined the server again and watched the file get created LOL
Thanks for y'alls help
Anyone know if there is a way to hold a player on the login screen of a server using paper?
question is why would you freeze the player in login screen?
I would like to stop a player from joining the server, if less than X number of players will be on at the same time. As such, I wanted to freeze them on the login screen until more players join
I realise that this is probably possible with proxies, but would like to know if it is possible to do without one
or a queue server
¯_(ツ)_/¯
Yeah, figured. Just wanted to know if anyone knew of a way for the use of this without a proxy
freezing players, is not good
you don't want to be stuck in loading screen when joining a server
True
If you want you can just never teleport them when they join the world
And gg they’ll be stuck on downloading terrain
Takes some editing in the spigot tho def not worth
Is InventoryView#getBottomInventory#getType always InventoryType.PLAYER?
Hey, is there a fix for this error? Basicly when i use the interaction event, when the player uses right click in the air it gives this fatal error for some reason.
java.util.concurrent.ExecutionException: java.lang.AssertionError: TRAP
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]
at java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[?:?]
at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:47) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:850) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:774) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:666) ~[patched_1.12.2.jar:git-Paper-1618]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.AssertionError: TRAP
at net.minecraft.server.v1_12_R1.ItemStack.F(ItemStack.java:117) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.ItemStack.setCount(ItemStack.java:892) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.PlayerInteractManager.a(PlayerInteractManager.java:441) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1064) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:26) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:5) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14) ~[patched_1.12.2.jar:git-Paper-1618]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) ~[patched_1.12.2.jar:git-Paper-1618]
... 5 more```
Code: ```Player p = e.getPlayer();
if(e.getItem() == null) return;
if(e.getItem().getItemMeta() == null) return;
if(e.getItem().getItemMeta().getDisplayName() == null) return;
if(e.getHand() != EquipmentSlot.HAND) return;
if( !(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK) )) return;
if(!(e.getItem().getType().equals(Material.valueOf(main.getConfig().getString("kraslot-item.item"))))) return;```
I had this error years ago, and the problem was updating a item that was air. So you definitely have other code for the listener.
@formal crane Possibly add this before your config check for a item.
if (e.getItem().getType() == Material.AIR) return;
I also suggest to either store the item name, or material in a variable on startup so you aren't constantly checking your config file.
if(e.getHand() != EquipmentSlot.HAND) return;
Material configuredMaterial = Material.getMaterial(main.getConfig().getString("kraslot-item.item"));
if(configuredMaterial == null) return;
ItemStack item = e.getitem();
if((item == null) || (item.getType() == Material.AIR)) return;
ItemMeta itemMeta = item.hasItemMeta() ? item.getItemMeta() : null;
if((itemMeta == null) && (!itemMeta.hasDisplayName() || itemMeta.getDisplayName() == null)) return;
if(!Arrays.asList(Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK).contains(e.getAction()) return;
if(item.getType() != configuredMaterial) return;
```This is just to clean your code not a fix lol.
As for your error above... No mention of a plugin so we don't even know if its your code causing an error.
hi i decided to learn how to make a plugin and this shows up
[15:23:38 INFO]: Enabling MinigameCreator v1.0-SNAPSHOT
[15:23:38 INFO]: [STDOUT] Hello World
[15:23:38 WARN]: Nag author(s): '[Special70]' of 'MinigameCreator' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
how do i make it not produce the [STDOUT] thing?
also don't mind the plugin name.
Add the flag for paper or remove it from their code because its BS and they shouldn't be telling you what logger to use.
hmm this happens prob because i used spigot from this tutorial (https://youtu.be/GK4aQzxQSoQ) and ran it using paperspigot
That's because you use System.out.println to log stuff in console
yeah just use the logger like it says
Hey
So I’m trying to get the team color
Using bw 1058 api
But I cannot for the life of me figure out how
Could anyone have a look?
Hello
I made a gui
But sometimes players can take out stuff from it
idk why
Like i want it to be when players tap it the events get cancled that works almot always but some times players can take still
Can you show us your classes?
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
ItemStack pick = e.getCurrentItem();
if (e.getInventory() != inv)return;
e.setCancelled(true);
Is it because of via versions
This Should work in cancelling right ?
.equals()
if (!e.getInventory().equals(inv)) return;
That will fix the problem ?
So basically I have a shared module between a bungeecord plugin that links all of the servers together with a spigot plugin and the shared project is not a plugin it's just a library and I'm trying to use it but, I have seem to be stopped by an error and I can't figure it out. When I compile the bungeecord plugin it just says could not transfer artifact "artifact of the shared module" from/to repository mvnrepositoy.com/artifact
i found what caused this error but i don't know how to fix it, this is the code:
hand.setAmount(hand.getAmount() - 1);
p.getInventory().setItemInHand(hand);```
You need to check if it's empty before trying to update it in their hand, as it's AIR.
I don't really think it's paper, as you should get the same error if you run Spigot.
no i mean the item is not air
oh wait the error is gone
i changed this code to this code: p.getInventory().getItemInMainHand().setAmount(p.getInventory().getItemInMainHand().getAmount() - 1);
Don't do this?
p.updateInventory()
after
too
ok so besides good organization when you are creating MC plugin
are there any performance benefits if i am going to make 5 classes for events or 1
BlockPlaceListener.class
BlockExplodeListener.class
BlockJumpListener.class
BlockSomethingListener.class
BlockBreakListener.class
is this better for performance or it doesn't matter at all, i can just make one class called
Listeners.class
and it'll have same impact on server?
Thank you in advance.
It won't
So basically I have a shared module between a bungeecord plugin that links all of the servers together with a spigot plugin and the shared project is not a plugin it's just a library and I'm trying to use it but, I have seem to be stopped by an error and I can't figure it out. When I compile the bungeecord plugin it just says could not transfer artifact "artifact of the shared module" from/to repository mvnrepositoy.com/artifact
i am asking this because i want to use single class for events but i think i'll need to add like 10+ events (to listen to) so it's better to ask
I'd personally separate the listeners by what they do, for example if you want to keep them grouped, it may be beneficial to keep the block events with each other, and then inventory listeners with each other etc.
BlockListeners, InventoryListeners if you don't want to keep them separated, but it's up to you.
with formatting your code, its best to keep everything grouped together so its easier to find and navigate to like kgm said
generally it goes just like
listener
- BlockListeners // keeps listeners regarding block events
- PlayerListeners // keeps listeners regarding player events
etc
ok beneficial;
in what way?
performance?
i am not 100% aware how java reads code and maybe it will really be better to separate them because of this, but i maybe gave too much examples while i am going to do pretty simple tasks but they involve 2-3 events each (so like 4-6 features * 2-3 events will be about ~15-20 events to be listened to)
my main concern is performance
There's absolutely no performance difference
Even if it was… it would be so negligible it is not worth your time to worry about it
its just for better readability and easier to find related code
No performance difference in how you separate the listeners in other classes, it's just organization and how I would recommend formatting, or by package.
Design your code for quality structure and readability, not for "performance"
thank you all !
The jvm is also incredibly, INCREDIBLY powerful at optimizing calls during runtime, so seriously, don't waste your time in this you'll be making yourself a favor
Anyone have any idea on how to help me?
I'd double check your Maven configuration and assert that you have the correct repositories listed where it can obtain the dependency from the error.
It's a module
I currently have it setup so shared doesn't have to be compiled
<dependency>
<groupId>com.orbixmc</groupId>
<artifactId>rank-shared</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
Did you specify the name for mvnrepository correct? as you are missing a r in the error.
r where?
In the error, it mentions Could not transfer artifact "artifact of the shared module" from/to repository mvnrepositoy.com/artifact, and mvnrepositoy.com/artifact where would that point as to me it is missing a r?
Oh.
I can't copy and paste it
hold on
I'll get the exact thing
Could not transfer artifact com.orbixmc:rank-shared:pom:1.0-SNAPSHOT from/to mvnrepository (https://mvnrepository.com/artifact/): Authorization failed for https://mvnrepository.com/artifact/com/orbixmc/rank-shared/1.0-SNAPSHOT/rank-shared-1.0-SNAPSHOT.pom 403 Forbidden
orbixmc is not a artifact location.
If you go to the url, it won't find anything past https://mvnrepository.com/artifact/com/
It's a local repository
^ that video shows what I did
because the classes that I use is in the other moudle
module
So what should I do?
ranks-shared is a module
<parent>
<groupId>com.orbixmc</groupId>
<artifactId>Rank</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath></relativePath>
</parent>
I've followed everything
still nothing
Wait
New error
I tried to package instead of install
Non-resolvable parent POM for com.orbixmc:rank-bungeecord:1.0-SNAPSHOT: Could not find artifact com.orbixmc:RankCore:pom:1.0-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 5, column 13 -> [Help 2]
Forgot I can't post screenshots
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
not sure, possibly repost the error and see if someone else knows how to solve it. I'll be back in a few hours and if it's not solved by then, I will take a look again.
https://i.imgur.com/C2RcQVY.png this is the error
Nevermind
new error
Could not transfer artifact com.orbixmc:rank-shared:pom:1.0-SNAPSHOT from/to mvnrepository (https://mvnrepository.com/artifact/): Authorization failed for https://mvnrepository.com/artifact/com/orbixmc/rank-shared/1.0-SNAPSHOT/rank-shared-1.0-SNAPSHOT.pom 403 Forbidden
I am working with sqlite at the moment but i have run in to a little problem, i am getting this error in my console and i don't know how to fix it, is there any fix to this?
Error:
java.sql.SQLException: Values not bound to statement
at org.sqlite.core.CorePreparedStatement.checkParameters(CorePreparedStatement.java:64) ~[patched_1.12.2.jar:git-Paper-1618]
at org.sqlite.jdbc3.JDBC3PreparedStatement.executeQuery(JDBC3PreparedStatement.java:73) ~[patched_1.12.2.jar:git-Paper-1618]
at be.razerstorm.rskitselector.utilities.sql.Database.initialize(Database.java:31) ~[?:?]
at be.razerstorm.rskitselector.utilities.sql.SQLite.load(SQLite.java:62) ~[?:?]
at be.razerstorm.rskitselector.rsKitSelector.onEnable(rsKitSelector.java:18) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:316) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:395) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:344) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:442) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:403) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:341) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:289) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616) ~[patched_1.12.2.jar:git-Paper-1618]
at java.lang.Thread.run(Thread.java:833) [?:?]```
Code:
```public void initialize(){
connection = getSQLConnection();
try{
PreparedStatement ps = connection.prepareStatement("SELECT * FROM " + table + " WHERE uuid = ?");
ResultSet rs = ps.executeQuery();
close(ps,rs);
} catch (SQLException ex) {
plugin.getLogger().log(Level.SEVERE, "Unable to retreive connection", ex);
}
}```
you did not provide the uuid
This error shows up in the onEnable
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM " + table + " WHERE uuid = ?");
preparedStatement.setString(1, uuid);
What is the purpose of the code?
ig loading the database
You also do not do anything with the result set by the way.
i have this in my main
private static Database db;
@Override
public void onEnable() {
saveDefaultConfig();
db = new SQLite(this);
db.load();
getServer().getPluginManager().registerEvents(new PlayerCloseInventory(), this);
getServer().getPluginManager().registerEvents(new PlayerConnect(), this);
GUIHolder.init(this);
}
public static Database getRDatabase() {
return db;
}
}
PreparedStatement ps = connection.prepareStatement("SELECT * FROM " + table);
public CompletableFuture<ArrayList<MatchCache>> fetchMatches(){
return CompletableFuture.supplyAsync(new Supplier<ArrayList<MatchCache>>() {
@Override
public ArrayList<MatchCache> get() {
ArrayList<MatchCache> bm = new ArrayList<>();
try {
PreparedStatement ps = sqlEngine.getConnection().prepareStatement("SELECT * FROM "+TABLE_MATCHES+";");
ResultSet set = ps.executeQuery();
while (set.next())
bm.add(new MatchCache(set.getInt("id"),set.getString("name"),set.getLong("createdat"),set.getString("type")));
ps.close();
set.close();
} catch (SQLException e) {
e.printStackTrace();
}
return bm;
}
});
}
@formal crane Something like this would be the logic for that
my code worked before i changed it from player to uuid (and i changed table names)
did you remove something like
rs.setString()
no
apparently this method isn't getting called here?
its calling db#load()
This is my full sql code:
SQLite.java = https://paste.helpch.at/dudehomani.java
Database.java = https://paste.helpch.at/yujeqedeki.java
whats the purpose of initialize method? like whats it used for?
here you are fetching on some UUID, but the uuid isn't passed also you are getting a result set but isn't proccessed to a meaning one...
the initialize method is called when starting the plugin (or atleast i think so)
connection = getSQLConnection();
try {
Statement s = connection.createStatement();
s.executeUpdate(SQLiteCreateTokensTable);
s.close();
} catch (SQLException e) {
e.printStackTrace();
}
initialize();
}``` load is called on startup
I am a bit confused over here....
most probably what the code is trying to achieve is caching the values...
Looks like you're missing a plugin or something?
What format is data usually stored in for velocity plugins? TOML?
Well now I have this
Failed to execute goal on project rank-bungee: Could not resolve dependencies for project net.mineworks:rank-bungee:jar:1.0-SNAPSHOT: Failed to collect dependencies at net.mineworks:rank-shared:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for net.mineworks:rank-shared:jar:1.0-SNAPSHOT: Failure to find net.mineworks:RankCore:pom:1.0-SNAPSHOT in https://oss.sonatype.org/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of sonatype has elapsed or updates are forced -> [Help 1]
When trying to compile
I mean its probably what you want to use since they already have a TOML library built in.
its nice, but I am not a big fan of the lib. well its pretty good but was missing a pretty important feature that I needed for something I am doing
so I just ended up using hocon lol
hi. is there a way of doing this but instead of the var being a boolean, it would only display the var if it wasn't null (a string) keyItem ? keyItem : ""
hocon these nuts
keyItem != null ? keyItem : ""
that makes sense ty
How can I save my hashmap to a file so that when the server restarts, the hashmap data isnt lost
I looked into serialization, but im not really sure how to do that. Is there a simpler way?
Well, you need to find a way to serialize both the key, and value. And then somehow link them. Do you want to save this in a db, or in some yaml file?
I planned on just saving it in a yaml file @hazy nimbus
Well, how does the map look like?
With Bukkit crap?
Key: Value obv
In my config.yml
Bounty List:
- ‘ ‘
I’m on mobile so I’m sure that looks weird
But yeah
that is a list

not a map
I know this is a list. However from my understanding the list won’t get the players name plus the bounty amount
uuid is more suited
yes thank you
Well yes I meant uuid, I would get the players name from their uuid in the sendMessage
okay
So I should put this in my config rather than the list that’s currently there;
Then how would I save it to the config and then get those values from the config when the command is ran
FileConfiguration#set("bounties", yourMap)
And getting is simple
you just loop over all keys
Same as normally saving config? Alright
No I get it
👍
Map<UUID,Double>
more like UUID, int
Yeah int not double
i dont think someone is able to get half bounties
i say double because money amounts can get that high
or more than 2147483647
unless you wanna set a limit of max interger limiy
I have a min and max setting
which is what sky just said
you dont need more, and for that you do long
why not long then?
yea
double allows for decimals
no one is able to get half bounties?
I don’t want decimals though, that’s why I was just using int
then use integer or long.
if you dont have more bounties than that it should be fine
what the
okay
then double
No I’m saying the people who want to set decimals just want to do that lol, was making a joke
i hope they dont try "joe"
oh

Np
make sure to parse the string as a double value, then check if its bigger then integer limit and a whole number
the argument
what is the max food level a player can have?
ight, thnx
I need a plugin which can set maxstacksize are there any or is it possible to do ?
Is there any good config updater out there?
What’s a config updater?
Something which auto updates your config files if you make a change to them in the code. So if you add a new feature or something to your plugin, your config.yml would be auto-updated and users wouldn't have to put the new key in manually.
Anyway, having a little bit of a problem here. I've an expansion (external) which is made for 1 primary plugin (A), and another optional plugin (B). You're supposed to be able to run the expansion just fine if you only have A installed, and if you happen to have B installed as well, you'll access the other parts of the expansion.
Now, here's the issue. I added all the needed checks to make sure B exists before running any code through it, but it still seems to whine whenever its not there.
Here's the code for the expansion https://github.com/mobarena/MobArenaPlaceholders/blob/master/src/main/java/org/mobarena/placeholders/MobArenaPlaceholders.java
And the error
Oh I can't upload pictures 
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
I'm most likely missing something pretty dumb but figured I'd ask here if someone has a better set of eyes lol
Hi, why ACF isn't shaded into the jar? https://paste.helpch.at/lalukiqufo.gradle
Are you running shadowJar?
well there is build.dependsOn shadowJar so it should ig?
Should this not be able to change the player skin? Nothing happens when I change it
public static void updateSkin(Player player, String skinURL, String signature) {
ProfileProperty skinProperty = new ProfileProperty("textures", skinURL, signature);
player.getPlayerProfile().setProperty(skinProperty);
}
I don't think depending on it will make it give you the right jar
And why though? I mean you're already running "build" why not run "shadowJar" instead?
You need to resend player info packet g
So do you know any?
Do you mean like it updates automatically and adds the new features from the previous version?
Idk just make one
yep
you can just do like
save a list of all the config values & their default values
go through all of them
if value != exists
config.set(path, defaultValue)
config.save()
https://www.spigotmc.org/threads/⚡-boostedyaml-standalone-yaml-library-with-updater-and-comment-support-much-more-5min-setup-⚡.545585/ I found this via mobile
This is what i do
public enum ConfigPath {
BOT_TOKEN("bot.auth.token", true, null),
BOT_OWNER("bot.auth.owner-id",true,"40356952"),
PASTE_ENABLED("paste-settings.enabled",true,true),
PASTE_COOL_DOWN("paste-settings.cooldown",false,null),
PASTE_GLOBAL("paste-settings.global",true, true),
PASTE_CHANNELS("paste-settings.channels",false, null),
MESSAGES("messages",false, new ArrayList<>())
;
private String path;
private boolean isStrict;
private Object def;
@Override
public boolean validateConfiguration() {
Debug.debug("Starting to validate configuration options!");
AtomicBoolean valid = new AtomicBoolean(true);
ConfigUtils.getStrictEnums().forEachRemaining(enumPath -> {
if(!this.baseFile.contains(enumPath.getPath())){
if(enumPath.getDef() == null) {
valid.set(false);
Debug.err("Configuration Option " + enumPath.name() + "[" + enumPath.getPath() + "] is a strict field. Its missing!");
}else {
this.baseFile.set(enumPath.getPath(),enumPath.getDef());
Debug.warn("Configuration Option " + enumPath.name() + "[" + enumPath.getPath() + "] is a strict field and seems missing, replaced with a default value");
}
}else {
if (StringUtils.isEmpty(getString(enumPath.getPath()))) {
if(enumPath.getDef() == null) {
valid.set(false);
Debug.err("Configuration Option " + enumPath.name() + "[" + enumPath.getPath() + "] is a strict field. It can't be blank");
}else {
this.baseFile.set(enumPath.getPath(),enumPath.getDef());
Debug.warn("Configuration Option " + enumPath.name() + "[" + enumPath.getPath() + "] is a strict field and seems blank, replaced with a default value");
}
}
}
});
return valid.get();
}
no
that just deletes all comments
yep
Ultra bad enum lol
I am open for suggestions
how long does it normally take to get a priced resource on mcm approved
bruh one channel is enough
oo
I don't particularly know what is causing this to happen. Anyone have an idea? (I think it might be a fork of SlimeWorldManager; ASWM. But not completely sure and I hope not because its integral to my setup 
Server crashing from IllegalStateException
Crash-report: https://paste.helpch.at/quhiqeweha.cs
the api supports comments tho, idk what you're talking about
set() will remove the comments
nah not really
yes, it does
except for the header
do u know how long it takes to get an mcm resource approved (paid)?
wtf conclure
and, if i keep updating it will it get longer
a few days
lol yeah quite the new and refreshing addition
ty
working on a GsonConfiguration pr also lol
Does anyone know of a library that:
- You can feed an
ISO-639-1code (such asEN) - The library will find the subset of unicode used by that language (in this example, [A-Z] [0-9], etc.).
- (Optionally) the library will have a method to filter a string to remove all characters that are not within the locale?
nice
https://stackoverflow.com/questions/61600701/how-to-get-all-national-characters-for-selected-locale basically this. For the languange, you can use the Locale class, but idk how to properly get to the corresponding UnicodeScript object
Thanks so much! That definitely points me on the right track!
for some reason this line don't come back truereturn placeholderValue.equals(this.placeholderStr);
equalsignorecase works not sure why equal won't
how can i make a function in java ?
i dont understand the articles in the internet :/ i want to teleport a player to a location, but thats too many code to use everytime. so i want to create a function like "player.resetlocation()" :D
losing brain cells, but you cannot add a method to the player object without modifying your server jar to add support. Simply make a method that teleports the user that takes in the player object and teleports them to the location.
it should look like java public static void resetPlayer(Player player) { player.teleport(new Location(0,0,0)); }
or whatever you actually want to do
@neon wren i did it in my core
its on my github in KatCore if u wanna look
without editing spigot.jar
Hey! I want to execute a simple mysql query in java with apaches dbcp but everytime i do, the connection gets lost and the main thread with its server completely collapses...
I know this error is very specific but is there maybe a chance that anybody has had the same error before?
May i ask why you implemented and overridden all methods but with the same functionality?
Yea, forgot that Player is an interface in the api
you are extending Player? 😵💫
Just use kotlin op
Uhhhh, when using Player#sendMessage(Component) am i supposed to be getting a ALERT right before the message or is this some plugin doing something weird on my server? (Paper 1.17.1) ignore bad grammar in photo its debug
When i send a message to a CommandSender this doesnt happen
prob part of your code lol
No im only sending the text in red on that message https://imgur.com/H1ZZMrN
https://imgur.com/ptEoEXo and the config yml
wait, i have the string as broadcast

tf does really sending broadcast beforehand in sendMessage really do that
why is that not in javadocs 
Common sense 
i wouldnt use paper to code tbh
i mean, not compatible with spigot when using components
so i rather using strings
Im only using it cause im making this plugin private for my paper server
So this is, indeed a certified papermc moment
If it was open source i would likely use spigot code
¯_(ツ)_/¯
equals and equalsIgnoreCase do different checks
what should i type so it would trigger if a player takes any kind of damage?
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent
Anyone know why when I add a string to a list in my config using a command, it decides to either replace all the contents of the config with the value I set, or it works, and it starts to fuck around with strings listed in the config
Either does this:
"Amount Not In Range" was messed with for some odd reason
or it just does this to the entire config:
bList.put(target.getUniqueId(), bountyAmt);
List<String> hashmapData = new ArrayList<String>();
for (UUID bUuid : bList.keySet()) {
String data = bUuid.toString() + ":" + bList.get(bUuid);
hashmapData.add(data);
}
CityRPBounty.aPlugin().getConfig().set("Bounties", hashmapData);
CityRPBounty.aPlugin().saveConfig();
CityRPBounty.aPlugin().saveResource("config.yml", false);
if I just use #saveConfig, it shows up like the 2nd picture
With the code I just put, it results in the 1st picture
Please don't use have that kind of storage, just have a key and then the value, don't just stack em together
how do I make the hashmap's UUID a key under "Bounties"
just save a list of objects
config.createSection("Bounties."+uuid) iirc (returns ConfigurationSection)
Or if that was what u wanted
@junior shard you don’t need saveResource you should only need save config.
Without save resource, it overrides the entire configuration file @pale swallow
Oh I see you are using the default config file to save data
Yeah
I mean I could just make a different config and do that, but it just seems simpler to put it all in one ifle
file*
To retrieve this into a list, how would it be done?
skins:
0:
signature: (signature)
base: (base)
1:
signature: (signature)
base: (base)
etc....
If there's a better way to do this, please do tell me
iterate over the keys of skins?
could as well just store it as signature;base if the name is not needed
As in one long string? Which is then separated?
no please don't squash data in one field
Agree xD bad idea
bukkit has ConfigurationSerializable, which isn't the most beautiful thing on earth, but it works pretty well for stuff like that
u mean section or?
Nah, is bukkit's version of Serializable for yaml configs
d;spigot ConfigurationSerializable
public interface ConfigurationSerializable```
ConfigurationSerializable has 1 methods, 10 implementing classes, and 24 sub interfaces.
Represents an object that may be serialized.
These objects MUST implement one of the following, in addition to the methods as defined by this interface:
- A static method "deserialize" that accepts a single
Map<String,Object> and returns the class. - A static method "valueOf" that accepts a single
Map<String,Object> and returns...
This description has been shortened as it was too long.
with that, you could simply save and load e.g. List<Skin>
mm?
getList and cast
But wouldn't getList just return a list of the indexes?
Sir, wont it expect to be a list though?
skins:
- signature:
base:
- signature:
base```
Yeah but that wouldn't work either tho?
Why not
Wouldn't it contain all of the signatures and base64's separated? I need them in pairs
thats how the serialization works, it is a Map<String, Object> because the key is signature and the value, the value
No, each element of the list will be a Skin with all the values you want
Ohhh so it returns a List<Map<String, Object>>?
It would be just a map
You make Skin implement ConfigurationSerializable, add the required method / constructor that takes a Map<String, Object>, reguster the serializable with ConfigurationSerializable#register, and then use getList and cast it to List<Skin>
But, as I said, I dont think it will see that as a list
yeah that won't be seen as a list, but that's also a very error prone format
So it would not work if I were to add a 3rd value to the skins?
like skinName
It will, just modify your class structure
The map from that method will have all the values from config, from there, you do whatever you want with the data
Just not sure what the map contains then, using this example the map would contain the signature as key and base as value or what?
Or this instead
skins:
- skin_name: testOne
signature: someSignatureOne
base: someBaseOne
- skin_name: testTwo
signature: someSignatureTwo
base: someBaseTwo
Doesn't it only contain one of the skins then? I guess I need to create a ConfigurationSerializeable for every skin then?
what
to see how the list would look like, it's probably best to just generate one with example skins

when I started using HOCON and TOML I didn't know how it would look so I just generated a bunch of random things to learn. best way to do it unless you can find some good documentation
not that I ever really learnt toml but hey I tried
unless you can find some good documentation
and as we're speaking of spigot...
well its YAML. there's documentation in other places
the spigot serialization stuff is somewhat special
?help
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait
im looking at how many skyblock plugins figure out where to place the next island and it seems to me that they just take the last island that was generated and then pick a direct north east south or west, check if there is an island there and then create the island there. it looks like island generation is kinda random as to where an island is created but each point is connected directionally to another island. what im trying to figure out is why this is used instead of some math shape like a square spiral or whatever.
What do you need?
i wanted to figure out what the best method for deciding where to generate the next island was.
like im not making a skyblock plugin but im using the island idea for generating personal mines.
i guess that this method is probably the fastest but doesnt have any organization and could leave certain grid chunks empty
well they wont be next to each other
So yes new world
a new world for each island?
Yea sorta how hypixel does it
But they have there own format
Instead of region files
Why would you have a single world per island
Why wouldn’t you lmao?
and thousands of small servers
inefficient I guess
thats a fuck ton of worlds lol
You can’t expect good performance either way with spigot In normal state
Best just go optimize workds
And make a system much like hypixels
If not capable sure just do same world lol it’s whatever
i dont have the funding for a server per island
“World” per island
Not server
Would take fair spigot editing to do something nice tho as I said
having alot of islands in one world would probably be better then having thousands of worlds
guess ill copy other skyblock plugins and do the relative island creation thing
Look at hypixels thing if you want a good system
Can even use there format
Hey!
Have you read one of our dev blogs before? Here's one on our use of Grafana, a tool to generate a bunch of graphs about Hypixel. In these dev posts, we talk about how the technology works on the network.
Today, we'll explain how we handle the storage of player islands on Hypixel SkyBlock...
hypixel has a good system, i dont have the server space for the islands
its not viable with little space or even no ssh access
i have no clue how many could join
probably a pog server host he's using
even with a dedi you cant fit that many 1.18 servers on it, depends on what cpu it has
its a prison server.
Even nicer to use seperate worlds
im going to go off the fact that every skyblock plugin thats publicly available has every island in a single world its better to have them in one world.
“Better” because they are making it for the public who have everything unedited. If you are making a server and have the ability to edit anything then I’d say it’s not better but yea sure
ive been told that more worlds == bad in more places then not
cause apparently minecraft struggles to handle 3 worlds
Yea In default spigot 100%
i dont have the knowledge to modify the spigot code, i just know some plugin dev shit
imma just do what other plugins do, itll work
I see that’s fine
maybe in the future when i or someone else who im working with has the space for that sort of concept it could be realized instead of struggling cause im poor
worlds are overrated, implement the Hypixel file format!
or better yet! work for hypixel and then you dont have to implement it yourself!
i have read it previously
it is
if i had infinite time, i would definitely implement that
or add it to something like Minestom
im not experienced enough to understand what half of it means but its interesting atleast
just helps to address world loading issues with the Notchian Region file format
in the future i will tho
good for lots of small worlds
which is basically hypixel skyblock, small islands spread over hundreds of small servers
Idk if this is possible or the right place to ask but is it possible to setup a bungee server on 1 server rather than having to buy 3 separate servers?
why would you do that? the point of bungee is to connect multiple servers
Basically to have each server in a separate folder
Depends on the host
get a VPS or a dedi and you'll have that option with multiple servers. im assuming ur issue is that you have to connect to multiple ftp things at a time
But I’d believe most hosts out there straight up prohibits you from doing that
I’m using pebble
I've got a config class that looks like this, I have an issue when saving though, it overwrites the config file since mapFile isn't being updated I assume, but I'm not sure how it should be updated properly, any suggestions?
bump, still running into this problem constantly
Why must discord.js hate constructors -.- lol
Isn’t discord js quite procedural and functional? (Yes they have some objects and classes but those aren’t all very object oriented)
Plugin updated and support 1.17?
this class has an issue on line 88 not sure why or how to fix https://paste.helpch.at/unifomakup.cs
I cannot share my screen in discord, I tried different servers and individual chats
and it wont let me
are you able to use primitives in generics in the new java versions without autoboxing, or does it just defer to autoboxing? b/c List<int> list; isn't showing me an error 👁️
and if so, does that reduce the performance margin of something like fastutil?
Not in normal Java. Per the JEP https://openjdk.java.net/jeps/8261529, it is in Preview mode right now
It would significantly, but it is a massive undertaking so they are taking it real slow
If I recall, this is like the 3rd version it has been a preview feature in
That would be so nice
But yeah that is one of the biggest things Java is working on to change, that and stuff like reification
uh, label110 is only mentioned in that line
This very much looks like weird deobfuscated code, looks like it missed a loop label?
I know I changed that to many things and it breaks other lines
no clue who wrote it, it was in a class of Statz, trying to update to work on 1.18
definitely deobfuscated
nobody names their exception catch var37 lmao
this stuff is bizarre I must say
like it gets the database connector twice and doesn't assign it to anything?
guess I should read up on how to update DB's and re-write the whole class
I mean most of it looks pretty good
just the isPatchNeeded class is literally deobfuscated code
wait a second
where did you get that from
cause the GitHub for Statz looks great
Wait you don’t? But then other people would be able to understand your code which is very bad.
like someone else's lmao? cause that shit sucked
don't use that code
use the real stuff from the link I sent
although even that could be improved if I get what it's doing
that is weird I download via Github desktop and that code on page you found works fine
yeah dude I don't know what you downloaded but it was a weirdly decompiled version of the real code
maybe something wrong with my github desktop cause it keeps breaking link for uploads
yeah i just don't use github desktop lol
it's a single command to clone, and IJ has an integration as well
I seen that somewheres when I was attempting to fix desktop, guess I will remove it and us commands
is there any reasonable way to read and parse only part of a json file?
i'd have a json file with a field like "name", then several other objects as fieds that can become pretty huge in size and hefty to load, and sometimes i would want to read the "name" field of the object without parsing the entire thing
any way to do that without manually reading the bytes of the json until i have what i need?
well this version still crashes my server, not sure why my builds don't work
https://github.com/doubledutch/LazyJSON this might be of some use
Not sure, to parse JSON you have to know the start and end of everything to form the AST
but it looks like this is pretty lightweight
it crashes your server lmao? did you get the whole thing from GitHub or just the class I sent lol
I will have to make sure what I have is the same as on github
Why am I all of a sudden getting this error with my chat plugin?
CityCraftChat.java https://pastebin.com/kRNL56sv
I'm not sure if commands can have numbers in them
And make sure you declared that command in your plugin.yml
send your plugin.yml
I started to add more chat channels and thats when it broke, so I commented out the getCommand for the new channels and took the commands out of plugin.yml and still no luck
name: CityCraft-Chat
version: 1.1
author: aDrew1
main: com.adrew.citycraftchat.CityCraftChat
soft-depend: [LuckPerms]
commands:
global:
description: Send a chat viewable globally to the server; no radius.
usage: /global (message)
g:
description: Alias for /global.
usage: /g (message)
advert:
description: Send a chat advertisement viewable globally to the server; no radius.
usage: /advert (message)
rp:
description: Send a roleplay chat. This is to resemble an action you are performing. (/rp covers eyes)
usage: /advert (message)
dispatch:
description: Send a message in the police radio.
usage: /dispatch (message)
911r:
description: Send a message in the police radio.
usage: /911r (message)
I just removed the jar from the server, restarted it, added it back, restarted it again, now its working just fine 
and /911r is working correctly
huh
so im not exactly sure what its deal was, guess my server is just having a stroke
maybe it just didn't register that command for some reason
Does a mc server need more ram if its ddr3?
Thinking the same…who sells DDR3 now…unless GCP or so…
Is it do bad?
I don’t know whether its bad or not…but hosts seems to be competitive….
Its a beta but they seem to have updated it to work fine with 1.17
I'm trying to code a plugin with a certain recipe, and this basic idea:
3 Heads (with the same SkullOwner), and some other items, could create a Ban Item (probably a beacon), when the beacon is placed down, and after a confirmation, the player (who's 3 heads where used on the crafting recipe) would be banned.
I've made recipes before, but i'm not sure how exactly to make the recipe only work if all 3 player_heads on the crafting table have the exact same SkullOwner, and if they don't the crafting recipe will not show up.
I'm also not sure how to assign the player's name to the Ban Item, so that when the beacon is placed down, it would only ban the SkullOwner of the 3 heads.
Here's the code so far:
public void onEnable() {
ItemStack ban = new ItemStack(Material.BEACON,1);
ItemMeta banmeta = ban.getItemMeta();
banmeta.setDisplayName(ChatColor.RED + "Ban Item");
ban.setItemMeta(meta);
NamespacedKey bankey = new NamespacedKey(this, "ban");
ShapedRecipe banrecipe = new ShapedRecipe(bankey,ban);
banrecipe.shape("STG","HHH","GTS");
banrecipe.setIngredient('S', Material.NETHERITE_SCRAP);
banrecipe.setIngredient('T', Material.TOTEM_OF_UNDYING);
banrecipe.setIngredient('G', Material.GOLD_BLOCK);
banrecipe.setIngredient('H', Material.PLAYER_HEAD);
Bukkit.addRecipe(banrecipe);
}
(Not too sure if this is the correct channel for this, but i posted in #general-plugins and #general-plugins-2 aswell)
It's the correct channel. I wouldn't recommend asking in multiple channels though.
Alright, won't do again haha
Also, what would be the easiest way to keep track of the players that have been banned from a Ban Item like this?
Hi, when i try to import PlaceholderAPI libraries it drops me this error:
The import:
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
The error:
The import me cannot be resolved
I am using eclipse IDE with a spigot 1.18.1 jar, java 17 and I have set up the placeholder api external jar
I'm new here, so i might be completely wrong, but i think errors and config problems belong in #general-plugins / #general-plugins-2
nah that's fine since he's developing the plugin
I think that is for plugin's help, I am developing my own plugin, btw I'm not sure, I am new too
Ok ty
Alright :D
I'm completely new so i still don't understand anything LMAO
Would it be easy-ish to make a version of this here for GitHub's Octicons?
https://github.com/simpleicons/simpleicons.now.sh
How can I make a player mentioning thing in my AsyncPlayerChatEvent?
I need it to replace the player's name in the message with &b&m@%playername% ONLY if the player is online, as well as play a sound to the player that was mentioned
Im just not really sure how to go about it
I'm trying to code a plugin with a certain recipe, and this basic idea:
3 Heads (with the same SkullOwner), and some other items, could create a Ban Item (probably a beacon), when the beacon is placed down, and after a confirmation, the player (who's 3 heads where used on the crafting recipe) would be banned.
I've made recipes before, but i'm not sure how exactly to make the recipe only work if all 3 player_heads on the crafting table have the exact same SkullOwner, and if they don't the crafting recipe will not show up.
I'm also not sure how to assign the player's name to the Ban Item, so that when the beacon is placed down, it would only ban the SkullOwner of the 3 heads.
Here's the code so far:
public void onEnable() {
ItemStack ban = new ItemStack(Material.BEACON,1);
ItemMeta banmeta = ban.getItemMeta();
banmeta.setDisplayName(ChatColor.RED + "Ban Item");
ban.setItemMeta(meta);
NamespacedKey bankey = new NamespacedKey(this, "ban");
ShapedRecipe banrecipe = new ShapedRecipe(bankey,ban);
banrecipe.shape("STG","HHH","GTS");
banrecipe.setIngredient('S', Material.NETHERITE_SCRAP);
banrecipe.setIngredient('T', Material.TOTEM_OF_UNDYING);
banrecipe.setIngredient('G', Material.GOLD_BLOCK);
banrecipe.setIngredient('H', Material.PLAYER_HEAD);
Bukkit.addRecipe(banrecipe);
}
Save the uuid of the player you wanna ban in the items PDC (if items have one, I’m not sure) or just use the lore
If you write a small method to put a color code character between each character you can make the uuid invisible to the player holding the item, just make sure to strip it after
This might help with keeping track of the banned players, but won't help with the crafting recipe
Put the player UUID in an nbt tag perhaps?
can't you create recipes using ItemStacks instead of materials?
oh but then you'd have to create a recipe for every single player that joins
Exactly
I guess you could listen for the PrepareItemnCraftEvent or whatever its called
actually. I Don't think you can change the recipe there
Yeah but how would I set that up only when all 3 heads have the same skullowner
if you use Paper, you can use the PrepareResultEvent
I Don't think there's a way to do it on spigot
I posted it on Spigot forums and someone told me i should use RecipeChoice instead of a Material.
But i'm still really confused on how i would do this lmao
I wouldn't use a resource of an author who clearly doesn't know what they're doing
Bruh
iam asking a question
obviously tried it on other projects
btw if ur so smart give me a project to see if it works on that
yeah that template is shit, you're just making your life worse by using it
you'd need to manually add random jar files to the classpath at compile time
what
bruh it still doesn't work
you don't need to delete your old question just to post it again
the way to properly import an API is to use maven or gradle
Could someone help me with this please :)
how do you include PAPI? Are you using maven or gradle?
i have maven and gradle support
iam using intellij idea ultimate and it is not importing 1.18.1 jar as an external library
https://www.spigotmc.org/resources/uberitems-powerful-and-fun-items-lite.64923/
this import works
but 1.18.1 doesn't work
https://github.com/ThirtyVirus/UberItems_CustomAddon_Template
here is the project
uberitems custom addon template
My question is how to import 1.18.1 properly and why this would happen
ok wtf is wrong with config.yml
plugin loads, config values are read
I remove some config values, reload the config, save it
they are not in the file, but are still in memory
If a value is removed, it defaults to the one on the jar
Is there a way to override commands in matt commands framework? So code like this will work? ```java
@SubCommand( "create" )
public void createEvent(Player commandSender, String name, Integer count, Integer duration) {
createEvent(commandSender, name, count, duration, 4);
}
@SubCommand( "create" )
public void createEvent(Player player, String name, Integer count, Integer duration, Integer height) {
}
basically arguments with default values
Very annoying imo, but that’s how Bukkit configuration works. Only way around it is to create your own configuration system
or just optional commands arguments
I'm checking if the section exists
it shouldn't default to one in the jar
@pulsar ferry ?
Yea I think it does
If it’s not in the Config.yml it defaults to the one in the jar
That applies to getting values, sections, and everything
Interesting, that’s nice to know
The last argument can be marked as optional with the annotation
@Optional
i have maven and gradle support
iam using intellij idea ultimate and it is not importing 1.18.1 jar as an external library
https://www.spigotmc.org/resources/uberitems-powerful-and-fun-items-lite.64923/
this import works
but 1.18.1 doesn't work
https://github.com/ThirtyVirus/UberItems_CustomAddon_Template
here is the project
uberitems custom addon template
My question is how to import 1.18.1 properly and why this would happen
The correct way to import it would be with a build tool like gradle
iam using it
that's what I said already, they're reposting their message the whole time
can u try importing 1.18.1 into my project
if you're using gradle, you can share your build file and we can take a look at it
yeah I saw this in the docs
wouldn't overriding methods be better?
I mean its how it worked in aikar ones IG
in yours it just ignores overridden methods
and this @Optional annotation would not be needed anymore
Overriding gets a lot more complicated than you think
so it would be ```java
@Subcommand("test")
public void test(CommandSender sender,Integer arg){}
@Subcommand("test")
public void test(CommandSender sender,Integer arg,Integer arg){}
etc...
wdym
also annotation ```java
@Subcommand("test")
public void test(CommandSender sender,Integer arg,@DefaultValue("1")Integer arg){}
^ this would be nice too
but overriding probably the best
you would just need to match number of arguments no?
and types
It slowly starts to bloat, comparing arguments, and then other annotations, etc
I tried this one before and sounds simple but gets very complicated to implement well and the uses aren't that many
However default value sounds good
ah okay then
well default value should be enough
so if player does not specify arg default value is used
type and amount of args must be checked there too
similar problem
Anybody
Click on the full post for more deets
look what you're already doing
you check the pl distance
so just check if it contains pl.getName()
and replace
here have the source code for mschat chat listener https://paste.helpch.at/zisaxowive.java
beware it's old code
fixed it
Hey so im trying to set a player's nametag color to a diffrent color using teams. It creates the team ect... but it doesn't set the color correctly, if I use the minecraft /scoreboard command it does work tho! Could someone help 😅?
public void createPlayerTag(ChatColor color) {
Scoreboard scoreboard = player.getScoreboard();
if(scoreboard.getTeam(player.getName()) != null) {
scoreboard.getTeam(player.getName()).unregister();
}
Team playerTeam = scoreboard.registerNewTeam(player.getName());
playerTeam.setColor(color);
playerTeam.addPlayer(player);
}```
use addEntry(player name) @odd prawn.
I believe that .addPlayer has been deprecated since 1.9 when scoreboards allowed non-player entries.
yea fixed it already,
for some reason setColor doesn't work now im using playerTeam.setPrefix(""+color);
addPlayer still works tho
probably does, I think it's deprecated though.
True, I will use addEntry
So... spigot removed the event call when a block falls...
Block falls?
Yeah as in the EntityChangeBlockEvent call that works in 1.8-1.18.1
Then in 1.18.2, poof. it's gone
I'm willing to bet it's a mistake tbh, as the only thing in the commits is a different change in the same class
Hmm
Yeah, the class is there, but previously, it was called when Block -> FallingBlock and FallingBlock -> Block. Now it's just FallingBlock -> Block
So like when sand goes from Block to a FallingBlock, the event no longer fires then
omg mschat LOL
I mentioned it before too lmao. I see exactly what you wanted for that plug-in in the one you’re making now
Yikes indeed
I am just sending an embed (discord js) but there is a problem, i have a function to create the embed but the returned embed is null but i know that the const embedd is not null
code:
await util.status('play.hypixel.net', 25565, options).then(result => {
const online = result.players.online;
const max = result.players.max;
const embedd = new Discord.MessageEmbed()
.setTitle("**MC| Status**")
.setDescription(`${online}/${max}`)
.setFooter(`© MC`, guild.iconURL({ dynamic: true }))
.setTimestamp()
return embedd;
});
}```
then() doesn't return anything
Don't combine await and then syntax
Just use await
const result = await util.status('play.hypixel.net', 25565, option);
// use the result
ty
is there a way when you break a block to detect if block was placed by a player before?
i am trying to make an auto updating embed that will update every x seconds, only there is a problem because i cant use await to use the embed function, any workaround?
if (messages.size === 0) {
channel.send({embeds: createembed()}).then(function(m) {
try {
setInterval(() => {
m.edit({embeds: createembed()});
console.log("UPDATE!!!!!!")
}, 30000);
} catch (error) {
return console.log(error);
}
});
}
})```
error when trying `createembed()`: https://paste.helpch.at/dunodatova.coffeescript
You have to edit the original message I'm dumb
Make the function you're in async, and then you can await it @formal crane
const messages = await channel.messages.fetch();
const embed = await createEmbed();
const sentMessage = await channel.send({ embeds:[embed] });
setInterval(async () => {
const embed = await createEmbed();
// update the message
}, 30000);
I am not in a function while trying to create the embed
You could put it in a function
So i should make a second function?
Wouldn't hurt tbh
What am I doing wrong here? Why is it messing with the chat message after the player is mentioned in chat. But any text before you mention the player works fine
ChatListener.java: https://pastebin.com/WwxEjZAw
nvm
stupid fucking error
String mentionMsg = msg.replace(ChatColor.stripColor(pl.getName()),
"&b@") + ChatColor.stripColor(pl.getName());
I was re-looking over the code and saw that there and thought "That aint right". Sure enough it worked when fixed lol
it might be better to save a local variable instead of replacing the player's name twice for strip color.
Doubt it's a huge performance different though if any.
But as you use it multiple times (it may be beneficial)
String plName = ChatColor.stripColor(pl.getName());
if (distanceTo <= blockDistance) {
if (msg.contains(plName)) {
String mentionMsg = msg.replaceAll(plName,
"&b@" + plName + CityCraftChat.plugin.getConfig().getString("LocalChatColor"));
wa-la
I added a variable for the config strings as well; makes it easier on my eyes
might be a bug. there are always things that get missed when updating, so you could look if there is a bug report on spigot jira, or otherwise create a new one yourself
ah well, already fixed: https://hub.spigotmc.org/jira/browse/SPIGOT-6962
had that last week too, bug was fixed by md_5 after like an hour
Hi everyone
I haven't coded plugin for a while. (last time i coded in 1.16, now i'm using 1.18) i wanted to use bungee api but can't import it. Is it deprecated?
How do i prevent my MySQL connection using JDBC driver from disconnecting after idle timeout?
Hello does anyone have Experience with .json file code and resourcepacks?
i really need help
I'm Trying to make a sword smaller using .json and when i do that, i hold the sword incorrectly
bungee is not deprecated
wrong channel @near shale this looks more like a question for #minecraft
ok
how can i change this with a texture pack
how do i upload image lol
i guess ill do it with gyazo
heres the photo
unicodes
doesn't really seem like development but somebody started making tutorials recently and posted in #showcase
sorry
ah, hasn't gotten to custom gui yet #showcase message
tysm
👍 google is your friend
I'll start working on that one now 🙂
technically this was pause menu, but close nuf. Love the tutorials
It uses some of the same stuff, I'll put examples of a few different things on the font textures page
Anyone here who could recreate ChunkCuller plugin but for 1.18.2?
Does anyone have any good GUI APIs?
tbh
Thanks.
yes very gud
I have a few classes for storing player data. Mainly two, NetworkPlayer, which holds things like rank and gold for players that are offline, and OnlinePlayer, which holds a ton of other data for only players that are online, OnlinePlayer extends NetworkPlayer. I have a system, so that when a player joins, it checks if there is a currently cached NetworkPlayer for their uuid, and if so, turn it into a OnlinePlayer, if not, make a new OnlinePlayer. for some reason, when a player joins for the second time none of the stuff in OnlinePlayer effects the player, like sending text to their title. I did some debugging and the caching works, idk what is the issue. HEre is the code: https://paste.helpch.at/nokibapixo.cs
Thanks in advance!
well because you don't create it again
I create it again for both sections in the cachePlayer method
no, you create it only when the player isnt already in the cachedOfflinePlayers list
OnlinePlayer oplayer = new OnlinePlayer(cachedOfflinePlayers.get(i).getOfflinePlayer().getPlayer());
it creates a new one in the loop
Trying to use ProtocolLib to spawn a glowing/invisible shulker. I got the shulker to spawn but I'm not sure how to modify the metadata on the entity. I was reading and apparently minecraft removed DataWatchers?
Anyone know how I can achieve this with ProtocolLib or ProtocolWrapper?
Does anyone know the best ways to avoid overloading issues with Bukkit Runnables? I'm using it for scoreboard and bossbar animations.
packetevents 2.0 has full wrappers for spawning entities and entity metadata, but it also isn't stable
Yeah, the 2.0 branch has the feature you want
But this branch loves breaking because there’s a mess with injectors being fixed right now
ProtocolLib messed up their injector in 2013 and it’s been hacked around until now, when new injectors can’t be made anymore
painful... So is there no way to do this with protocol lib (I also added my code to my original message)
I feel like all I would need to do is to assign the ENTITY_METADATA packet to the entity I just spawned and I THOUGHT I just needed to set the entID in the packet with the one I used to spawn it and just use getEntityModifier(l.getWorld()).read(0) but that did not seem to work lol
How would I add a new line in text components?
Component.newline()
How would I go about setting an item to a colored glass pane in Spigot 1.8 using the Materials class?
Wdym overloading
presumably exhausting the thread pool
yeah, the bukkit thread pool is infinite
🥶
Try not running stuff when you don’t need to
setDurability()
infinite as in you will get the entire server killed for trying to use it like it's infinite
I mean that’s just how computers work
It’s like 500 threads in pterodactyl
the best I was able to do was this because I could not apply invisibility (potion effect) to the fake entity. Not exactly what I wanted but hey it works slightly 
Entity#setInvisible 
So i am trying to make an auto updating embed in javascript (discord js) and i create this embed with a function that will get information from an api etc etc but the problem is that the discord bot is trying to send/edit the embed while the function hasn't returned anything (normally i would just use wait but that doesn't work here). How would i resolve this problem?
Full code: https://paste.helpch.at/oliligafuv.js
I want all classes in a package to register events, but don't want to add them all manually. So I'm using reflections to do it, however I can't get it to work. I currently have this. The events do not register in-game. All classes implements Listener and have @EventHandler. java for (Class<?> clazz : new Reflections("me.sniskus.helix.artifact.features.events").getSubTypesOf(Object.class)) getServer().getPluginManager().registerEvents((Listener) clazz.getDeclaredConstructor().newInstance(), this);
dont you need smth like this? https://www.baeldung.com/reflections-library#1-subtypes
and might want need subtype of Listener.class
SubTypesScanner is deprecated tho?
Ahh
Nvm
Changing getSubTypesOf(Object.class) to getSubTypesOf(Listener.class) worked
I didn't think you could add an interface to it
Thank you 🙂
beetroots is not working ? https://paste.helpch.at/xalilarusa.php
probably isnt beetroots then
have you tried debugging? aka printing what blockBroken.getType() returns?
most likely not correct since that's not ageable. but maybe.
that's where printing would help
more
BEETROOTS is the block
BEETROOT is the item
God I fucking hate that Material class
Can't wait for it to be obliterated
Spigot could still be consistent but who cares
I mean that is consistent
The registry IDs for those are actually minecraft:beetroots and minecraft:beetroot
But they are in entirely separate registries to begin with (Blocks and Items) so you'll literally never confuse them, that's why Bukkit Material sucks
Thank you blitz!
you're welcome. you clearly needed my approval!
its being removed?
I cant wait for more class transformation fuckery from md_5. The current one randomly makes some plugins crash from transformation issue
ahhh
I'd actually prefer him to not mess this up more before paper brings in any good changes
It's gonna get deprecated in favor of a more data driven approach to actually reflect the internal state (and separate classes too), they will also remove all of the enums making them normal classes (and introduce an OldEnum because backwards compatibility)
And yes it's gonna happen in Bukkit/Spigot, not just paper
Yeah there's a draft PR open
when's this going to happen tho?
oh lord
The soonest it could happen is 1.19 but I doubt that
lol
And yeah there's gonna be a lot of that fuckery, they want existing plugins (not new ones) to still work when using EnumMap/Set 💀
😫
how do i like compile this or whatever into my plugin? https://www.spigotmc.org/resources/mysql-api.23932/




