#help-development
1 messages · Page 1761 of 1
can this
for (int i = 0; i < players.size(); i++) {
if (players.get(i).equals(player.getName())) {
players.remove(i);
}
}
be replaced with this?
players.removeIf(s -> player.getName().equals(s));
what is players?
no
a list i would assume?
send the entire class in a paste
so is players a list?
yes
static double Mana = 100;
static double MaxMana = 100;
to separate things like this per players
how am i supposed to do it?
with a hashmap or something like that?
yes
that should work then
what exactly is this for?
Also, will the method always return true/false, or does the return value changes at it should?
private boolean removePlayerFromGroup(YamlConfiguration yaml, OfflinePlayer player, String group) {
List<String> players = yaml.getStringList(group);
List<String> newPlayers = players;
newPlayers.removeIf(s -> player.getName().equals(s));
yaml.set(group, newPlayers);
try {
yaml.save("plugins/MaxiCity/teams.yml");
} catch (IOException e) {
e.printStackTrace();
}
return players.equals(newPlayers);
}
store different numbers
they start all with 100
but can change that
What are the numbers for? Are they for each player or the same for everyone?
each player
that wont work
yeah ik I'm trying something else now
you need to at the very least replace
newPlayers.removeIf(s -> player.getName().equals(s));
with
newPlayers.removeIf(s -> player.getName().equals(s.getName()));
boolean flag = players.removeIf(s -> player.getName().equals(s));
If a player's name is removed from players, will flag be true or false?
Is MaxMana the same for everyone or different for everyone?
i want to be different for everyone
public class perPlayerStats {
Map<UUID, Double> mana = new HashMap<>();
public void separateMana(Player player){
mana.put(player.getUniqueId(), ManaStatMain.MaxMana);
}
}```
trying something like this
private brrrr
Then make an object and store it on a static map
Why? s is a string so s.getName() is... wrong?
should i do a PlayerJoinEvent so when a player joins he enters the hashmap?
ah its a string
Wait, if I may ask why is the players list strings?..
Here's how it's done
private boolean removePlayerFromGroup(YamlConfiguration yaml, OfflinePlayer player, String group) {
List<String> players = yaml.getStringList(group);
boolean flag = players.removeIf(s -> player.getName().equals(s));
yaml.set(group, players);
try {
yaml.save("plugins/MaxiCity/teams.yml");
} catch (IOException e) {
e.printStackTrace();
}
return flag;
}
Well [Max094_Reikeb, Nat7123, TheFlow] is a list of strings because usernames are strings
Yea thats what I would do, also have a Json file for the data if possible
or YML
or MySQL?
Ehh, i guess if you have a ton of players then sure
i will do that
ty!
mhm
@tawny horizon am I all good? https://pastebin.com/kq1nvvgg
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
These perms are automatically set to default: op? (names are just for example)
no
ok
you must declare them as well
ok, thanks
https://paste.md-5.net/vuyekowohu.cs @tawny horizon
I would recommend storing groups in data files and loading them on the plugin enable and storing them in a hashmap
Here is how I would recommend doing it.
public class Group {
@Getter
private final static HashSet<Group> allGroups = new HashSet()<>;
@Getter
private final HashSet<UUID> playersList = new HashSet()<>;
@Getter
private final String groupName;
public Group(String groupName) {
this.groupName = groupName;
allGroups.add(this);
}
public void addPlayerToGroup(UUID playerUUID) {
playersList.add(playerUUID);
}
public void removePlayerToGroup(UUID playerUUID) {
playersList.remove(playerUUID);
}
}
something like that
You could also make a HashMap with every UUID and their corresponding group for quick checking on that
that way you dont have to load a YML file every time you need to add / remove someone from a group
just save the file every 5min or so
and onDisable()
It's already a thing
Then how come the code for adding and removing players requires the file?
and permissions
might have something to do with the delay, idk
Sysout something to do with the instance just to see if it is null
for whatever reason
@tawny horizon
- When player connects, it checks in the
team.ymlfile to see in what Group the player is.
https://github.com/Max094Reikeb/MaxiCity/blob/master/src/net/reikeb/maxicity/listeners/players/JoinQuit.java#L90 - The
PlayerManageradds permissions to the player depending on the Group he is
https://github.com/Max094Reikeb/MaxiCity/blob/master/src/net/reikeb/maxicity/datas/PlayerManager.java#L56
Thats what Im saying, it would be more efficient to just have all of that data stored on a hashmap so that you dont have to check the file with every player that logs in
the file would be scanned once
it prints a blank line
The only way the file should be changed is through your code
do System.out.println("This is the instance: " + instance);
well no because if an admin has an access to the file then he can change it. I know people like us would know to only change the file via code (the command I made earlier) but for some people it's not that clear, and I need to make the code "break-proof"
it prints this: This is the instance: APOC-WorldControl v1.2.472
Then make it impossible to change any way other than through your own code, accessing the file with every login is just so slow that its not reasonable to do.
Ok, so its not null.
hmm
does anyone have a good tutorial for a tab plugin with a config file? i want to make a plugin that has its own yml file, and in that file there's a header section and a footer section, and you can change like 5 lines of each section, and also have like the player ping, server tps, etc etc
I believe Kody Simpson has a very detailed tutorial on this.
look him up on YouTube
don't see one
oh, then idk
@rough jay should players be allowed to be in more than one group at once?
maybe there is a better way to do it than a Bukkit schedule delay? all i want is to wait 5 min and try again, over and over, without stopping everything else
they can yeah
?paste
If you want I wrote this really quick, you could check it for bugs but i doubt there are any. https://paste.md-5.net/lujumuxari.java
It would handle all of the logic of taking care of groups and checking who is in what group, saving data, and so on.
Note: The "saveAllData()" method needs you yo actually write the config.save() method at the bottom of it (accidently left it out). Also feel free to make the groups non-case sensitive (i just made it case sensitive by defualt)
Also, it would mean they dont have to add permissions for groups
add entity to the team and set the color's team to glow color you want]
eh static
?
they probably said ew because that class is not unit testable and quite rigorously written Ig but its probably fine concerning this isnt some sort of enterprise
Could you tell me, based on my Github, what part of my code does yours replace?
is there a way to keep fly when changing gamemode to survival?
that it's like creative fly
It would mainly be used for replacing adding and removing players from groups
in a more efficient way
I don't understand like 90% of the code @tawny horizon
i mean, static having mutable state is not cool and that breaks single responsibility principes. Group shouldnt add itself to the list, thats a task for another object
like why does addPlayerToGroup only take a Player as parameter? the method is not named correctly then
well yea doest work
@EventHandler
public void onGamemodeChange(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer();
if (CommandFly.getFlyingPlayers().contains(player.getUniqueId())
&& event.getNewGameMode() == GameMode.SURVIVAL)
player.setAllowFlight(true);
}
it stores the groups mapped by name and by UUID in the concurrent maps
Because you use UUID not the Player object itself for a group list
is there a way to detect when a player touch the ground?
because CommandFly.getFlyingPlayers() doesnt include them maybe?
it should work
so then the statement is not reached
yes but if I do
addPlayerToGroup(player.getUniqueID());
to what group will player be added in?
The group object in which you are calling that method from..
its an instance method
so to the group
it adds the player to the group
public void
``` no static
Soooo what part of that breaks the functionality of the class XD
Idk
I mean srp just states classes should only change for one major reason
yeah so how do you register a new group and all?
Here is the thing, using 2 classes for handling groups vs 1 single class makes it more confusing for someone who is new to use, the purpose of me writing that was to make it as easy as possible to use
its automatically done
when you create the instance
how does it make it more confusing 
so if I have 6 groups I need 6 instances?
when you do new Group("name")
yes
exactly
Because its extra steps
extra steps doesnt mean something is inherently more confusing
Its more to keep track of
No it’s less to keep track of
If you have isolated responsibilities in different classes then you have reduced the amount of complexity in each class as opposed to just using one single class
The way in which it was made literally all he had to do was instance the class for every new group and then add players
calling the load method in onEnable
and save method every 5min or so and once in onDisable
so it means I replace my enum Group with your class?
Its meant to replace anywhere in which you would be using a group
I still don't get how is your way better... my enum is good, I don't have to register anything because it's static
Which is bad
can anyone help? i'm using a config manager and it tells console that it couldn't create the file, it also says that it reloaded it and saved it, but it actually did create the file but did not set anything inside it?
config manager class: https://paste.md-5.net/sijoruluzu.java
main class: https://paste.md-5.net/ariyuwamew.java
class where its supposed to set something in the file: https://paste.md-5.net/bajumulaye.cpp
You can use yours, all I am saying is at the very least you shouldnt be accessing the file every time a player logs in
thats why I wrote that, it does it once when the server loads
and thats about it other than saving
well no because with their code, I have more HashMaps which means more data to save.
I already have a HashMap for each player with datas of other things in my plugin and when a player has a Group, his group is stored in the HashMap
aaaah
the file has nothing to do with the Group
More HashMaps doesn’t even imply it’s more data to save necessarily
The data load and save method is already written XD
other than one line on the save method where you have to just type config.save(file)
at the bottom of the method
only one of the maps has anything saved from it at all
well no because if I use your code, I would still load the file each time a player connects and use the method to load the data or something like that
the other maps are used to make accessing data in the class easier
You wouldnt have to load it every time a player connects, you would just add them to a group
and then save it onDisable
the file would not need to be touched
well if someone changes the file
I think you can just make a hashmap contains a uuid and another hashmap for that?
Hashmap contains another hashmap i mean
If someone touches and changes a data file thats their fault XD
those are never meant to be edited any way other than through code
then what's the point of storing it in an editable separated file if not meant to be edited?
EDIT: edited other than code
Sorry i don’t understand what you mean lel…?
for saving the data through server reloads, thats the only point of the file
Haven't you seen Inception?
It's a dream inside of a dream
so HashMap inside of HashMap would be HashMapCeption (it's a joke)
joke 😂
how can i make an entityarmorstand that has something similar to noclip? I would like to give it velocity, but when it's in a block it gets stuck
Give it a hacked client then…
Or just see some hacked client source then…
Hacked clients are mods
and im sure it works completely differently since its on client-side
does anyone know how to add players to a scoreboard
also i've never saw a cheat with noclip for mc lol
what? I want to move armorstand in blocks but currently blocks stop it
You can try teleporting it through
Probably the best it's going to get
whats the best way of saving namespacedkeys?
Like persistently?
i was thinking of storing them in a class
Oh I just have a soft cache for it sort of
imo teleport isn't the best way for me, because i want to simulate natural mob movement with velocity, i tried with noGravity and setMarker method for armorstand, but then all velocity is removed
You will have to mess with NMS
Create your own entity and override the collision detection
wdym by saving
toString and fromString?
Singleton
NamespacedKeys are just strings
someone pls help
//The scoreboard display
public void OnJoin(PlayerJoinEvent event) {
createBoard(event.getPlayer());
}
public void createBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective obj = board.registerNewObjective("test", "dummy",(ChatColor.GOLD + "Bank Heist"));
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score score = obj.getScore(ChatColor.RED+ "Most Gold Collected:");
score.setScore(3);
obj.getScore(ChatColor.RED + "Most Gold");
score.setScore(2);
obj.getScore(ChatColor.RED + "Time Left");
score.setScore(1);
player.setScoreboard(board); ``` Can you explain how i would do it i cant find anything to do it.
Used to have a class called NamespacedKeyProvider which encapsulated a Map<String,SoftReference<NamespacedKey>> then whenever I needed a key I checked if that key existed within the map, if not then I created a new one and stored it in the map.
Because I had around 2000 keys
so if it was urgently needed, it would go ahead and gc unused ones given that they weren’t used anywhere else (softly reachable)
what is te best way to add to armorstand natural mob movement (like a pig etc.)
i've already answered 😦
I'm looking for different ways
but actually I have a question for you 😄
when i spawn that nms pig, and nms armorstand then it doesn't have any movement, how can i fix that?
show the code
EntityPig entityPig = new EntityPig(EntityTypes.an, ((CraftWorld) location.getWorld()).getHandle());
this.ID = entityPig.getId();
entityPig.setPosition(location.getX(), location.getY(), location.getZ());
PacketPlayOutSpawnEntityLiving spawnEntityPig = new PacketPlayOutSpawnEntityLiving(entityPig);
PacketPlayOutEntityDestroy destroyEntityPig = new PacketPlayOutEntityDestroy(ID);
PacketPlayOutSpawnEntity spawnEntity = new PacketPlayOutSpawnEntity(ID, entityPig.getUniqueID(), location.getX(), location.getY(), location.getZ(), entityPig.getXRot(), entityPig.getYRot(), EntityTypes.c, 0, entityPig.getMot());
sendPackets(spawnEntityPig, destroyEntityPig, spawnEntity);```
you spawn the pig using api, not packets
I do not understand 😕
world.spawnEntity(EntityType.Pig) or something
why are you using packets
there should be a method for spawning entities in an nms world
I'm a beginner, shouldn't I use them?
depends on what you are trying to do
as i can understand, he wants to make armorstand act like a pig
armorstand with natural mob movement
i thought the easiest way of doing it was replacing pig with armor stand via packets, like LibsDisguises does
if you dont want the pig shown dont send packets
- Spawn a pig with api
- Destroy it using packets
- Spawn an armorstand with same entity id as pig using packets
do you mean destroy it on clients using packets?
yes
we dont need a new entity on the server
Works! thx manya!
is it possible to edit this armorstand? hand movement, adding items etc?
that easy? glad to help!
yes, with metadata packet iirc
ok, and is it possible to change the Y pos of the armorstand?
I mean armorstand go into the ground
hello! I want to update a scoreboard every 5 seconds, I have read about Runnable and stuff like that, but it's still really confusing for me...All i want is just mere hints, of how do I do it 🥺 , like PROBABLY for no lags, I think updating the scoreboard asnyc would be a good idea? and cause if I update a scoreboard every 5 seconds on main thread, wont that cause lag? cause it wont be just updating a scoreboard but also displaying it on the player screen, right....right?
?scheduling Don;t do it async
how to get material from numeric ID i mean for example stone = 1, air = 0 etc.
We don't use magic numbers any longer
btw my actionbar for every player who joins the server is async, is that a good way or not?
Yes its fine. But for someone who is unsure of how to use a Runnable its not.
yes sending messages async is fine
(unless you start an async thread everytime you send it)
Hello everyone, is there a way of programmatically turning on and off a core shader that is within a resource pack? I am referring to core shaders that were added recently.
looks fine
ki
idk if player.getHealth is a problem
getHealthScale does also exist but i dunno what it does
it works so i dont care
uhh
getInstance 😒
that runs it immediatly when creating it
nvm
it looks kinda the same
but why not extending runnable?
bruh i use constructors
this staff may lead to the memory leak, you shouldnt use direct Player references
i guess just cancel a task when player leaves
wdym? cant i use a player object?
a Player object may go stale
what he said
a UUID will not
but i need to send an actionbar so i need an player object
get teh player object when you need it
but it seems unecessary to do uuid lookup everytime
I guess it depends on how often you need it and how reliably you are dropping the player reference when teh player leaves
i dont completely understand
ElgarL, do you write "teh" on purpose?
no
Ofc you can, but the Player interface and its implementation wasn’t created to be a key for maps nor stored, though it does support HashMaps by implementing hashCode and equals. Ideally it’s just a context object really.
Hey if I want to work with Craftserver etc.. Do I have to add the complete Spigot version as an external libary or is there an alternative?
I want to spawn npcs
?
for this maybe use citizens or something?
and what should i do instead?
athough i dont see a map here
I'd say UUID, it's resistant against invalid Player instances or whatever else you might encounter
i need to call player.spigot() every time when updating the actionbar so why would i choose for an uuid where i need to call Bukkit.getPlayer(uuid) every time?
could someone help me with the vault api? I've got essentials installed as well as vault. it logs [Vault] [Economy] Essentials Economy hooked.. however, when i try to get the service using Bukkit.getServer().getServicesManager().getRegistration(Economy.class), it just returns null
Idk the very case here, but yes the drawback of using UUID is that we have to rely on looking up Player by UUID, which in some cases might be redundant if you can assert that the object which strongly references the player is only used during the player's valid session. If you are not sure, and you don't want to use Server::getPlayer then maybe go with a WeakReference<Player> which won't stop the player object to get gc'd.
public static boolean doServiceChecks() {
if (Bukkit.getPluginManager().getPlugin("Vault") == null)
return false;
if (!Bukkit.getPluginManager().getPlugin("Vault").isEnabled())
return false;
if (!Main.getPlugin().getClanConfiguration().isVaultEnabled())
return false;
if (service == null)
service = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
System.out.println(service == null ? "service is null" : service.toString());
if (service == null)
return false;
return true;
}
it prints service is null everytime
when do you call that method?
so, i have another package which is discord bot code, i call this static method from a command executor for the bot
@Override
public void execute(Message msg, ArrayList<String> args) {
if (args.size() <= 0) {
msg.reply("Mention a player!").queue();
return;
}
String plrName = args.get(0);
@SuppressWarnings("deprecation")
OfflinePlayer plr = Bukkit.getOfflinePlayer(plrName);
if (VaultHook.doServiceChecks()) {
System.out.println("in here");
double balance = VaultHook.getBalance(plr);
msg.reply(String.valueOf(balance)).queue();
}
}
heres that if required
i dont even knows what happens when the player leaves the server
it keeps running guess
no errors
How do you think, is making Clans immutable a good idea? Clan has methods to set display name, add and remove members and homes. the problem is that with immutability i'd have to re-add a clan to the clan manager everytime when i change the clan
anyways point is, for that former code to work, vault must be loaded before you call that method and that also means vault needs to be present in the first place and that you need an economy provider
well you do need to cancel the task?
Hmm I'd say keeping it mutable sounds logical since by your explanation, it sounds like it contains a decent amount of state
i do have both the vault and EssentialsX-2.19.0 plugins. vault even logs this: [Vault] [Economy] Essentials Economy hooked . about vault not being loaded, it passes through the initial checks right?
if (Bukkit.getPluginManager().getPlugin("Vault") == null)
return false;
if (!Bukkit.getPluginManager().getPlugin("Vault").isEnabled())
return false;
if (!Main.getPlugin().getClanConfiguration().isVaultEnabled())
return false;
or does this not ensure that it is loaded? if so, how can i do that
Though Idk if you deal with some sort of multithreaded system here, in that case maybe having it immutable could make it automatically thread safe (apart from the manager)
no, not really. Just thinking about immutability design overall
adventure looks sexy
Yeah lol, though some of adventure is just "virtually immutable"
have you debugged?
(with for instance printing to sysout)
yea theres a println here right
it logs service is null
yesh so probably re-designing that actionbar class
thats once
Rohith you probably want to print for every branch
(every if statement)
everytime i run the -bal command from discord, it prints that
to see where exactly it stops
oh,
ublic static boolean doServiceChecks() {
if (Bukkit.getPluginManager().getPlugin("Vault") == null)
return false;
if (!Bukkit.getPluginManager().getPlugin("Vault").isEnabled())
return false;
if (!Main.getPlugin().getClanConfiguration().isVaultEnabled())
return false;
if (service == null)
service = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
System.out.println(service == null ? "service is null" : service.toString());
if (service == null)
return false;
return true;
}
yuh
Did you depend on vault in the plugin.yml
if it prints service is null, that means it doesnt stop at the if statements right?
something like this?
name: ---
author: ---
version: 1.0
main: ---
api-version: 1.16
softdepend: [Vault, Essentials]
commands:
clan:
plugin.yml
isnt it named EssentialsX?
oh
(idk acc)
i'll try that
sure do lol
but see
this method is being called long after the server has loaded
(coz i have to get on discord and type the command)
its still null :/
EssentialsX should work i guess
yh im tryin that
me struggling with static keyword..
static public static void static
[23:31:11] [Server thread/INFO]: [Vault] [Economy] Essentials Economy hooked.
[23:31:11] [Server thread/INFO]: [Essentials] Using superperms-based permissions.
[23:31:11] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[23:31:13] [Server thread/INFO]: Done (38.593s)! For help, type "help"
[23:31:13] [Server thread/INFO]: [Essentials] Essentials found a compatible payment resolution method: Vault Compatibility Layer (v1.7.3-b131)!
[23:31:13] [Craft Scheduler Thread - 0/INFO]: [Vault] Checking for Updates ...
[23:31:13] [Craft Scheduler Thread - 1/INFO]: [Essentials] º6Fetching version information...
[23:31:14] [Craft Scheduler Thread - 0/INFO]: [Vault] No new version available
thats the log just for clarification
nope still prints 'service is null'
illegal combination of modifiers static and static :kekw:
need a static plugin instance only to get its name smh
Just store the name instead?
i only need it once and making a private field for that goes brr
anyways this is what I used to do:
interface EconomyProvider {
Economy getEconomy();
}
class JavaPluginImpl extends JavaPlugin implements EconomyProvider {
private Economy economy;
@Override public void onEnable() {
this.getServer().getBukkitScheduler().runTask(this,() -> {
this.economy = this.getServer().getServicesManager().load(Economy.class);
});
}
@Override public Economy getEconomy() {
return this.economy;
}
}```
Then whenever you need economy thing you pass an instance of EconomyProvider (in my case it was the plugin instance)
hm lemme try that
how can i edit entity nms position via packets? (after spawn)
Protocolib
public class Swing implements Listener{
private Main plugin;
private int task1;
public Swing(Main plugin)
{
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void SwingEvent(PlayerInteractEvent e)
{
if(e.getAction() == Action.LEFT_CLICK_AIR) {
Player p = e.getPlayer();
Block b = p.getTargetBlock(null, 120);
String name = p.getName();
if(b != null && !b.getType().isAir()) {
World w = p.getWorld();
Location l = p.getLocation();
LivingEntity bat = (LivingEntity) w.spawnEntity(l, EntityType.BAT);
bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY,100000,100000));
bat.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100000,100000));
Vector v = l.getDirection();
Arrow arr = w.spawnArrow(l.add(v.clone().normalize().multiply(2) ),v, 10f, 0);
bat.setLeashHolder(arr);
BukkitScheduler sched = p.getServer().getScheduler();
task1 = sched.scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
if(arr.isInBlock()) {
p.teleport(p.getLocation().add(0,0.5,0));
p.setVelocity(v.clone().multiply(5));
p.setFallDistance(-100f);
bat.remove();
arr.remove();
sched.cancelTask(task1);
}
if(arr.getTicksLived() >= 40) {
bat.remove();
sched.cancelTask(task1);
}
}
}, 0L, 10L); }} }```
?paste
Why isn't this working? You are supposed to "swing" like Spiderman but as soon as you use it with two players it barks and starts to teleporting you all over the place.
ChunkData data = createChunkData(world);
for(int x = 0; x<16; x++) {
for(int z = 0; z<16; z++) {
data.setBlock(x, 0, z, Material.BEDROCK);
data.setBlock(x, 1, z, Material.GOLD_BLOCK);
data.setBlock(x, 2, z, Material.REDSTONE_BLOCK);
data.setBlock(x, 3, z, Material.COAL_BLOCK);
data.setBlock(x, 4, z, Material.GLASS);
}
}
return data;
}```
How can I create a world using this Chunkdata?
is there an event specifically for clicking entities?
or is there a way i can grab the clicked entity in an interact event?
PlayerInteractEntityEvent
ah tyvm
id use PlayerInteractAtEntityEvent but its up to u
private Main plugin;
private int task1;
public Swing(Main plugin)
{
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void SwingEvent(PlayerInteractEvent e)
{
if(e.getAction() == Action.LEFT_CLICK_AIR) {
Player p = e.getPlayer();
Block b = p.getTargetBlock(null, 120);
String name = p.getName();
if(b != null && !b.getType().isAir()) {
World w = p.getWorld();
Location l = p.getLocation();
LivingEntity bat = (LivingEntity) w.spawnEntity(l, EntityType.BAT);
bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY,100000,100000));
bat.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100000,100000));
Vector v = l.getDirection();
Arrow arr = w.spawnArrow(l.add(v.clone().normalize().multiply(2) ),v, 10f, 0);
bat.setLeashHolder(arr);
BukkitScheduler sched = p.getServer().getScheduler();
task1 = sched.scheduleSyncRepeatingTask(plugin, new Runnable() {
@Override
public void run() {
if(arr.isInBlock()) {
p.teleport(p.getLocation().add(0,0.5,0));
p.setVelocity(v.clone().multiply(5));
p.setFallDistance(-100f);
bat.remove();
arr.remove();
sched.cancelTask(task1);
}
if(arr.getTicksLived() >= 40) {
bat.remove();
sched.cancelTask(task1);
}
}
}, 0L, 10L); }} }```
Why isn't this working? You are supposed to "swing" like Spiderman but as soon as you use it with two players it barks and starts to teleporting you all over the place.
you'd need a task per player
how do i do that?😅
a HashMap
do i have to use a HashMap for every variable??
no
something like
Map<UUID, Integer>
instead of task1
So like
.put(player.getUniqueId(), sched.scheduleSyncRepeatingTask(...));
so instad of task1 = sched.scheduleSyncRepeatingTask(plugin, new Runnable() i do what?
You don;t seem to actually be using teh task ID other than to cancel
use a BukkitRunnable, pass the player to it so it only acts on that specific player, then you can call this.cancel() when finished
you will need to track what players have an active runnable, so you don;t start a second (if thats possible)
Someone pass me a code for peaceful animals to attack players? :(
called google
potion effects would most likely cause particles and is unnecessary
since you spawn your bat as a living entity already, you can just do bat.setInvisible(true);
toxic
based
thats how you do it http://www.just-fucking-google.it?s=spigot animal attack&e=where
Just Fucking Google It helps you help others to use Google and search on their own!
thanks
there is no way to set a passive mob's behavior to hostile, but you can manipulate pathfinding goals and damage when the mob is close enough to achieve something similar
look at the jar
its obfuscated
and it shades javassist
🤔
shady
Has 16k downloads I'm sure it's fine
mythicmob seems to have it https://www.youtube.com/watch?v=Tgk9dbRZP5Q&ab_channel=MooshroomStatus
#######################################################
Discord: https://discord.gg/U5dwKr3
#######################################################
Tutorial Pack Download: https://drive.google.com/open?id=1n6GE6qWwOQEH8jSnfUPpC719QWbbxfAK
#######################################################
Inspired by my tutorials? Consider donating to help ...
meh idk why they need javassist tho
downloads != safe
Just a weird amount of effort to put in to make a malicious jar
yeah idk
He probably using it for reflections or some sheet
reflection and bytecode modifications iirc
I have an error: java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.isurvialx.tutorial1.Tutorial1.getCommand(String)" is null package com.isurvialx.works;
import org.bukkit.plugin.java.JavaPlugin;
public final class Works extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
super.onEnable();
getCommand("pomoc").setExecutor(new PomocCommand());
}
} package com.isurvialx.works;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class PomocCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player p = (Player)sender;
p.sendMessage("§lIt works");
return false;
}
}
main: com.isurvialx.works.works
version: 1.0
author: Isurvialx
name: Tutorial
description: Interesujaca komenda
commands:
pomoc:
usage: /pomoc
description: sends something
aliases: /xhelp
set the command in the plugin.yml?
^
^
btw if you register a command with the commandMap field and that strange stuff, do you still need to have them in your plugin.yml?
Noe
aah
I see the plugin but the command doesnt work
Does somebody know how to set up a new world with custom chunk data?
just uhh what to use if i want to do a delayed task, but want to return a boolean from it
since schedulesyncdelayedtask doesnt cover that
basically searching for a soultion to this
bytecode engineering
it does not contain runtime patching
you'd have to implement that yourself via custom classloader
(although, it's not particularly hard)
thats absolutrly redundant in most cases smh
is there a resource website or smth for protocol lib examples?
the github
wellll, ASM should be faster than Javassist since it's incredibly optimized, and Javassist doesn't use ASM but instead its own higher-level API.
In plugins? Probably infecting your software with malware
If it's not too much of a hassle, could you give me an example code?
Getting this error:
name.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(ChatColor.translateAlternateColorCodes('&', "&aName: &a" + player.getName())), new Text(PlaceholderAPI.setPlaceholders(player, "&6Balance: %vault_eco_balance_commas%"))));
event.setFormat(ChatColor.translateAlternateColorCodes('&', name + " &8\u00BB&f ") + ChatColor.RESET + event.getMessage());```
- Dont use legacy color codes in components
- AsyncPlayerChatEvent doesnt support components
(but on paper it does 🙂)
Is there a way I could convert a String (given through a command argument) into a material? (like if someone put STONE_SLAB, I could make an ItemStack with material type stone slab)
Material.matchMaterial
Oh sweet, thanks
If you want to use components on the chat event with spigot you have to manually send a new message to everyone
https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/PacketType.Play.Client.html
would anyone know which one of these to use for showing the bobber & line for a fishing rod
is there a way to dynamically change a tasktimer (aside from canceling and creating a new one.)
wdym by dynamically change
no not really
so best way would just be to cancel the current one and schedule a new one with the new timer?
you may run it every tick and count them by yourself
that wouldn't impact performance?
no
dope
just to understand it a bit better
why would it not impact performance? is it like subscribing to an event that runs x amount of ticks?
It does impact performance
Because it has to invoke your runnable every tick
But it’s negligible to the extent that it doesn’t impact really
but thats actually nothing
so should I just dynamically create the runnable depending on how fast I want to run it (aka if (this) cancel & make new) or do what manya said?
well
You’d basically skip the logical code execution when it’s the wrong tick right?
y-yeah
Yeah then it really doesn’t matter
I mean you could re schedule a new task everytime but it comes with some other problems
what are they?
thats annoying at the first place isnt it
true
For instance you have to keep track of each individual BukkitTask instance which gets created every time. Then it also increments task id tracker unnecessarily.
For the former ofc you don’t have to keep track of them, but you might need it in the future if you want proper cancellation or something
I don't think keeping track of them would be an issue but I do see what you mean with the task id. Are there any side effects to that?
(just curious)
how do i spawn a client sided entity with protocol support?
send spawn living entity packet
Probably not an issue for any decent dev but the design would require excessive mutations (which can cause complications for other stuff)
very true
Its in Play.Server section
well server sends an entity to the client
not the client to the server
but i thought the client was per-player and server was global players
why would the server handle an entity only one person's client sees?
that's not how servers work. To get clientsided rendering of an entity
server needs to send the packet
to specific player
in order for server to display all entities in the world
it sends packets to player's client every tick
a.k.a 1/20 second
ah ok
but yes, you can send the packet manually
would that mean i need to make a repeated task in order to spawn the entity and then to keep it alive and do things afterwards?
so i can just spawn a fake entity for the player, and it'll just wander around like normal ai?
ah
and the entity stays there until updated?
client believes it that its from server and its true
client renders it
AI pathfinding system on server, it sends
positions packets back to the client
AI is not done on clientside
you can test that by lagging yourself out in a server
not any mob would move
nor do the sounds
you're basically sending data back to the client without server noticing it and verifying it
you're bypassing the whole server processing
For removing entity from the client screen
there's Entity Destroy packet
which when sent deletes mob from player's screen
alr that's better in my case
In order to do animations
there's separate packet
when player or mob has been killed server sends animation packets back
to inform client that animation needs to be done since on server a entity has died
most of the data about the game is stored on the server
client mostly does the rendering
and positioning
so uh in my case, im trying to make it look like a fishing rod is being thrown from a carrot on a stick
does this packet count as an entity when using the entity spawn packet?
it should
there's a website
which tells you more about minecraft's protocol
go to Current Protocol Specification and see the packet you want for yourself
yes you can spawn fishing hook
by using Spawn Entity packet
im not sure if it includes the rendering of the string
is there any way to convert a cachedservericon to a bufferedimage?
yeah im not sure where you'd specify the string's owner
in bukkit, you have to specify an owner public EntityFishingHook(World world, EntityHuman entityhuman) {
and i guess they also use the owners facing direction for hook velo and such
are you looking into NMS or protocollib
Every entity has its own ID
persistent between client and server
EID
not UUID
https://prnt.sc/1you9d8
This method registers goalSelector of entity villager what is the number parameter for this method im not sure what it does
that's nms
but i was hoping protocol had support for what i wanted to achieve in nms
maybe i have to specify the owner afterwards or smth
PacketContainer fakeExplosion = protocolManager.
createPacket(PacketType.Play.Server.EXPLOSION);
fakeExplosion.getDoubles().
write(0, player.getLocation().getX()).
write(1, player.getLocation().getY()).
write(2, player.getLocation().getZ());
fakeExplosion.getFloat().write(0, 3.0F);```
similar to this
its a reflection library for packets. it doesnt provide full support for clientside features you need to do it for yourself
im pretty sure I saw on youtube how to spawn fishing hook with string via NMS
seems like the hashmap but the hashmap has Pathfinder items but does the index matter when adding more pathfinder goals?
i cant find it
but its at least couple years old
and i think it was german
coding it
lmao
what he did is he pulled up the fishing rod class
and there's i think a method
to spawn the grappling hook
he just used the reflection to get that private method
and utilised it
how do i make a custom skull item from nbt? like from the heads db api
tf is this new "theres a better way of doing it " thing
ahahahhaah
theres always a better way of doing anything
public static ItemStack createSkull(String value) {
String url = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUv" + value;
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
if (url.isEmpty()) return head;
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", url));
try {
Field profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, profile);
} catch (IllegalArgumentException | NoSuchFieldException | SecurityException | IllegalAccessException error) {
error.printStackTrace();
}
head.setItemMeta(headMeta);
return head;
}```
basically go to custom heads website, go all the way down until you see the "value" field and paste that into the parameter for this method
it'll return your head as an itemstack
how to i enable the arms of an armor stand? i dont see anything on the intellij tabcomplete i see stuff like setGravity but nothing for arms or baseplate?
those are really more living entity attributes
you have to actually set the nbt of the living entity to show arms
What, no
Cannot resolve method 'setArms' in 'Entity'
read plz
what
Entity is not armorstand
oh wait i just realised i was using entity instead of armor stand
LivingEntity armorStandEntity = (LivingEntity) Bukkit.getWorld("your_world").spawnEntity(location, EntityType.ARMOR_STAND);
ArmorStand armorStand = (ArmorStand) armorStandEntity;
armorStand.setArms(true);```
mb
yuppers
actually you can even do
LivingEntity armorStandEntity = (LivingEntity) Bukkit.getWorld("your_world").spawnEntity(location, EntityType.ARMOR_STAND);
(ArmorStand) armorStandEntity.setArms(true);```
alright thanks
does anyone have an example of sending server nms packets to a player
Even better,
ArmorStand armorstand = world.spawn(location, ArmorStand.class)
how am i supposed to know which letters correspond to which parameters?
doesnt seem to say in the wiki, unlike the tutorial im watching
public PacketPlayOutSpawnEntity(int var0, UUID var1, double var2, double var4, double var6, float var8, float var9, EntityTypes<?> var10, int var11, Vec3D var12) {
this.c = var0;
this.d = var1;
this.e = var2;
this.f = var4;
this.g = var6;
this.k = MathHelper.d(var8 * 256.0F / 360.0F);
this.l = MathHelper.d(var9 * 256.0F / 360.0F);
this.m = var10;
this.n = var11;
this.h = (int)(MathHelper.a(var12.b, -3.9D, 3.9D) * 8000.0D);
this.i = (int)(MathHelper.a(var12.c, -3.9D, 3.9D) * 8000.0D);
this.j = (int)(MathHelper.a(var12.d, -3.9D, 3.9D) * 8000.0D);
}```
your main class which extends JavaPlugin
i can call it within itself?
yep
oh ok
that's not working
show ur code
public class BroadcastReader extends JavaPlugin implements Listener {
public File config;
public Socket clientSocket;
public PrintWriter out;
@Override
public void onEnable() {
BroadcastReader.getProvidingPlugin().saveDefaultConfig();
try {
clientSocket = new Socket("ip", 8080);
out = new PrintWriter(clientSocket.getOutputStream(), true);
} catch (IOException e) {
e.printStackTrace();
}
config = new File(getDataFolder(), "src/main/resources/config.yml");
if(!config.exists()){
config.getParentFile().mkdirs();
saveResource("src/main/resources/config.yml", false);
}
getServer().getPluginManager().registerEvents(this, this);
}```
whats the whole BroadcastReader.getProvidingPlugin()
lmao my first guess at saving a config
it's not static
it doesn't need to be static
all you need to do is saveDefaultConfig() i think you're confused that you need an instance reference
yeah i figured it out lol
I mean you can use this if you really want to have an instance reference
nah i don't
i forgot that its inheriting all the methods so i can just call it lol
since it's a function of the class now
question, what's the usual way of updating config files other than manually changnig it
is there a way to do it from the server instance
like an initial setup screen in the server... maybe a slash command that sets it up
Nope
The usual method is to read the one in the jar and the one on the server, copy any missing fields from jar to server
Of course if you change fields that doesn’t quite work
is there any way to convert a cachedservericon to a bufferedimage?
Custom enchantments and effects on a pickaxe while player is holding: looping through enchantments on pick and doing ABC...
One repeating task that loops through all players and checks if player is holding certain item and do something
OR
One repeating task per player that does so.
My main concern is with lag spikes when the repeating task is ran, and my thought process is to use per player tasks which means that the tasks are ran at a more sporadic interval.
Any thoughts would be appreciated.
Depends how frequent it is
every 15secs
A good option is to run a task every say, 3 seconds and process 20% of online players each time
unnecressary. as long as you are not doing anything blocking it should be totally fine
👀
i have an api in my plugin that uses public classes and voids and all that but how am i supose to let other people use it in their plugin's library? i tried adding it to a new project and i did ApiTest at = new ApiTest(this); and where it says this, it says it needs to be the exact same main path as my api project so lets say in my api class my main class path was com.stuff.main the main path on the other plugin would need to be that as well
did you import the jar
yeah its added as a library
is your api an actual plugin itself?
yeah
what
its not on my server or anything im just trying to test the methods in another plugin
An api is just a set of interfaces you internally implement, then you expose them through services manager.
what you can do
is to get the plugin instance via pluginmanager
and cast it to the class of library plugin
I've heard there's some sort of service manager in bukkit or smth
MyLibrary library = (MyLibrary)server.getPlugin("MyLibrary");
Or you just use JavaPlugin#getPlugin(Class<? extends JavaPlugin>)
This way you dont need to cast
im surprised that the library doesnt provide a static accessor
or service api
majority of API's on spigot include static getter method to get the instance of the library plugin
iirc WorldGuard or WorldEdit uses service api
You need to add it as a library but your must not include it when compiling.
it only works for some libraries, plugin developer needs to implement the service for himself.
Usually the ServicesManager is not needed when providing an API.
Its only useful if you want other devs to provide an implementation for one of your interfaces.
Custom events and simple API classes are more suitable in most cases.
:dynoError: The Fun module is disabled in this server.
You cannot have fun here.
Is using abstract/interface class considered as using inheritance concept?
😂
For BlockPlaceEvent#getItemInHand()
Is the item in hand the block that was placed? EG: If they place blocks in offhand, it gets the block in the offhand, and if its in main hand it gets it in main hand?
Are you trying to add support from 1.8 to latest?
1.16+ only
Interfaces are nothing but polymorphism
Maybe will do 1.13 but not sure yet
Maybe you should use BlockPlaceEvent#getBlockPlaced instead.
Maybe i should of added this information:
I want to find how many items the player has in theyre hand while placing a block
Abstrsact class is.. Kinda both
If you want to get the information from the ItemStack, you could detect the hand.
You could try tho.
The BlockPlaceEvent#getItemInHand
Yeah cant hurt to try ofc was just curious before trying it or wether i had to do some jank stuff between events to get item in hand xD
So I have a simple task from school, make a method to calculate area of triangle by using inheritance concept, it's overcomplicating stuff but idk
Any extra details? You have triangle class that, maybe, extends Shape?
That's what I'm thinking right now, but I don't know what to put on the Shape class.
No extra details, literally that's it.
Hm, make it abstrsact and make an abstrsact calculateArea method on it. Then, make Triangle extend Shape and implement the method
Thats clearly polymorphism, but..
public abstract double calculateArea();
abstract is not inheritance right?
What do you mean by that?
inheritance as a concept of oop
abstract method just has to be overriden on the class extending it
read this first
ah mb
Circle extends/implements Shape and thereby inherits the method calculateShape() from Shape
😋 .
Like this I guess lmao
public abstract class Shape {
public abstract double calculateArea();
public abstract double calculateVolume();
}
public class Triangle extends Shape{
private double base, height;
public Triangle(double base, double height){
this.base = base;
this.height = height;
}
@Override
public double calculateArea() {
return 0.5 * base * height;
}
@Override
public double calculateVolume() {
throw new UnsupportedOperationException("This shape doesn't support this method!");
}
}
Make the abstract class an interface
Abstract class only makes sense if you have a state
I mean, he should solve that task with inheritance
can anyone help?
Send the error
no error, just the logger saying that it couldn't create it
even though it did make it but without anything inside it
Get the error you're hiding it with try catch
where do you place your abstract methods in your abstract class personally?
Which can be done with an interface 😄
At the bottom
so under everything else?
Yeah, same
public static var
private static var
public static method
private static method
public field
private field
constructor
public method
private method
public abstract method
protected abstract method
this is what i do currently
idk how to do that
this? idk i'm just guessing
plugin.getLogger().info(e.getMessage());
it's in the intellij settings or whatever, idk
go on the settings and search for font
You just need to catch the IOException. What you do in your catch block is irrelevant.
what does that mean
You can take that literally.
try { Code } catch(IOException e) { Handle exception }
??
this doesn't say how to send the error
Use
Exception#printStackTrace()
i don't get it
https://paste.md-5.net/nipitusige.md
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
maybe consider doing that?
maybe consider not being toxic?
maybe consider thinking again?
This is the excetion you just catched. Read the first sentence.
DuckDuckGo what this exception could mean and why it occurs.
i don't understand
does it mean my path in enivoronment variables is incorrect or something?
Nope...
If you want to create a file, you have to make sure that all folders in its path are actually present.
mkDirs();
isn't that this?
public void createTabConfig() {
if (plugin.getDataFolder().exists()) {
plugin.getDataFolder().mkdir();
}```
mkdir only creates the bottom most file
If my folder already exists: Create the folder <= Thats what you are doing
mkdirs create all of em
make mkdir to mkdirs and ! in front of the top most if statement
if its in the plugin directory thats all you need anyway
yea, though he wanted to go deeper in
ok, so i fixed the config manager thing, but now it doesn't set anything inside it?
"it"...
whats it?
like the tabmanager class does not set anything inside the tab config file
why should it?
that's what it's supposed to do
does it get called / executed?
yes
show code
can we see some code
lol
hey fixed it
wait no, i'm not
show code
TabManager class:
public void TabManager() {
cfgm = new ConfigManager();
cfgm.reloadTab();
FileConfiguration tabConfigFile = cfgm.getTab();
tabConfigFile.set("banana", "yes");
cfgm.saveTab();
}```
Main class in onEnable:
`TabManager tab = new TabManager();`
after
show saveTab, reloadTab method
it says that tab in main and TabManager in TabManager class is not used
well u are not callin it then
by calling tabmanager i am calling it tho?
can we see configmanager
.
from what i know, if you have a method named after your class it is run when you call that class
Show the whole class
well its called when you create the class
?paste
fucking phone
main: https://paste.md-5.net/ajuxegekil.java
tab manager: https://paste.md-5.net/cahoyevaba.cpp
but this has nothing to do with the config manager class
it may does
it has everything to do with it lol
when it doesnt save changes
it creates the folder and the file, it's just that the tab thing is not used for some reason
it prob has to do with it😂
from the limited code you've sent there doesn't seem to be any reason for it not to work
so we have to see every aspect
true shit my g
intellij is telling me that TabManager method in TabManager class is unused along with tab variable in the main class
because why should u use it
oh
u run the class
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.
config manager class: https://paste.md-5.net/cifobomoxe.java
i doubt you'll find anything about this in there, but ok
ok, thanks
np
Latest. Below 16 doesnt even work.
Current LTS is 17
adopt
is there even a noticeable diff between jvms
Isn’t that to run JavaScript on the jvm?
Yes
it's a normal JDK
Some have patches for certain things others are meant for debugging
they claim to be about 10% faster than other JDKs but tbh 10% isn't that much
I'll probably just use the normal openjdk from Debian's official repos
yeah well one dude claims it to be 8-11% faster, no idea how true that statement is though 😄
Would like to see some statistics on that :0
I mean, I could also claim that my plugins are 8-11% better than other ones.... 😄
I don't believe them until there's some proof 😄
I'll just go with openjdk 17 for now which is included in debian anyway
GraalVMs biggest selling point is native executables. You cant compile Spigot as native executable so i wouldnt bother.
Anyone know how these are done? This is on the OriginRealms (spigot, not modded) server. I know it's a resource pack but how exactly could I replicate this in code and in my resource pack?
how do i get the player head to show the playes skin
SkullMeta skullMeta = (SkullMeta) item.getItemMeta();
skullMeta.setOwner("Commandcracker8");
item.setItemMeta(skullMeta);
```Something like that
i'm not sure exactly how did they did, but i would use the bossbars and custom fonts
that's a good shout
also i mean like to remove a bossbar texture, then add multiple bossbars set to unicode characters that are then textured in a font and aligned with the ascent thing
hang on
SkullMeta meta = (SkullMeta) playerHead.getitemMeta();
skullMeta.setOwner(list.get(i).getDisplayName());
skullMeta.setDisplayName(list.get(i).getDisplayName())
ArrayList<String< lore = new ArrayList<>();
lore.add(Utilities.color("&6Health: &4" + list.get(i).getHealth()));
lore.add(Utilities.color("&6EXP: &4" + list.get(i).getExp()));
lore.add(Utilities.color("&Gamemode: &4" + list.get(i).getGameMode()));
meta.setLore(lore);
playerHead.setItemMeta((ItemMeta) meta);
```This should help
anyone know why i'm getting this error? it seems to be about the reload method, but i don't understand why it occurs. (btw it creates the file but does not set anything inside it)
main class: https://paste.md-5.net/ezeresowur.java
config manager class: https://paste.md-5.net/oguseloqep.java
tab manager class: https://paste.md-5.net/ufopuwujeh.java
error: https://paste.md-5.net/amogesulel.bash
Custom textures
but how in code
Just a hologram with a character that has its texture changed in a resource pack.
But they're not holograms... they're on the player's screen
nope still nothing
yapperyapps, i think commandcracker8 is asking on how to make bossbars
Yeah was moving to that next.
Then try boss bar textures
for that you'll need to ask in a different discord server about fonts and textures
ok
Either the font or the bar.
it works now thank you
wrong discord server bud
its plugin dev but ok
If you modify the bars texture you can
it's not, it's the texture
ok
Generally they use a font to show a custom texture
im not entirely sure how I'd achieve that
i still need help if anybody's up for it
It tells you file is null
what does it mean though
It means tabFile is null
it made the file tho
?paste
can anyone spot my error? when i break a block that exists it removes the block but executes player.sendMessage(ChatColor.YELLOW + "[WATCHBLOCK B] Block was not protected.");
dont even understand how thats possible...
yeah lemme take my holy crystalball and clairvoyance what your methods do
the methods do exactly what they're named to do blockexists just checks if the block exists in an sql database, removeblock removes it from the database
the only explanation here is that something else is removing it right?
we would need to see what your methods do to help you
otherwise we can just speculate
How can I send a video in here?
Hello!
I am making Spheres with Particles by rightClicking. If I rightClick again the radius gets bigger. By pressing left click I can "shoot" the sphere by moving the center. Everything functions right with the small radius. However, once I shoot the middle or the big one, everything goes right until it should stop. The Runnable doesnt stop then it just starts from the top again although "done" is true. Pls help me I cant find the error.
SphereTask:
https://gist.github.com/ItzJustNico/e72aeba7fee0d2f1a73b7b6713ad3610
LimitedTask:
https://gist.github.com/ItzJustNico/9a11703152f9ee3e7d4c4ab0c3bc5ec1
LimitedTaskRunnable:
https://gist.github.com/ItzJustNico/1eb3c1e006a9d561165722bf75543212
remove those embeds
seems like you never cancel the scheduler
it does the execute method and then check if done is true it functions in every other Task I did and functions if the radius is 1
so you mean because it needs a sec to fade out or what
Yeah you can see by the debugs in the chat that done is already true and it should stop but it doesnt then it starts again and spawns a sphere again after the explosion @hybrid spoke
When I do the small one I get done in the chat and it stops as it should
there is so much boilerplate code
I am sorry I still need to learn alot I will try to improve it after I fixed the error
i fear no man... but that thing:
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1584) ~[?:?]
at java.util.HashMap$KeyIterator.next(HashMap.java:1607) ~[?:?]
it scares me
so you mean it starts from new after being done? or is it really just that 1 second fade like in the video?
After the "true" "done" "true" it should be finished. But the there is the "false" again which means it started again somehow and done is "false" again @hybrid spoke
where do you execute it
https://gist.github.com/ItzJustNico/1f0f93ac774c5831bac9bd49c7c84732
I call this method on rightclick in the PlayerInteractListener
how do i check to make shour that it is a player head that someone is clicking
so since your middle one needs 2 rightclicks, you start it 2 times. same for your big one just 3 times
you want to check if the one who just clicked is a material?
I set the done to true before so It should be finished and then started again. But it probably is does not have enough time to finish right?
this seems like a result of static abuse
whats static abuse?
yeah you were right I just tested it
thank you alot for helping
ok so i removed the part that runs the TabManager class in the main class, and then i put the thing that sets a line in the config file in the loadConfigManager() method and everything is working. now, i'm guesing that this means that the order is wrong, but the thing is, is that in onEnable i run loadConfigManager() first AND THEN i do the TabManager thing... so what do i do?
might help to register the events in the main class