#help-development
1 messages · Page 2148 of 1
Yes so thats what I was asking initially
How can I do it so when I do “install” on maven build
It also saves the ymls
There
Dont cast it to an ArrayList. You dont know the actual List implementation
Then?
@earnest forum do u know how? Or if its possible
so you want to save the ymls to your plugin data folder?
you wanna do that using code inside your plugin not maven
Ye
oh btw, the thing doesnt return a list but an set
still loopable
Install copies all the files inside your jar.
When the server starts you need to save them from your jar in the plugins folder.
What do you think install does for public plugins? They dont go on thousand external PCs
to copy files there.
In this episode, I show you how to create custom configuration files for your plugins. This means that you can use other files to store data other than the typical config.yml file. These are used by every major plugin, usually. #Spigot #Bukkit #MinecraftPluginDevelopment
Code: https://snippets.cacher.io/snippet/e1f3bdc29b1739dc374c
⭐ Kite is a...
heres a decent tutorial on that @radiant cedar
Oh wait i am so dumb
Set<String> portals = vClasses.getConfig()
.getConfigurationSection("portals")
.getKeys(false);
🤔
ConfigurationSection
not string
nvm
ur right
it returns the name of the config section
So normally I opened from my files and saved there
Now that I changed them to do it in the server plugins folder I forgot it will just save there
Lol
List<ConfigurationSection> portalSections = (List<ConfigurationSection>) config.getList("portals");
for(ConfigurationSection section : portalSections) {
this.loadPortalFromSection(section);
}
Thanks yous
its a set of string
not config section
you get the section from the string as its the name of the section
yea but ill modify da code accordingly
yea
Btw if you have data driven configs like that then you should most definitely create a class that implements
ConfigurationSerializable and generate the config/load your data this way.
Then all you need to do is:
List<VinPortal> portals = (List<VinPortal>) config.getList("portals");
And you dont need to worry about all that yml nonsense.
@golden kelp
O ty
I am doing that
package io.github.vinesh27.vclasses;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.potion.PotionEffect;
public record Portal (
Location startBlock,
Location endBlock,
boolean replace,
Material block,
String[] commands,
Material[] items,
PotionEffect[] effects
) {}
Btw, does #getKeys() return the whole path OR just the key name
It returns the keys of the current section. If you call the method with a true param then it gives you all deep paths.
Example:
parent:
c1:
x: 1
y: 1
z: 1
c2:
x: 1
y: 1
z: 1
On the parent section: When calling getKeys(false) you get ["c1", "c2"]
On the parent section: When calling getKeys(true) you get ["c1.x","c1.y","c1.z", "c2.x","c2.y","c2.z"]
You should probably just List<String>, List<Material> etc in here instead.
Yml doesnt have arrays.
Yea i will replace that, i realized that later, after i was doing that yaml input
List<VPortal> portals = (List<VPortal>) config.getList("portals");
So I made a class
public class VPortal extends ConfigurationSerializable {
}
and a constructor
One moment im writing an example.
ty
public record Portal(
Location startBlock,
Location endBlock,
boolean replace,
Material block,
List<String> commands,
List<Material> items,
List<PotionEffect> effects
) implements ConfigurationSerializable {
@Override
public Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<>();
map.put("startBlock", startBlock);
map.put("endBlock", endBlock);
map.put("replace", replace);
map.put("block", block.toString());
map.put("commands", commands);
map.put("items", items.stream().map(Enum::toString).toList());
map.put("effects", effects);
return map;
}
public static Portal deserialize(Map<String, Object> map) {
Location startBlock = (Location) map.get("startBlock");
Location endBlock = (Location) map.get("endBlock");
boolean replace = (boolean) map.get("replace");
Material block = Material.matchMaterial((String) map.get("block"));
List<String> commands = (List<String>) map.get("commands");
List<Material> items = ((List<String>) map.get("items")).stream().map(Material::matchMaterial).toList();
List<PotionEffect> effects = (List<PotionEffect>) map.get("effects");
return new Portal(startBlock, endBlock, replace, block, commands, items, effects);
}
}
Now you can save portals in configs.
Portal portal = ...;
FileConfiguration configuration = ...;
configuration.set("somePortal", portal);
Or
List<Portal> portalList = ...;
FileConfiguration configuration = ...;
configuration.set("portals", portalList);
// Later
List<Portal> gainedList = (List<Portal>) configuration.get("portals");
Ok but you should generate the default config by writing one or two portals.
If you are data driven then you wont create a yml file in your jar.
All you do is create a new YamlConfiguration and save two portals in there when the server starts.
Just so you see how it looks like,.
Ok but you should generate the default config by writing one or two portals.
Instead of writing one by hand
I think if I put a config.yml in ./resources and write stuff in it, when the plugin is ran, the server makes the exact config in the plugins folder?
Sure. But the config wont look like you think it will look like
then?
List<Portal> portals = (List<Portal>) vClasses.getConfig().getList("portals");
```
portals isnt a list, rather a section containing keys
how can I get a players uuid by their name even when offline
Bukkit#getOfflinePlayer(name)
Keep in mind this might have to get the player from Mojangs servers. This means it can block the thread while doing this lookup
so this will work even if they have never been online right
Yes
hey guys so I got an array of portals and they have a start location and an end location. I want to check if the player is in that area, how should I approach this
You can use the bounding box api
or just calculate if the players coordinate is within the bounds
how xd
does bedwars plugins send players to another world or another bungee server? i need to send players on a different map but idk what to do
Which one
2nd
i am losing my braincells when changing it to this pattern
public record Portal(
Location startBlock,
Location endBlock,
boolean replace,
List<String> commands,
List<ItemStack> items,
List<PotionEffect> effects
)
Hm?
Why
List<ItemStack> items,
I cant figure out how to serialize ItemStack from this config section
items:
itemOne:
id: ITEM_ID
amount: 1
discord as always, messing with the indents
Dont write a config by hand. Generate one by creating a random Portal.
yea, but still, how would you get the object from the config
u can create a custom serializer
depends on how deep u want to serialize the itemstack info
thats the part i lose braincells at
just the name, type and amount? or lore, enchantments
https://gist.github.com/graywolf336/8153678 you can use this
it serializes and deserializes itemstacks into base64
its for inventories but u can modify it
ty
ItemStack already implements ConfigurationSerializable
yes but it doesnt serialize meta
Again: Do NOT write a config by hand. It will not work.
Yes it does
What should I do then?
does it?
This should be split into different classes. But its the basic setup of how to generate a config when you are data driven:
@Override
public void onEnable() {
File portalsFile = new File(getDataFolder(), "portals.yml");
YamlConfiguration config;
if (!portalsFile.exists()) {
config = new YamlConfiguration();
List<Portal> portalList = List.of(createDefaultPortal());
config.set("portals", portalList);
try {
config.save(portalsFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
} else {
config = YamlConfiguration.loadConfiguration(portalsFile);
}
// Do stuff with config
}
private Portal createDefaultPortal() {
Location start = Bukkit.getWorlds().get(0).getSpawnLocation();
Location end = Bukkit.getWorlds().get(0).getSpawnLocation();
boolean replace = false;
Material block = Material.AMETHYST_BLOCK;
List<String> commands = List.of("/spawn", "/help");
List<Material> items = List.of(Material.STONE, Material.COBBLESTONE);
List<PotionEffect> effects = List.of(new PotionEffect(PotionEffectType.ABSORPTION, 500, 1));
return new Portal(start, end, replace, block, commands, items, effects);
}
I am just using config.yml i dont need a seperate file
Again: Do NOT write a config manually. It wont work. Did you get that?
No but I mean do I really need a different file
You can name it whatever
If I name it config.yml, will it cause issues?
This is how the generated file looks like:
portals:
- ==: com.gestankbratwurst.spigotsandbox.Portal
effects:
- ==: PotionEffect
effect: 22
duration: 500
amplifier: 1
ambient: true
has-particles: true
has-icon: true
startBlock:
==: org.bukkit.Location
world: world
x: 128.0
y: 63.0
z: 32.0
pitch: 0.0
yaw: 0.0
replace: false
block: AMETHYST_BLOCK
items:
- STONE
- COBBLESTONE
commands:
- /spawn
- /help
endBlock:
==: org.bukkit.Location
world: world
x: 128.0
y: 63.0
z: 32.0
pitch: 0.0
yaw: 0.0
It tells the deserializer that the following section is a class that can be deserialized.
is it a YAML thing or just for spigot/bukkit
This specifically is part of spigots configuration api
The whole point is that you dont want to know your config structure.
All you do is write a class and the save/load that class.
if u want to make it easy to read for like a public plugin
u can make ur own serializer
private Portal createDefaultPortal() {
Location start = Bukkit.getWorlds().get(0).getSpawnLocation();
Location end = Bukkit.getWorlds().get(0).getSpawnLocation();
List<String> commands = List.of("/spawn %p%", "/help");
List<ItemStack> items = List.of(new ItemStack(Material.STONE, 32), new ItemStack(Material.COBBLESTONE, 32));
List<PotionEffect> effects = List.of(new PotionEffect(PotionEffectType.ABSORPTION, 500, 1));
return new Portal(start, end, commands, items, effects);
}
``` Looks good?
hey guys
i have a question, how to add gravity to EntityPlayer? (npc) with nms
can anyone help ?
To have gravity the NPC has to have AI
Does someone know why this gives me a normal Alex head and not a player head?
Version: 1.18.1
ItemStack item = new ItemStack(Material.PLAYER_HEAD, 1, (short) 3);
SkullMeta skull = (SkullMeta) item.getItemMeta();
skull.setOwningPlayer(Bukkit.getOfflinePlayer(p.getUniqueId()));
skull.setDisplayName(p.getName());
item.setItemMeta(skull);
p.getInventory().setHelmet(item);
So I got two ends of a Nether Portal. and I have an array of those ends
How do I check if a player went in one of them and get which end was it
have you looked at? Its for Entities so it "should" trigger for Players too https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPortalEnterEvent.html
it tells you the portal block they are touching
Yes, i got that as well
Then I have no idea what you are asking
Now how do I find out if that portal block is between specific startLocation and endLocation
Math
yea thats what i cant figure out rn
Easiest way is to create a BoundingBox from your start and end Locations. You can then use BoundingBox#contains to check the portal block
can someone please say this? i think the answer is bungeecord and if yes is there any good alternatives?
BoundingBox.of(start, end).contains...
if you are using the Player BoundingBox you shoudl use BoundingBox.overlaps rather than contains
Any good docs u know about java gui
Why do I keep haviung this problem in any sql code that I try when i try to insert the plyaer's uuid
\/
PreparedStatement statement = connection.prepareStatement("INSERT INTO player_data (uuid, money, chips, team) VALUES (" + p.getUniqueId().toString() + ", 500, 0, None);");```
Unknown column '86f4a314' in 'field list'
is there any way to stop slot transfer?
Because you are still not using PreparedStatements
It is a prepared statement tho ?
how do I stop the transferring of items in an inventory
well what is a prepared statement then ?
like a "small" explanation
if u could please
it should be VALUES (?, ?, ?, ?);
its just a way to insert stuff into a database
Isn't it what i'm doing ?
then statement.setString(1, p.getUniqueId().toString());
do that for each value
Connection connection = DataBase.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT * FROM player_data;");
statement.setString(1, p.getUniqueId().toString());
statement.setFloat(2, 500);
statement.setFloat(3, 0);
statement.setString(4, "None");```
This is the correct code, right ?
The columns in teh schema are floats?
But I want to have more than 1bil in my number
Yes they are.
if they are integer numbers you should really use bigInt then
long would suffice
yep
Ohh okay.
Parameter index out of range (1 > number of parameters, which is 0).
Do I first have to store them in result set ?
@EventHandler
void setPlayerFirstData(PlayerJoinEvent e) throws SQLException {
Player p = e.getPlayer();
Connection connection = DataBase.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT * FROM player_data WHERE uuid=12;");
statement.setString(1, p.getUniqueId().toString());
statement.setFloat(2, 500);
statement.setFloat(3, 0);
statement.setString(4, "None");
}```
This is the whole snippet.
you missed off thr VALUES
^
Whats the correct way
INSERT is for adding data to yoru table
google java sql basics
connection.prepareStatement("SELECT * FROM player_data WHERE uuid=?;");
statement.setString(1, p.getUniqueId().toString());```
java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.YamlConfiguration.getConfigurationSection(String)" is null
at io.github.vinesh27.vclasses.VClasses.loadPortals(VClasses.java:56) ~[?:?]
at io.github.vinesh27.vclasses.VClasses.onEnable(VClasses.java:39) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:518) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:432) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:612) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:263) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1007) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
at java.lang.Thread.run(Thread.java:833) [?:?]
oof
?paste
I've just gotten into sql and it's not as hard, but it just takes a bit to learn.
portals:
- ==: io.github.vinesh27.vclasses.entities.Portal
effects:
- ==: PotionEffect
effect: 22
duration: 500
amplifier: 1
ambient: true
has-particles: true
has-icon: true
startBlock:
==: org.bukkit.Location
world: world
x: 0.0
y: -60.0
z: 0.0
pitch: 0.0
yaw: 0.0
items:
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: STONE
amount: 32
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: COBBLESTONE
amount: 32
commands:
- /spawn %p%
- /help
endBlock:
==: org.bukkit.Location
world: world
x: 0.0
y: -60.0
z: 0.0
pitch: 0.0
yaw: 0.0
the yaml
it generated
What string are you getting that's throwing the error
The path your inputting is null
show the code
private void loadPortals() {
Set<String> portalNames = config.getConfigurationSection("portals").getKeys(false);
for (String portalName : portalNames)
portals.add(
Portal.deserialize(
(Map<String, Object>)
config.getConfigurationSection("portals." + portalName)
)
);
}
yep its wrong
@safe notch
is there something like mysql INSERT INTO table_name IF NOT EXISTS (column_1, column_2) VALUES (value1, value2);

tamilpp, are u tamil xD
Soooo, is there a way to check if uuid of that already exists ?
You do the not exists if you expand your statement
tamilpp & TheBigDongggggg are chatting rn
portals:
- ==: io.github.vinesh27.vclasses.entities.Portal
effects:
- ==: PotionEffect
effect: 22
duration: 500
amplifier: 1
ambient: true
has-particles: true
has-icon: true
startBlock:
==: org.bukkit.Location
world: world
x: 0.0
y: -60.0
z: 0.0
pitch: 0.0
yaw: 0.0
items:
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: STONE
amount: 32
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: COBBLESTONE
amount: 32
commands:
- /spawn %p%
- /help
endBlock:
==: org.bukkit.Location
world: world
x: 0.0
y: -60.0
z: 0.0
pitch: 0.0
yaw: 0.0
How do I loop through all the objects under portals
I dont know how to get that portals list
Would you mind writing a small snippet ?
does #getConfigurationSection work to get this array?
if you only want one entry per player you set the UUID column as primary unique
ohh okay
such as this \/
CREATE TABLE player_data(
uuid VARCHAR(64) PRIMARY KEY UNIQUE,
money BIGINT,
chip BIGINT,
team VARCHAR(16)
);```
is it important to close it ?
portals:
- ==: io.github.vinesh27.vclasses.entities.Portal
effects:
- ==: PotionEffect
effect: 22
duration: 500
amplifier: 1
ambient: true
has-particles: true
has-icon: true
startBlock:
==: org.bukkit.Location
world: world
x: 0.0
y: -60.0
z: 0.0
pitch: 0.0
yaw: 0.0
items:
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: STONE
amount: 32
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: COBBLESTONE
amount: 32
commands:
- /spawn %p%
- /help
endBlock:
==: org.bukkit.Location
world: world
x: 0.0
y: -60.0
z: 0.0
pitch: 0.0
yaw: 0.0
- ==: io.github.vinesh27.vclasses.entities.Portal
effects:
- ==: PotionEffect
effect: 22
duration: 500
amplifier: 1
ambient: true
has-particles: true
has-icon: true
startBlock:
==: org.bukkit.Location
world: world
x: 0.0
y: -60.0
z: 0.0
pitch: 0.0
yaw: 0.0
items:
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: STONE
amount: 32
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: COBBLESTONE
amount: 32
commands:
- /spawn %p%
- /help
endBlock:
==: org.bukkit.Location
world: world
x: 0.0
y: -60.0
z: 0.0
pitch: 0.0
yaw: 0.0
How do I get the elements in the portals list
and to close it you do connection.close();?
i'm using mysql
Well look at my mysqldatamanager class
You see how i have try (Connection connection = database.getConnection)
Anything in the () is automatically closed
@quaint mantle u can use replace into
If the uuid exists it replaces the other columns
If it doesn't it inserts it
Replace into works the same way as insert
And how does one reload this config/
Alternatively you can use update table set column=value where uuid=whatever
Do players make the configs?
Or do you use it to store your data
Yes they do edit it
I make a simple structure for them
they edit it according to their needs
Do you make changes to the config while your plugin is enabled?
now i got a different error
Ok
What is it?
when I serialize the file
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3483-Spigot-42b6152-9cc7d76]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.IllegalArgumentException: Specified class does not exist ('io.github.vinesh27.vclasses.entities.Portal')
at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeObject(ConfigurationSerialization.java:197) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:48) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
it seems it cant find the class
even though it is there
did you register the class?
^^
Portal?
Yes
You need to do so in onenable
if it implements ConfigurationSerializable it has to be registered for deserialization
read teh javadoc on ConfigurationSerializable
declaration: package: org.bukkit.configuration.serialization, class: ConfigurationSerialization
why does my IDE say its not a method
It is static
oh nvm i m so dumb
nvm i wasnt dat dumb
Oh ge this is it i think
Ohh, its an interfface i just forgot
The class names are so confusing for serialization
Yess
@humble tulip what i did is open then close the connection on every event
and close the statements as well
Still getting the same error
portals:
- ==: io.github.vinesh27.vclasses.entities.Portal
effects:
- ==: PotionEffect
effect: 22
duration: 500
amplifier: 1
ambient: true
has-particles: true
has-icon: true
startBlock:
==: org.bukkit.Location
world: world
x: 60
y: 60.0
z: 60
pitch: 0.0
yaw: 0.0
items:
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: STONE
amount: 32
- ==: org.bukkit.inventory.ItemStack
v: 2975
type: COBBLESTONE
amount: 32
commands:
- /spawn %p%
- /help
endBlock:
==: org.bukkit.Location
world: world
x: 60
y: 50
z: 50
pitch: 0.0
yaw: 0.0
the file
I am serializing
did you implement everything it says to implement in the javadoc?
Ohh
public record Portal(
Location startBlock,
Location endBlock,
List<String> commands,
List<ItemStack> items,
List<PotionEffect> effects
) implements ConfigurationSerializable {
@Override
public Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<>();
map.put("startBlock", startBlock);
map.put("endBlock", endBlock);
map.put("commands", commands);
map.put("items", items);
map.put("effects", effects);
return map;
}
public static Portal deserialize(Map<String, Object> map) {
Location startBlock = (Location) map.get("startBlock");
Location endBlock = (Location) map.get("endBlock");
List<String> commands = (List<String>) map.get("commands");
List<ItemStack> items = (List<ItemStack>) map.get("items");
List<PotionEffect> effects = (List<PotionEffect>) map.get("effects");
return new Portal(startBlock, endBlock, commands, items, effects);
}
public static Portal valueOf(Map<String, Object> map) {
return deserialize(map);
}
}
I dont really know how to change the constructor as that will cause issues with other methods?
Or should I convert it to a class and have multiple constructors?
When you say open the connection you get a connection from the connectionpool?
If so, you're doing it properly
public final class Portal implements ConfigurationSerializable {
private final Location startBlock;
private final Location endBlock;
private final List<String> commands;
private final List<ItemStack> items;
private final List<PotionEffect> effects;
public Portal(
Location startBlock,
Location endBlock,
List<String> commands,
List<ItemStack> items,
List<PotionEffect> effects
) {
this.startBlock = startBlock;
this.endBlock = endBlock;
this.commands = commands;
this.items = items;
this.effects = effects;
}
public Portal(Map<String, Object> map) {
this(
(Location) map.get("startBlock"),
(Location) map.get("endBlock"),
(List<String>) map.get("commands"),
(List<ItemStack>) map.get("items"),
(List<PotionEffect>) map.get("effects")
);
}
@Override
public Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<>();
map.put("startBlock", startBlock);
map.put("endBlock", endBlock);
map.put("commands", commands);
map.put("items", items);
map.put("effects", effects);
return map;
}
public static Portal deserialize(Map<String, Object> map) {
Location startBlock = (Location) map.get("startBlock");
Location endBlock = (Location) map.get("endBlock");
List<String> commands = (List<String>) map.get("commands");
List<ItemStack> items = (List<ItemStack>) map.get("items");
List<PotionEffect> effects = (List<PotionEffect>) map.get("effects");
return new Portal(startBlock, endBlock, commands, items, effects);
}
public static Portal valueOf(Map<String, Object> map) {
return deserialize(map);
}
}
I think I have everything now
It was just to avoid boilerplate
ConfigurationSerialization.registerClass(Portal.class, "Portal");
Registering it in the onEnable method as well
bump
um, why when i move does i get a move message and all, but one more last countdown task is done?
Stack overflow
wdym?
and how could i fix it?
Seems like the condition to break out is never met
Not sure why this is recursive anyways
This could easily just be a while loop
i thought this was the way to go (?)
anyways could you help me with the while loop?
Print out the material
Add some debug output, whatever you need
Because it's never selecting a location it considers valid
So it keeps going on forever
Honestly you also shouldn't be using a list
You don't need a loop either
You can just do contains
That aside
public static Location getRandomFishSpawnLocation(Location center, float radius, Set<Material> acceptableMaterials) {
while (true) {
Location loc = Util.getRandomLocationInRadius(center, radius);
if (acceptableMaterials.contains(loc.getBlock().getType())) {
return loc;
}
}
}```
Uhh how do you save doubles or ints to a config.yml?
With ConfigurationSection#set
Same as any other value
Let's see the getRandomLocationInRadius thing too
It should look something like this
bump
how can I get the url for Minecraft steve skin? I try to get the users skin with player.getPlayerProfile().getTextures().getSkin(); and I want to set the url to steve skins url if getSkin() returns null
Heyyy,
im trying to save all Treasures(Block Locations) into config.
Here's my code :
public static void addTreasure(Chest chest){
if(!treasures.contains(chest))
treasures.add(chest);
TreasureConfigManager.getDataConfig().set("treasures.players",chest.getLocation().serialize());
}
but when I run it and place some Treasures so it Saves into file it does this:
https://ctrlv.cz/e3y6
because of the Random method getting the location is always getting a relatively different location
No
you need to save
imma try to add Save at the end of it
Don't do serialize()
Just set the location itself
Then you can use ConfigurationSection#getLocation when you need to deserialize it
Yeah I also asked to see this and haven't seen any code
Damn
well it still saves the same thing
That's not a good way of doing that
public static Location getRandomLocationInRadius(Location loc, double radius) {
double dist = Math.sqrt(Math.random()) * radius;
loc = loc.clone();
loc.setPitch((float) (Math.random() * 360));
loc.setYaw((float) (Math.random() * 360));
loc.add(loc.getDirection().multiply(dist));
return loc;
}```
that saveTreasures() doesn't do anything except printing msg
bruh
why do you call load before you call save
that overwrites any changes with whatever is saved in the file
don't call load when you actually want to save
ooh that's why it wouldn't save
i though that you need to load the file before saving it
no
loading gets the values from the file and loads them into memory
so calling load immediately followed by save will do literally nothing
riight
thx
when I have the basic structure in config:
treasures:
players:
it delete's it and the config is blank afterwards
without structure it also stays blank
.-.
In saveData
Why do you create a new YamlConfiguration
Of course it's deleting everything, you're creating a blank config and then saving it
Literally the only thing you need to do in order to save the data
Call save(file) on the YamlConfiguration you have been writing to
even after that its big nono
its back to ```yaml
treasures: {}
but thx for that saving thing, didn't realize that one
There's probably some mistake in the other code
My god
dfojghbnosjdfgbgjhsfdbjdgfbjdgohfbodghjdghbjsdghj
Why are you constantly creating new config objects
Stop
Of course nothing is getting written because every time you get the config it's just loading it from disk
Keep ONE YamlConfiguration instance, call load ONCE when you create it, and call save whenever you need to save it
Stop making new instances and stop loading unnecessarily
i am making a clicker server where i store the money in the persistantdatastorage of the player, how can i make a leaderboard from all player's stats (including offline player)?
so how can i get the persistantdatastorage of an offline player?
You can't
loop thru all players that are online
go into their persistent.. and get that value
for offline you will probrably need to store the value in a file
Why would looping through online players help
Database is definitely better for that
is firebase good? (have some experience with it)
That's a remote database
MySQL prob better
can someone help me update plugins?
old abandoned plugin without a way to contact owner
Is it open source
How can i place a Lit Candle?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/type/Candle.html You can use the setLit method
Any idea why this isnt working?
https://pastebin.com/n6hFZBZi
i need ideas to code
You are casting an ItemStack to Lightable. You cannot do that. You can only cast BlockData to Lightable
whats this mean
javascript is so flexible it should be illegal
I think that means the jar is corrupted or something like that's it's been a minute since I've seen that specific error
Javascript is so terrible it should be illegal
How can I include a .jar file in compilation when compiling with maven in intellij? Trying to use DeluxeCombat API and there’s no maven repo
maven shade plugin + set the scope to compile of the api dependency
<dependency>
<groupId>group id</groupId>
<artifactId>artifact id</artifactId>
<version>version here</version>
<scope>system</scope>
<systemPath>jar dir</systemPath>
</dependency>
And then use maven-shade-plugin
system scope goes brr i heard
I dont kno i have used many times and work good
Another option is to install the jar to your local repo
hi
is there have any way to PlayerInteractEvent have hit damage? i want to make player use right click to get damage nearby entity
Entity#getNearbyEntities
but entity sethealth not make entity have knockback just take a damage
ye i have
LivingEntity#damage
ok thank
is there a way to show the players in tab only if they are in the same world?
how did you get them to connect across different worlds
do you mean nether/ow
hm, I already had that and it didn't seem to work
You can use player.hidePlayer()
Stupid question, But is there any way to make the plugin handle all error it cause by itself?
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.
I know try and catch 😮💨
depends on what errors
Error handling Is basic concept you need to check out
You can handle pretty much everything by yourself
I just don't want to add try and catch everywhere...
myes, wrapping everything in a try catch Throwable usually isnt very smart if thats what you're currently doing
I know Spigot has a error handler for the plugin... I'm looking to find a way and override it for my plugin
ugh what and why
Tbh, I have a set of custom made exceptions...
There is a good chance your overusing try catch wrap more strategically
it catches exceptions that yield from onEnable, onLoad, onDisable and Listeners and the command api to avoid arbitrary code termination
Also you can easily throw your custom errors
I have not tested this but i think that it should work https://gist.github.com/Lama06/fb457c612763234010952b6d1c8e1f91
Yep, I want my plugin to handle them before spigot
then try catch
but like usually its very trivial to point out the sources of which conceivable errors will yield
For every command and listener?
like from input parsing
If you use try catch strategically you'll be fine and jt won't be messy
or lets say IO
I'm to lazy to add them and it won't look good in code...
Bruh
no1 cares about how good looking your code is
Lmfao
if its clean then its good enough
Good chance what your trying to achieve can be easily done with 1 try catch too
I have a messenger API which can handle all the exceptions (instead of traceback in the console it will save it in a file and return the file name in console) and using a try catch I can easily handle them, But having try catches is annoying and I'm looking for a way to make my plugin handle any exception it gets with this method (As messenger also have a metrics that upload all the errors to my discord server for better support)
Try catch
That's what I want, Where I HAVE TO USE IT!
Sounds like a good option if you are smart yoh will only need a few at most otherwise its your fault
why not just logging them to console and then the traceback will be in the console log lol
I just log 
Bruh... The plugin upload the file for me in discord if some one needs support 🤷
try{
//TODO code that yields any instance of Exception
}catch(Exception e){
//handle any instance of Exception
}
basically
ah in discord lol
i was trying to do a similar thing a while ago, unfortunately for this though bukkit has a try catch pretty much everywhere so Thread.setDefaultException handler doesn’t work. i think the best option would probably be something with javaagents
ALTER TABLE contacts
MODIFY balance INTEGER 1000;
This'll change the column's value, right ?
Finally some one got what I wanted 😭 Thanks btw 😉 I might have to do that 😦
No
That's trying to alter the table itself
The column doesn't have a value
Each row has a value for that column
You want update
UPDATE contacts SET balance=100 WHERE name="John" or something
Assuming you have a string column called name
hey guys, i need help, i'm searching for plugin which can limit the number of shulkers in inventory
can spigot render text to the spot where held item text usually goes
below the actionbar
like that
You can rename the item a player is holding
:( is that the only way
well yeah, since that text rendering is client side
could do it with packets if you don’t want to change the name of the actual item
would still run into the issue that the player will have to be holding your packet item at all times
or if youre just renaming with packets then it wont work with air
well you could make a fake item and then set it in their hand with packets
true
but that might a lil intrusive
for the player
i mean you could cover it up with a texture pack
Question, what are possible reasons as to why the PlayerInteractEvent fires twice?
Can I restrict it to the main hand only?
if you only want it for one you can check and ignore if its offhand
I have 4 hands
i have 8
I have 16
that is great
I have 0 :)
@EventHandler
public void onEnchantClick(PlayerInteractEvent event) {
if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return;
if (event.getClickedBlock().equals(Material.ENCHANTMENT_TABLE)) {
Player player = event.getPlayer();
event.setCancelled(true);
Inventory inv = Bukkit.createInventory(null, 45, "§5Enchanting Table " + player.getName());
player.openInventory(inv);
}
}``` this doesn't work, it still opens the enchant table inventory
You set it to hit the block to open your inventory.
no need to use equals to compare enum constants, use != instead
no worry's 🙂
Have there been any changes to glowing btw?
Setting setGlowing doesn't seem to work anymore
Not a thing
I am trying to spawn a persistent falling block entity that glows, but while the entity spawns, it does not glow
FallingBlock e = block.getWorld().spawnFallingBlock(tg.clone(), block.getBlockData());
e.setGravity(false);
e.setInvulnerable(true);
e.setGlowing(true);
e.teleport(tg.clone());
e.setDropItem(false);
e.setHurtEntities(false);
e.setSilent(true);
e.setTicksLived(1);
e.setVelocity(new Vector(0, 0, 0));```
use potion effects
Not worth it
They don't exist for a long time, creating and applying effects is a waste of cycles
The glowing property should set a glow, just pivoting to a different approach is not solving the problem
It's not a player
It's a falling block
Yes
The player is not part of any team
And is not going to be
Glow is literally a boolean entity property
Entirely unrelated to scoreboards and teams
When was this behaviour changed?
Because it used to simply work
Then why could I simply set setGlowing to make a entity glow before 1.18
I'm also having this issue
Yeah bs on the scoreboard only stuff
Setting the nbttglowing tag manually works just fine
Setting the glowing tag of the handler entity doesn't work either
Any here knows if there is a way on bungee and spigot to inject into netty a custom channel handler?
So it looks like mojang borked this one, since spigot just redirects to that
Hey, fixing up some really old code (1.8) i know i probably wont get support but i just need to know 1 question? How comes this: ((CraftPlayer) player).getHandle().spectating = false; doesnt work, and how would i get this to work exactly? (e.g. is there another way of finding this out?)
By default they are obfuscated
no no i explained
Spigot lastests version has a remap option, that already come with some deobfuscated methods for working
But olders spigot doesnt have that
yeah but the remap thing sounds like a file i have in my spigot build folder, spigot-1.8.8-R0.1-SNAPSHOT-remapped.jar
Manually sending the metadata update packet doesn't seem to work either
Are you using intellij?
Do this
sadly the project doesnt build in intellij since i cant be asked to configure it for another IDE
so right now im using eclipse
on "getHandle()", press ctrl + click and it will decompile the class. So check if the class contains that method
Oh ok
i replaced it with the remapped file in the folder and its now not trying to stab me
1.8.8 has no public mappings. This version is ancient and support was dropped half a decade ago.
The entity has the glowing flag set, meaning it should be synced with the client
So why does modifying the data via command work, but setting the flag in code doesn't
i said that in my original message, i was just wondering what that code does and if there was a fix anyone knew about for it
What are you doing currently? Are you creating client side item frames and want them to glow?
No, I am spamming proper, synced falling block entities
My goal is to create a "ripple" effect through a structure
By hiding a block, spawning a stationary falling block which glows in its place and replace it with the actual block once more
And just have that repeat through the structure
Yeah makes sense. How do you hide the block? By using a block update packet?
Block update
But that is not the issue right now in general
The issue is that the falling block entity simply will not glow
Just wanted to see the full picture.
Would you mind showing your code that spawns the falling block currently?
It's definetly not a restriction on falling block entities in particular
Location tg = block.getLocation().clone().add(0.5, 0, 0.5).clone();
FallingBlock e = block.getWorld().spawnFallingBlock(tg.clone(), block.getBlockData());
e.setGravity(false);
e.setInvulnerable(true);
((CraftFallingBlock)e).getHandle().setGlowingTag(true);
e.teleport(tg.clone());
e.setDropItem(false);
e.setHurtEntities(false);
e.setSilent(true);
e.setTicksLived(1);
e.setVelocity(new Vector(0, 0, 0));```
Ignore that I am doing the handle directly, I was testing
mhm
Any reason why you use the nms glowing method and not spigots Entity#setGlowing(boolean)
see here
But the spigot abstraction behaves the same
Not sure what the problem here is. Let me do some testing.
Those are my yields:
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (block == null || event.getHand() != EquipmentSlot.HAND) {
return;
}
BlockData data = block.getBlockData();
block.setType(Material.AIR);
FallingBlock falling = block.getWorld().spawnFallingBlock(block.getLocation().add(0.5, 0.01, 0.5), data);
falling.setGlowing(true);
falling.setVelocity(new Vector(0, 0.33, 0));
}
@halcyon mica
I have no idea. Try isolating the problem by removing other properties first.
ayy that looks cool
Wait till you see vatuus waves. Pretty sure the ripple effect will look quite nice.
Hm what was this algorithm to draw discrete circles again...
I would just use breadth-first
I mean that would would result in a rombo, wouldnt it?
gonna end up being one of those satisfying wave machine things people make with redstone and sand
Thats probably not too hard to write. Just a sin wave 😄
But having a wave from the centre out in a perfect circle is a bit more tricky
sometimes when I'm tired I just go watch mumbo jumbo wave machine videos
mumbo jumbo kek
I think I have found the issue
How can I change the color of the glowing overlay of an entity?
Share please 😄
It's the way how I create the falling entity
Using the material and data method works just fine
Easy way to remove grass lul
But creating the entity using blockdata does not
@restive mango
aaaa
Thats weird... Because i created them using the BlockData too
FallingBlock e = block.getWorld().spawnFallingBlock(tg, block.getType().createBlockData());```
now it only works on leafs
But not on logs
Let me see if i can make an actually scary wave from that XD
Caused by: java.lang.IllegalArgumentException: Cannot open an inventory of type CRAFTING
I genuinely don't understand
what does this mean?
it is relating to this line:
humans has type org.Bukkit.Entity
you could just get the handle, get the intlist via reflections and modify it
instead of setting a new value
How do I check if a damage hits succesfully ?
I have a EntityDamageByEntityEvent, checking a player hitting another, but it also triggers in wg region where pvp is disabled. Any ideas ?
What's the best way to create a formatted message to send to a player?
like getModifier().get(0).set(0, new int[])?
@lost matrix This has to have something to do with block data
When just getting the material of the block data, it skips over acacia logs
But it's fine pasting acacia logs normally
@EventHandler(ignoreCancelled = true) so the listener wont work when some other plugin cancelled the event
When giving it block data in general, it just straight up does nothing
thanks
you might want to change the priority too if it doesnt work
Hey,
currenly when I reload/shutdown/restart my server , my config get's wiped out
Imma try to attach some code that might come in handy
if you need more code , ask for it 🙂
he was helping with saving to the file
now it doesn't stay after shutdown
lmao
onEnable is way too long for Discord
give me a minute
i see static abuse
int getPlayerMoney(
Player p,
ResultSet result
) throws SQLException {
int money = 0;
while(result.next()){
p.sendMessage(result.getString(1));
if(result.getString(1).equalsIgnoreCase(p.getUniqueId().toString())){
p.sendMessage(result.getString(1));
money = result.getInt("money");
}
}
return money;
}```
@ancient plank looks neat
Why isn't it returning the value that it's supposed to ?
???
you dont see to close resultsets
no i close it later
@ancient plank I think he’s just making falling blocks out of all the grass blocks and launching them upward
i wont speak about the connection i guess
sorry?
well duh i just thought maybe you'd think it's cool
Oh yeah it’s cool though
because you like falling blocks
public class OnDiable AAAAAAAAAAAA
i did tried using saveData() and reloadData,
neither of those did work
@small bay how would you do it ?
PLEASEEEE
@ancient plank ask him to move the blocks around en masse in space and check if they become disjointed
I hate it
That on lotc
my second last brain cell just fking died
I don’t think we send packets
Frequently enough
So the blocks become all fucky
It’s probably a server speed saving precaution
I'm new to using databases -_-
From bukkit or spigot or something
oh soz
I can’t do it on a basic server because my stuff is all designed for tythan @ancient plank
I can get tythan working on my dev server @restive mango
No it’s not that
It’s that something inherent to lotc reduces how frequently a falling block sends packets to players @ancient plank
So it’s doing it like every fifth tick
since my Main class is over 150lines
I wanned to make it more organised
and i didn't have better names then OnBoot and OnDisable
Instead of every tick
Something like that
I don’t know exactly how it works
But there is something that makes our falling block entities more jittery
@ancient plank use /aeso telerip 6 on a chunk of terrain and wave it around, look at how the blocks break up and it takes a few moments before you see them correctly
@quaint mantle https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
might come in handy
you might get the connection in another way
why not just CompletableFuture#supplyAsync? @quaint mantle
The entities are actually being spawned
and not using the bukkit scheduler
But they just don't have any properties applied
bumpity bump
whats getting called in onEnable?
its checking if Config files are existing, registering listeners
i mean that code has to be called somewhere
I write to that file only when someone places a block with specific Material
I then add it to the Config
and save it
@lost matrix hey
Just to let you know ahead of time
If you ever want to generate falling blocks at the location of a block without destroying that block
why use mysql or mongodb, which one?
You’ll need to send an update to all the players who can see it that the block is not in fact destroyed
im not sure about your createDataConfig method
Or it’ll be an invisible hidden block
I just removed one unneccesarry saveData() and it saved correctly even over reload?
i already have mysql but idk if i should switch to mongo
@ancient plank do you remember if falling fire blocks continued their animations while falling
Or falling magma blocks
Non-living entities cannot actually be set to be invisible, can they?
Armorstands are living entities
How can I get any colour from an RGB value?
INSERT IGNORE INTO player_data VALUES(?,?,?,?);
I use this to stopre player data, and for some reason it's duplicating, if someone is able to, can you please help me ?
You're gonna have to specify here
what do I need to specify?
If you want an org.bukkit.Color, there's a static fromRGB() method where you can just pass the int. But if you want the individual r, g, and b components you'll have to do some bitshifting
I don't understand, the entity exists, has all the properties, everything
because your question was "how do I get colour from a colour"
I want a ChatColour to change the colour of a chat message to any colour, rather than a value from the existing enum
That's more specific. You want the bungee ChatColor instead
ok thx
net.md_5.bungee.api.ChatColor#of(Color)
https://javadoc.io/doc/net.md-5/bungeecord-chat/latest/net/md_5/bungee/api/ChatColor.html
(and you can just do new Color(rgb))
when i use that it says deprecated
ok thank you
What is so special about this entity that makes the game not render it?
I'd looked stuff up and seen the .of() method but couldn't see it on docs for ChatColour
Yeah it's the bungee ChatColor, not Bukkit's
mhm
yes same jet
It looks like minecraft just fails to render falling blocks with certain blockstates
idk
How do I make sure that my database is always up to date ?
coz sometimes, it doesn't update itself
what db?
mysql
mysql should update upon data entered/edited
If it isn't its probably on your end somehow
for some reason, it doesn't get the information uuid and doesnt compare it
it worked once with this code
now it doesn't
here's the "getPlayerMoney"
Oh I haven't seen it, sorry.
so, I run Mongo so if someone else has more experience with SQL feel free to jump in, but from what I see at the moment, it seems that you are running a wide scope check pulling playerdata every time but you could edit the statement and just get the data for the specific player, rather than everyone
so use WHERE ?
I also don't know if it is necessary to connect to the db and get the connection every time, especially with how you it seems using static variables to do so, could easily be an issue there id bet
ye
i'm glad i learnt some basic SQL at school
would you mind sending me that link again, please ?
also I dont know why you are statement.executeUpdate(); after that scoreboard
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Take a look at the forum post, as that can help you a lot, BY met is its something to do with
DataBase.establishConnection();
Connection connection = DataBase.getConnection();
Getting the connection like that, as it could be out of date or something else weird being that its a status way of getting it and not unique to this one instance
might not want to leak your db connection info here
yeah good idea
then statement.setString(1, p.getuuid().tostring) right?
ye
oh okay
Now my own question time, I'm looking for a system to distribute jars across a server, ex upload new jar to a specific place and then run a command or something and it will automatically copy it to all the servers upload directory.
I'm not sure if something like this exists but any info would be appreciated
lmao i read SELECT MONKE
then statement.getInt(2);?
it wants the name of the placeholder
so if you make a table (name VARCHAR(20)) you would have to do getString("name")
iirc
long time since i used databases
making a good table design is also important but thats the advanced stuff we learnt at school lol
Assuming you mean like dedicated server, yes
Just write a quick java app. Copying files is not really black magic.
Its just a bit more difficult if we are speaking about multiple dedicated machines.
Alright thanks (Same machine so not bad at the moment)
If you want to distribute files over multiple machines then i would suggest using S3 from aws
?paste
i'm confused- what am I supposed to depend on? The spigot regular jar doesn't contain any of it, and the shaded jar md_5 sent out in their post doesn't contain CraftBukkit
Good time to learn maven
does buildtools works for 1.18 too?
works for every version
SELECT learned-maven FROM users WHERE learned-maven=false
That will broke the database
No that's invalid syntax
Pretty sure you can't use dashes in column names
yep '-' doesnt work
ResultSet == MongoCollection right?
Know that i dont use anymore mysql i cannot remember tho
MongoDB is goated
Why does it feel like mongo is just the database for people who don't like sql
lol
Redis has its own thing going on but mongo just seems like that
It feels a bit like the python of databases if that makes sense
sql i like but its really engorrous the reason that you cannot save objects
I really hate that
engorrous?
save them as binary kekw
Yeah lets all screw document and relational databases.
How about we use OrientDB from now on. Or Neptune*
Not such simples as just calling a method passing an object saving it
lol
object output stream
You can do the same with relational databases if you use an orm

MySQLs latest version is only like a month old.
Same goes for MySQL in good (Postgres). All latest technology.
MySQL in good
Hmn dont still undmerstand but okay
In the enterprise world, Postgres is the golden standard
Im saving this so i can send it after every other code we have to go through.
https://www.youtube.com/watch?v=ZzwWWut_ibU
This is the guard clauses technique to make your if else statements easier to understand and read. If else conditions is one of the most used thing in coding, but using if statement and nesting them like this is the worst thing ever. You should never nest if statement because it is hard to read and edit. Instead you should always use guard claus...
good plan
Every version 1.8 and higher*
What a mad thing to see nesting inside nesting of nesting if-else
bruh cloud broken when i need a document
cloud?
Are you using a potato as cloud?
😂
I have a couple projects and I want to put them all in one plugin. Anyway I can do that?
2 options:
- Copy paste your code and merge it.
- Shade the plugins in.
The latter might be a hustle to get working.
only ur internet goes down, don’t blame the cloud or the cloud will come beat you
tips to not awake your parents when printing: put a pillow on top of the printer
ok thx!
I need tips on how to open closets, squeaky doors, and not drop silverware
WD40
Facts
step 1 to bring an usb stick to school: remove the iso files and format it
smh what have i been doing
also, how do I make a command that toggles a variable for 1 player, which is the player that toggled the command?
Add them to a set
If toggle set will contaim them
If not it wont
Put the set in some manager class and have a toggle method that accepts player
Remove player on leave
You need a mapping from player to variables.
This is mostly done with a Map<UUID, X>
ok
If you need multple varable use a map as @lost matrix said
If it's just true or false u can use a set
Another approach: Use the PDC of the player. This way the values will be persistent.
PDC save values into a json or yaml file?
Map<Player, X> 
neither
So how its persistent?
stored on the world data
by saving it
with the entities
If persitent it should be saved somewhere
Yes but there are more file types than yml and json...
it’s stored in the proprietary mojang format
its saved in the nbt format
wait (im knew so pls dont judge) how do I get the UUID?
Player#getUniquiId or something
k
what he said
Actually you have the ?jds
lol
?jd
it has to be at the start
Javadocs are really useful for using the spigot api
When you dont know a method you can read them to find it
?event-api
ty
you just implement Listener
oh ok
Sorry if i sound rude, but have you watch a full tutorial
That atleast talk about the basics
most tutorials are bad lol
Agree
I think if someone start doing decent tutorial can be really known
Because lot of people would watch the tutos
it's difficult to teach things in a tutorial
For me its pretty easy
yes and then only you understand it lol
People jump right into spigot dev. without understanding basic fundamentals of OOP or Java
first spigot tutorial i watched made listeners separate classes
No i mean in really talkfull and explain things good
idk why so many people just make main a listener
so when you tell them you need a Listener they're like "huh what's implements"
too many different tutorials, a lot of which are from 1.8 and earlier
If i have to explain something i take my time to explain it
Earlier?
later
nah there's a few on 1.12.2 and some newer versions
probs
same without a lot of people use command event and getName instead of using commmandexecutor
so if i am correct. to register listeners that are in the same class as the line where you are registering, you do java this, this
?
yeah
ok ty
well, that is implying that “this” is both the main class and “this” implements listener
That why you have the ?jd-s
how to make ai
AIFactory.makeAI()
ew
no
AI.construct() {
return new ComplexArtificialIntelligence();
}
how
you used curly braces at the end of a method call
which results in a Lambda as the last parameter in Kotlin
and then you've added the new keyword before the class ComplexArtificialIntelligence
in Kotlin, you don't use the new keyword, you just call the constructor as if it was a method
I've tried learning kotlin like 3 times then get frustrated when i have to keep googling syntax
it gets easier over time
only thing i still don’t really get is why you have to put object : before instantiating a local interface or abstract class
if you have over 1 command, how would you list that in the plugin.yml
using dispatchCommand and an armor stand as the "sender" should work, but its not exactly executing which it should, which is weird considering I have another class which uses the exact same method and executes just fine with the armor stand as the sender
Do I just send the snippet of code here? Its not very large anyways
yeah, sort of confused on why you would want an armor stand to execute a command though
because I need a command to execute in certain worlds
and getConsoleSender only works in one world
i mean theres usually ways to do things without involving making console send commands
check if the player is in the desired world?
depends on what you're trying to do
difference is i need the "customizability" which allows the server owner to edit it the command as they please, otherwise i would of used the api, unless theres another method which allows the same result?
well idk what the result is that you're trying to achieve