Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.djslin99.totl;
- //imports
- import java.io.File;
- import java.io.IOException;
- import java.util.HashMap;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.World;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- public class TroubleonTheLard extends JavaPlugin {
- private File pointsfile = new File("plugins/TroubleonTheLard/points/",
- "points.yml");
- private FileConfiguration pointfileConfiguration = YamlConfiguration
- .loadConfiguration(this.pointsfile);
- // HashMap erstellen
- public HashMap<Integer, Player> players = new HashMap<Integer, Player>();
- int PlayerAnzahl = players.size();
- @Override
- public void onEnable() { // onEnabel Anfang
- } // onEnabel Ende
- @Override
- public void onDisable() { // onDisable Anfang
- } // onDisable Ende
- // Befehls-Variablen
- public boolean onCommand(CommandSender sender, Command cmd, String label,
- String[] args) { // Befehle start
- Player p = (Player) sender;
- // Befehl: Totl
- if (cmd.getName().equalsIgnoreCase("totl")) {// /totl Befehl Anfang
- // Bei 0 Argumenten Info Page
- if (args.length == 0) { // 0 Argumente Anfang
- p.sendMessage("Willkommen bei " + ChatColor.AQUA
- + "Trouble on TheLard");
- p.sendMessage("Hier wird eine Beschreibung stehen");
- p.sendMessage("Um Hilfe zu den Plugins zu bekommen, '/totl hilfe' eingeben");
- } // 0 Argumente Ende
- else { // Mehr als 0 Argumente
- if (args.length == 1) {
- // Hilfe
- if (args[0].equalsIgnoreCase("hilfe")) {
- // ///////////////////////////////
- // Noch die Hilfe-Page eintragen//
- // ///////////////////////////////
- p.sendMessage(ChatColor.GOLD + "-----"
- + ChatColor.GREEN + "Trouble on TheLard-Hilfe"
- + ChatColor.GOLD + "-----");
- p.sendMessage("Hier wird eine Hilfepage kommen");
- } else if (args[0].equalsIgnoreCase("admin")) {
- if (!p.hasPermission("totl.admin")) {
- p.sendMessage(ChatColor.RED
- + "Du hast nicht die Erlaubnis, einen Admin-Befehl auszuführen");
- return true;
- } else {
- p.sendMessage(ChatColor.GOLD + "-----"
- + ChatColor.GREEN
- + "Trouble on TheLard - Admin-Hilfe"
- + ChatColor.GOLD + "-----");
- p.sendMessage(ChatColor.GOLD
- + "/admin setjoinpoint"
- + ChatColor.WHITE
- + " Gebe diesen Befehl ein, um die Punkte, auf denen die Spieler joinen sollen, wenn sie das spiel betreten, zu setzen.");
- }
- } else if (args[0].equalsIgnoreCase("join")) {
- p.getInventory().clear();
- p.setGameMode(GameMode.ADVENTURE);
- // ///////////////
- // spiel betrten//
- // ///////////////
- players.put(1, p);
- p.sendMessage(ChatColor.AQUA + "[TOTL] "
- + ChatColor.GREEN + "Willkommen bei "
- + ChatColor.AQUA + "Traouble on TheLard");
- if (!(players.containsValue(p))) {
- System.out.println("Keine Nummer gefunden!");
- return true;
- }
- System.out.println(p.getName() + " hat die Nummer "
- + players.get(p));
- }
- } else if (args[0].equalsIgnoreCase("start")) {
- p.sendMessage("Start");
- }
- }
- }// Ende 1 Argument
- else {
- // Anfang zwei Argumente
- if (args.length == 2) {
- //
- if (args[0].equalsIgnoreCase("admin")) {
- // Alle Admin Argumente
- if (args[1].equalsIgnoreCase("setpoint")) {
- if (!p.hasPermission("totl.admin.setpoint")) {
- p.sendMessage(ChatColor.AQUA
- + "[TOTL]"
- + ChatColor.RED
- + "Du hast nicht die Erlaubnis, einen Admin-Befehl auszuführen");
- return true;
- } else {
- p.sendMessage(ChatColor.AQUA + "[TOTL]"
- + ChatColor.RED
- + "Bitte etwas nach diesem Befehl angeben");
- p.sendMessage(ChatColor.AQUA
- + "[TOTL]"
- + ChatColor.YELLOW
- + "Du musst '/totl admin setjoinpoint <Name>' eingeben");
- return true;
- }
- }
- }
- } // Ende 2 Argumente
- else {
- // Anfang 3 Arugmente
- if (args.length == 3) {
- if (args[0].equalsIgnoreCase("admin")) {
- // /////////////////////
- // Subcommand setpoint//
- // /////////////////////
- if (args[1].equalsIgnoreCase("setpoint")) {
- if (p.hasPermission("totl.admin.setpoint")) {
- Location loc = p.getLocation();
- String str = "points." + args[2] + ".";
- this.pointfileConfiguration.set("points."
- + args[2] + ".world", loc.getWorld()
- .getName());
- this.pointfileConfiguration.set(str + "x",
- loc.getX());
- this.pointfileConfiguration.set(str + "y",
- loc.getY());
- this.pointfileConfiguration.set(str + "z",
- loc.getZ());
- this.pointfileConfiguration.set(str + "yaw",
- loc.getYaw());
- this.pointfileConfiguration.set(str + "pitch",
- loc.getPitch());
- try {
- this.pointfileConfiguration
- .save(this.pointsfile);
- p.sendMessage(ChatColor.AQUA + "[TOTL] "
- + ChatColor.GREEN + "Punkt "
- + args[2] + " erfolgreich gesetzt.");
- p.sendMessage(ChatColor.AQUA
- + "[TOTL] "
- + ChatColor.RED
- + "ACHTUNG!!! Bei nächster eingabe des Befehls(/totl admin setpoint "
- + args[2]
- + ") , wird dieser Punkt überschrieben.");
- return true;
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- return true;
- } else {
- p.sendMessage(ChatColor.AQUA
- + "[TOTL] "
- + ChatColor.RED
- + "Du hast nicht die Eralubnis, einen Administratoren-Befehl auszuführen.");
- }
- }
- else {
- p.sendMessage(ChatColor.AQUA + "[TOTL]" + ChatColor.RED
- + "Den Befehl '/totl " + args[0] + args[1]
- + args[2] + "' gibt es nicht.");
- }
- } // Ende 3 Argumente
- } // '/totl' Ende
- // Variablen ende
- return true;
- // Variablen Ende
- }
- }// Plugin Ende
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement