Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.kael.awd;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.logging.Logger;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.InvalidConfigurationException;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.PluginDescriptionFile;
- import org.bukkit.plugin.java.JavaPlugin;
- import me.kael.awd.PlayerListener;
- public class main extends JavaPlugin {
- public final Logger logger = Logger.getLogger("Minecraft");
- public final PlayerListener pl = new PlayerListener();
- FileConfiguration data = new YamlConfiguration();
- @Override
- public void onDisable() {
- PluginDescriptionFile pdfFile = this.getDescription();
- this.logger.info(pdfFile.getName() + " Has been Disabled!");
- data.set("dupeciler", new ArrayList<String>(pl.HashMap));
- try{
- data.save(new File(this.getDataFolder(), "dupeciler.txt"));
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- @Override
- public void onEnable() {
- PluginDescriptionFile pdfFile = this.getDescription();
- this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion()
- + " Has been Enabled!");
- this.logger.info(pdfFile.getName() + " is developed by" + " KaeL ");
- getServer().getPluginManager().registerEvents(this.pl, this);
- try {
- data.load(new File(this.getDataFolder(), "dupeciler.txt"));
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InvalidConfigurationException e) {
- e.printStackTrace();
- }
- }
- public boolean onCommand(CommandSender sender, Command cmd,
- String CommandLabel, String[] args) {
- Player player = (Player) sender;
- if (CommandLabel.equalsIgnoreCase("dcheck")
- && player.hasPermission("awd.dcheck")) {
- if (args.length < 1) {
- player.sendMessage(ChatColor.DARK_RED
- + "Kullanimi: /dcheck <player>");
- }
- if (args.length == 1) {
- if (pl.HashMap.contains(args[0].toLowerCase())) {
- player.sendMessage(args[0] + ChatColor.DARK_RED
- + " Adli Oyuncu Dupeci olarak isaretlenmis!!");
- } else if (pl.HashMap.contains(args[0].toLowerCase()) == false) {
- player.sendMessage(args[0] + ChatColor.DARK_RED
- + " Adli Oyuncu Dupeci olarak isaretlenmemis!!");
- } else {
- player.sendMessage(ChatColor.DARK_RED + "Hata Var!!");
- }
- }
- } else if (CommandLabel.equalsIgnoreCase("dremove")
- && player.hasPermission("awd.dremove")) {
- if (args.length < 1) {
- player.sendMessage(ChatColor.DARK_RED
- + "Kullanimi: /dremove <player>");
- }
- if (args.length == 1) {
- if (pl.HashMap.contains(args[0].toLowerCase())) {
- player.sendMessage(args[0] + ChatColor.DARK_RED
- + " Adli Oyuncudan Dupeci isareti kaldirildi!!");
- pl.HashMap.remove(args[0].toLowerCase().toString());
- } else if (pl.HashMap.contains(args[0].toLowerCase()) == false) {
- player.sendMessage(args[0]
- + ChatColor.DARK_RED
- + " Adli Oyuncu Zaten Dupeci olarak isaretlenmemis!!");
- } else {
- player.sendMessage(ChatColor.DARK_RED + "Hata Var!!");
- }
- }
- } else if (CommandLabel.equalsIgnoreCase("dlist")
- && player.hasPermission("awd.dlist")) {
- if (args.length < 1) {
- if (pl.getOnlineDupers().isEmpty() == true) {
- player.sendMessage(ChatColor.GREEN
- + "------ Offline Dupeciler Listesi ------");
- player.sendMessage(pl.getOfflineDupers().toString());
- player.sendMessage(ChatColor.GREEN
- + "---------------------------------");
- player.sendMessage(ChatColor.GOLD
- + "Not: Online Dupeci olmadigi icin Offline Dupecileri görüyorsunuz.");
- } else if (pl.getOnlineDupers().isEmpty() == false) {
- player.sendMessage(ChatColor.GREEN
- + "------ Online Dupeciler Listesi ------");
- player.sendMessage(pl.getOnlineDupers().toString());
- player.sendMessage(ChatColor.GREEN
- + "---------------------------------");
- } else {
- player.sendMessage(ChatColor.DARK_RED + "Hata Var!!");
- }
- }
- }
- return false;
- }
- }
Add Comment
Please, Sign In to add comment