NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package me.kingOf0.Chest;


import java.util.Set;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

public class CommandExec implements CommandExecutor {

private ChestsYAML config;
private RunnableClass runnable;
private Util util;
private World world;

public CommandExec(ChestsYAML config, RunnableClass runnable, Util util) {
this.config = config;
this.runnable = runnable;
this.util = util;

world = Bukkit.getWorld(this.config.getString("Options.World"));
util.log( world.toString(), null);

double x = this.config.getDouble("Chests." + 1 + ".Location.x");
double y = this.config.getDouble("Chests." + 1 + ".Location.y");
double z = this.config.getDouble("Chests." + 1 + ".Location.z");

Location loc = new Location(world, x,y,z);
util.log("loc: " + loc + " x:" + "Chests." + 1 + ".Location.x", null);
}





@SuppressWarnings("unused")

public boolean onCommand(CommandSender p, Command cmd, String alias, String[] args) {


if (alias.equalsIgnoreCase("kingOfchests")) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("yenidenyukle")) {
if (p instanceof Player) {
if (p.hasPermission("KingOfChests.reload")) {
config.reload();
p.sendMessage("§8[§7KingOfChests§8]§a Başarıyla§7, KingOfDrops yeniden yüklendi!");
} else {
p.sendMessage("§8[§7KingOfChests§8]§7 Bunun için gerekli yetkiye §4sahip değilsin§7." );
}

} else {
config.reload();
util.log("§8[§7KingOfChests§8]§a Başarıyla§7, KingOfChests yeniden yüklendi!", p);

}
} else if (args[0].equalsIgnoreCase("force") || args[0].equalsIgnoreCase("yenile")) {
runnable.run();
if (p instanceof Player) {
p.sendMessage("§8[§7KingOfChests§8]§a Başarıyla§7, sandıklar yenilendi!");
} else {
util.log("§8[§7KingOfChests§8]§a Başarıyla§7, sandıklar yenilendi!", p);
}
} else {
util.log("kullanim", p);
}
return true;
//ZOR ZOR ZOR OPS OPS
//BCMD 0 1 2 [3]
//kingofchests add 1
}
if (args.length == 2) {
if (p instanceof Player) {
Player player = (Player) p;


if (args[0].equalsIgnoreCase("add") || args[0].equalsIgnoreCase("ekle")) {

if (!(p instanceof Player)) {
util.log("§8[§7KingOfChests§8]§a Bu komutu konsol uzerinden giremezsiniz.", p);
return true;
}

if (Double.valueOf(args[1]) > 1 || Double.valueOf(args[1]) < 0) {
p.sendMessage("§8[§7KingOfChests§8]§7 Şans değeri, 0 ila 1 arasında olmalıdır.");
return true;
}
if (util.getItemStackInHand(player).getType() == Material.AIR) {
p.sendMessage("§8[§7KingOfChests§8]§7 Ciddimisin. Ne yani, Havayı mı ekleyeceksin??");
return true;
}
Block block = player.getTargetBlock((Set<Material>) null, 10);
if (!(block.getType() == Material.CHEST)) {
p.sendMessage("§8[§7KingOfChests§8]§7 Bu komutu bir Sandığa bakarak tekrar yazmalısın!");
return true;
}
//for (Integer i = 0;config.isSet("Chests." + i + ".Location.X") ;i++) {
//String element = "Chests." + i;

Location loc = block.getLocation();
Double doub = Double.valueOf(args[1]);
Integer maxM = 0;
for (;config.isSet("Chests." + maxM);maxM++) {}
for (Integer sif = 0; sif <= maxM ; sif++) {

p.sendMessage( "0 sif: " + sif + " maxM:" + maxM );
//Eğer config'te bakılan block varsa, onu bulur.
ItemStack is = util.getItemStackInHand(player);

if (sif == maxM ) {
util.writeConfig(sif, 0, is , doub , loc);
p.sendMessage("N sif:" + sif);
return true;
}

p.sendMessage( "1 sif: " + sif + " LAL: " + block.getLocation() + util.getLocation(sif));
if (util.getLocation(sif).equals(block.getLocation() )){
p.sendMessage( "2 sif: " + sif );
Integer maxS = 0;
Integer in = 0;
boolean forCheck = config.isSet("Chests." + sif + "." + in + ".ItemStack");
for (;config.isSet("Chests." + sif + "." + maxS);maxS++) {util.log("MaxS: " + maxS, p);}
for (; forCheck; in++) {
p.sendMessage("Sif: " + sif + " in: " + in);

if (maxS > 0) {
util.writeConfig(sif , maxS , is, doub, loc);
p.sendMessage("L sif:" + sif + " L in: " + in);

} else {
util.writeConfig(sif, 0, is, doub, loc);
p.sendMessage("L sif:" + sif + " L in: " + in);
}

p.sendMessage( "3 sif: " + sif + " in: " + in);
forCheck = false;
return true;

}
} else {
p.sendMessage("FAK");
}

}

//}

p.sendMessage("§8[§7KingOfChests§8]§a Config dosyasına " + args[1] + " türünde, girdi, elinizdeki eşyaya eklendi.");

} else {
util.log("kullanim", p);
}
} else {
util.log("kullanim", p);
}
}
}
return true;
}


public void kullanim(CommandSender p, Boolean isPlayer) {
if (isPlayer) {
p.sendMessage("§8[§7KingOfChests§8]§7 Kullanım '/KingOfChests add|ekle [<Chance|ŞansDeğeri>] ', §7config dosyasına elinizdeki itemi ekler.");
p.sendMessage("§8[§7KingOfChests§8]§7 Kullanım '/KingOfChests reload|YenidenYukle ', §7config dosyasını yeniden yükler.");

} else {
util.log("§8[§7KingOfChests§8]§7 Kullanım '/KingOfChests add|ekle [<Chance|ŞansDeğeri>] ', §7config dosyasına elinizdeki itemi ekler.", p);
util.log("§8[§7KingOfChests§8]§7 Kullanım '/KingOfChests reload|YenidenYukle ', §7config dosyasını yeniden yükler.", p);

}
}


}
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.