diff --git a/builds/murAPI.jar b/builds/murAPI.jar index 8bb1c22..42f5354 100644 Binary files a/builds/murAPI.jar and b/builds/murAPI.jar differ diff --git a/pom.xml b/pom.xml index 5348a97..1dc5fac 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,16 @@ - + + 4.0.0 diff --git a/src/main/java/me/jdog/murapi/MurAPI.java b/src/main/java/me/jdog/murapi/MurAPI.java index 82e04c1..b522577 100644 --- a/src/main/java/me/jdog/murapi/MurAPI.java +++ b/src/main/java/me/jdog/murapi/MurAPI.java @@ -1,9 +1,19 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi; import com.connorlinfoot.bountifulapi.Actionbar; -import me.jdog.murapi.api.config.Config; import me.jdog.murapi.api.cmd.CMDManager; import me.jdog.murapi.api.cmd.Mur; +import me.jdog.murapi.api.config.Config; import me.jdog.murapi.api.gui.GuiManager; import me.jdog.murapi.api.logger.LogType; import me.jdog.murapi.api.logger.Logger; @@ -16,26 +26,25 @@ * Created by Muricans on 11/19/16. */ public class MurAPI extends JavaPlugin { + public static String sv_version = Bukkit.getServer().getVersion(); /** * An instance of the class MurAPI. */ private static MurAPI instance; + public Config config = new Config(this, "config.yml"); + private Logger logger = Logger.getInstance(); + public static MurAPI getInstance() { return instance; } - public static String sv_version = Bukkit.getServer().getVersion(); - private Logger logger = Logger.getInstance(); - public Config config = new Config(this, "config.yml"); - - @Override public void onEnable() { instance = this; config.create(); config.addDefault("debug", true); - if(config.getBoolean("debug")) { + if (config.getBoolean("debug")) { getLogger().log(Level.CONFIG, "Debug mode: TRUE"); } else if (!config.getBoolean("debug")) { getLogger().log(Level.CONFIG, "Debug mode: FALSE"); diff --git a/src/main/java/me/jdog/murapi/api/Color.java b/src/main/java/me/jdog/murapi/api/Color.java index 15ff61a..65f0954 100644 --- a/src/main/java/me/jdog/murapi/api/Color.java +++ b/src/main/java/me/jdog/murapi/api/Color.java @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api; import org.bukkit.ChatColor; @@ -8,7 +18,6 @@ */ public class Color { /** - * * @param text The text to add color. * @return Returns the text with color. */ @@ -17,8 +26,7 @@ public static String addColor(String text) { } /** - * - * @param text The line of the config to add color. + * @param text The line of the config to add color. * @param plugin The plugins main class. * @return The line from config with color. */ diff --git a/src/main/java/me/jdog/murapi/api/Packet.java b/src/main/java/me/jdog/murapi/api/Packet.java index 3f81ecc..972898f 100644 --- a/src/main/java/me/jdog/murapi/api/Packet.java +++ b/src/main/java/me/jdog/murapi/api/Packet.java @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api; import org.bukkit.Bukkit; @@ -9,7 +19,6 @@ public class Packet { /** - * * @param player The player to send the packet to. * @param packet The packet to send. */ @@ -24,7 +33,6 @@ public static void sendPacket(Player player, Object packet) { } /** - * * @param name Class name. * @return The class. */ diff --git a/src/main/java/me/jdog/murapi/api/Title.java b/src/main/java/me/jdog/murapi/api/Title.java index adf0577..eeac5b1 100644 --- a/src/main/java/me/jdog/murapi/api/Title.java +++ b/src/main/java/me/jdog/murapi/api/Title.java @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api; import org.bukkit.entity.Player; @@ -10,12 +20,11 @@ public class Title { /** - * * @param player The player to send the title to. - * @param text The text of the title. - * @param fadeI Fade in. - * @param time The time it should stay. - * @param fadeO Fade out. + * @param text The text of the title. + * @param fadeI Fade in. + * @param time The time it should stay. + * @param fadeO Fade out. */ public static void sendTitle(Player player, String text, int fadeI, int time, int fadeO) { try { @@ -30,12 +39,11 @@ public static void sendTitle(Player player, String text, int fadeI, int time, in } /** - * * @param player The player to send the subtitle to. - * @param text The text of the subtitle. - * @param fadeI Fade in. - * @param time The time it should stay. - * @param fadeO Fade out. + * @param text The text of the subtitle. + * @param fadeI Fade in. + * @param time The time it should stay. + * @param fadeO Fade out. */ public static void sendSubtitle(Player player, String text, int fadeI, int time, int fadeO) { try { @@ -50,21 +58,20 @@ public static void sendSubtitle(Player player, String text, int fadeI, int time, } /** - * - * @param player The player to send the title and subtitle to. - * @param titleText The text of the title. + * @param player The player to send the title and subtitle to. + * @param titleText The text of the title. * @param subtitleText The text of the subtitle. - * @param fadeI Fade in. - * @param time The time it should stay. - * @param fadeO Fade out. + * @param fadeI Fade in. + * @param time The time it should stay. + * @param fadeO Fade out. */ public static void sendTitle(Player player, String titleText, String subtitleText, int fadeI, int time, int fadeO) { - if(titleText != null && subtitleText != null) { + if (titleText != null && subtitleText != null) { sendTitle(player, titleText, fadeI, time, fadeO); sendSubtitle(player, subtitleText, fadeI, time, fadeO); - } else if(titleText == null && subtitleText != null) { + } else if (titleText == null && subtitleText != null) { sendSubtitle(player, subtitleText, fadeI, time, fadeO); - } else if(titleText != null && subtitleText == null) { + } else if (titleText != null && subtitleText == null) { sendTitle(player, titleText, fadeI, time, fadeO); } } diff --git a/src/main/java/me/jdog/murapi/api/Utilities.java b/src/main/java/me/jdog/murapi/api/Utilities.java index f2151bf..f3ff0b9 100644 --- a/src/main/java/me/jdog/murapi/api/Utilities.java +++ b/src/main/java/me/jdog/murapi/api/Utilities.java @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api; import org.bukkit.Bukkit; @@ -8,14 +18,15 @@ */ public class Utilities { private static Utilities instance = new Utilities(); + private Utilities() { } + public static Utilities getInstance() { return instance; } /** - * * @param plugin The plugins main class. * @return The plugins version. */ @@ -24,7 +35,6 @@ public String getVersion(Plugin plugin) { } /** - * * @return The server version. */ public String getServerVersion() { @@ -32,7 +42,6 @@ public String getServerVersion() { } /** - * * @return The bukkit version of the server. */ public String getBukkitVersion() { diff --git a/src/main/java/me/jdog/murapi/api/cmd/CMD.java b/src/main/java/me/jdog/murapi/api/cmd/CMD.java index ca303f8..21bb2d9 100644 --- a/src/main/java/me/jdog/murapi/api/cmd/CMD.java +++ b/src/main/java/me/jdog/murapi/api/cmd/CMD.java @@ -1,6 +1,15 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.cmd; -import me.jdog.murapi.api.Utilities; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -11,15 +20,13 @@ public abstract class CMD { private String name; /** - * * @param name The commands name. */ public CMD(String name) { - this.name = name; + this.name = name; } /** - * * @return Return the name of the command. */ public String getName() { @@ -27,7 +34,6 @@ public String getName() { } /** - * * @param name The commands name. */ public void setName(String name) { @@ -35,11 +41,10 @@ public void setName(String name) { } /** - * - * @param sender The sender of the command. + * @param sender The sender of the command. * @param command The command itself. - * @param label The commands label. - * @param args The commands args. + * @param label The commands label. + * @param args The commands args. * @return True or false */ public abstract boolean execute(CommandSender sender, Command command, String label, String[] args); diff --git a/src/main/java/me/jdog/murapi/api/cmd/CMDManager.java b/src/main/java/me/jdog/murapi/api/cmd/CMDManager.java index fd19616..68f1a5f 100644 --- a/src/main/java/me/jdog/murapi/api/cmd/CMDManager.java +++ b/src/main/java/me/jdog/murapi/api/cmd/CMDManager.java @@ -1,6 +1,15 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.cmd; -import me.jdog.murapi.MurAPI; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -20,7 +29,6 @@ public CMDManager() { /** - * * @param id The ID of the command. * @return Return the command that holds the specified ID */ @@ -30,8 +38,7 @@ public static CMD getCMD(int id) { /** - * - * @param id ID to get that command. + * @param id ID to get that command. * @param cmd The command. */ public static void registerCommand(int id, CMD cmd) { @@ -40,8 +47,8 @@ public static void registerCommand(int id, CMD cmd) { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - for(CMD c : cmdBaseMap.values()) { - if(command.getName().equalsIgnoreCase(c.getName())) { + for (CMD c : cmdBaseMap.values()) { + if (command.getName().equalsIgnoreCase(c.getName())) { c.execute(sender, command, label, args); return true; } diff --git a/src/main/java/me/jdog/murapi/api/cmd/Mur.java b/src/main/java/me/jdog/murapi/api/cmd/Mur.java index f8d6b3c..fe4d3d9 100644 --- a/src/main/java/me/jdog/murapi/api/cmd/Mur.java +++ b/src/main/java/me/jdog/murapi/api/cmd/Mur.java @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.cmd; import me.jdog.murapi.MurAPI; @@ -17,12 +27,12 @@ public Mur() { @Override public boolean execute(CommandSender sender, Command command, String label, String[] args) { - if(args.length == 0 || args.length == 1) { + if (args.length == 0 || args.length == 1) { sender.sendMessage(Color.addColor("&c[mur] &amurAPI version: " + Utilities.getInstance().getVersion(MurAPI.getInstance()) + " &dBukkit/Spigot version: " + MurAPI.sv_version)); return true; } - if(args[0].equalsIgnoreCase("debug")) { - if(args[1].equalsIgnoreCase("true")) { + if (args[0].equalsIgnoreCase("debug")) { + if (args[1].equalsIgnoreCase("true")) { MurAPI.getInstance().config.set("debug", true); sender.sendMessage(Color.addColor("&cDebug mode: &7TRUE &fYou will now receive debug alerts from murAPI")); return true; @@ -31,7 +41,7 @@ public boolean execute(CommandSender sender, Command command, String label, Stri sender.sendMessage(Color.addColor("&cDebug mode: &7FALSE &fYou will no longer receive debug alerts from murAPI")); return true; } else if (args[1].equalsIgnoreCase("status")) { - if(MurAPI.getInstance().config.getBoolean("debug")) { + if (MurAPI.getInstance().config.getBoolean("debug")) { sender.sendMessage(Color.addColor("&cDebug status: &7TRUE &fYou will get console alerts from murAPI")); } else if (!MurAPI.getInstance().config.getBoolean("debug")) { sender.sendMessage(Color.addColor("&cDebug status: &7FALSE &fYou will not get console alerts from murAPI")); diff --git a/src/main/java/me/jdog/murapi/api/config/Config.java b/src/main/java/me/jdog/murapi/api/config/Config.java index 0745e9a..6ae61c0 100644 --- a/src/main/java/me/jdog/murapi/api/config/Config.java +++ b/src/main/java/me/jdog/murapi/api/config/Config.java @@ -1,6 +1,15 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.config; -import me.jdog.murapi.MurAPI; import org.bukkit.configuration.Configuration; import org.bukkit.configuration.ConfigurationOptions; import org.bukkit.configuration.file.FileConfiguration; @@ -19,17 +28,16 @@ public class Config { private Plugin p; private String name; + private Map files = new HashMap<>(); public Config(Plugin p, String name) { this.p = p; this.name = name; } - private Map files = new HashMap<>(); - public FileConfiguration get() { File file = new File(p.getDataFolder(), name); - if(!file.exists()) { + if (!file.exists()) { create(); } FileConfiguration fileConfig = YamlConfiguration.loadConfiguration(file); @@ -40,7 +48,7 @@ public FileConfiguration get() { public void create() { File file = new File(p.getDataFolder(), name); - if(!file.exists()) { + if (!file.exists()) { try { p.getDataFolder().mkdir(); file.createNewFile(); diff --git a/src/main/java/me/jdog/murapi/api/gui/GuiBase.java b/src/main/java/me/jdog/murapi/api/gui/GuiBase.java index 8f10578..cb103ad 100644 --- a/src/main/java/me/jdog/murapi/api/gui/GuiBase.java +++ b/src/main/java/me/jdog/murapi/api/gui/GuiBase.java @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.gui; import org.bukkit.Bukkit; @@ -15,7 +25,6 @@ public abstract class GuiBase { public Inventory inventory; /** - * * @param name The name of the inventory. * @param size The size of the inventory. */ @@ -27,9 +36,8 @@ public GuiBase(String name, int size) { public abstract void registerItems(); /** - * * @param itemStack The item in the gui. - * @param player The player who's clicking. + * @param player The player who's clicking. */ public abstract void click(ItemStack itemStack, Player player); diff --git a/src/main/java/me/jdog/murapi/api/gui/GuiManager.java b/src/main/java/me/jdog/murapi/api/gui/GuiManager.java index e9cb2df..afa6976 100644 --- a/src/main/java/me/jdog/murapi/api/gui/GuiManager.java +++ b/src/main/java/me/jdog/murapi/api/gui/GuiManager.java @@ -1,6 +1,15 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.gui; -import me.jdog.murapi.MurAPI; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -20,7 +29,6 @@ public GuiManager() { } /** - * * @param id The ID of the GUI. * @return The GUI that has the ID specified. */ @@ -29,8 +37,7 @@ public static GuiBase getGui(int id) { } /** - * - * @param id The ID of the GUI. + * @param id The ID of the GUI. * @param guiBase The GUI. */ public static void registerGui(int id, GuiBase guiBase) { @@ -39,10 +46,10 @@ public static void registerGui(int id, GuiBase guiBase) { @EventHandler public void onClick(InventoryClickEvent e) { - if(e.getWhoClicked() instanceof Player) { - if(e.getInventory().getName() != null) { + if (e.getWhoClicked() instanceof Player) { + if (e.getInventory().getName() != null) { for (GuiBase g : guiBaseMap.values()) { - if(e.getInventory().getName().equals(g.inventory.getName())) { + if (e.getInventory().getName().equals(g.inventory.getName())) { e.setCancelled(true); g.click(e.getCurrentItem(), (Player) e.getWhoClicked()); } diff --git a/src/main/java/me/jdog/murapi/api/logger/LogType.java b/src/main/java/me/jdog/murapi/api/logger/LogType.java index 74af851..7a9e691 100644 --- a/src/main/java/me/jdog/murapi/api/logger/LogType.java +++ b/src/main/java/me/jdog/murapi/api/logger/LogType.java @@ -1,8 +1,18 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.logger; /** * Created by Muricans on 11/20/16. */ public enum LogType { - INFO,WARN,SEVERE,ERROR + INFO, WARN, SEVERE, ERROR } diff --git a/src/main/java/me/jdog/murapi/api/logger/Logger.java b/src/main/java/me/jdog/murapi/api/logger/Logger.java index acd3f8a..7c4786c 100644 --- a/src/main/java/me/jdog/murapi/api/logger/Logger.java +++ b/src/main/java/me/jdog/murapi/api/logger/Logger.java @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.logger; import java.text.SimpleDateFormat; @@ -8,8 +18,10 @@ */ public class Logger { private static Logger instance = new Logger(); + private Logger() { } + public static Logger getInstance() { return instance; } @@ -39,20 +51,19 @@ private static void warn(String text) { } /** - * * @param logType Level of log type. - * @param text The text to log. + * @param text The text to log. */ public static void log(LogType logType, String text) { - if(logType == LogType.INFO) + if (logType == LogType.INFO) info(text); - if(logType == LogType.SEVERE) + if (logType == LogType.SEVERE) severe(text); - if(logType == LogType.ERROR) + if (logType == LogType.ERROR) error(text); - if(logType == LogType.WARN) + if (logType == LogType.WARN) warn(text); - if(logType == null) { + if (logType == null) { warn("Cannot be null!"); } } diff --git a/src/main/java/me/jdog/murapi/api/network/ServerUtils.java b/src/main/java/me/jdog/murapi/api/network/ServerUtils.java index 8c08904..6c8ff65 100644 --- a/src/main/java/me/jdog/murapi/api/network/ServerUtils.java +++ b/src/main/java/me/jdog/murapi/api/network/ServerUtils.java @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package me.jdog.murapi.api.network; import me.jdog.murapi.api.logger.LogType; @@ -18,17 +28,17 @@ */ public class ServerUtils { private static ServerUtils instance = new ServerUtils(); + private String server = Bukkit.getServer().getIp(); + private int port = Bukkit.getServer().getPort(); + private ServerUtils() { } + public static ServerUtils getInstance() { return instance; } - private String server = Bukkit.getServer().getIp(); - private int port = Bukkit.getServer().getPort(); - /** - * * @param type The connection you want to get. * @return Connection type. */ @@ -48,24 +58,24 @@ public String getDataType(ConnectionType type) { dataOutputStream.write(new byte[]{(byte) (0xFE), (byte) 0x01}); int packetID = inputStream.read(); int length = inputStreamReader.read(); - if(packetID == -1) + if (packetID == -1) Logger.getInstance().log(LogType.SEVERE, "End of stream"); if (packetID != 0xFF) Logger.getInstance().log(LogType.SEVERE, "Invalid ID!" + packetID); - if(length == -1) + if (length == -1) Logger.getInstance().log(LogType.SEVERE, "End of stream"); - if(length == 0) + if (length == 0) Logger.getInstance().log(LogType.SEVERE, "Invalid length"); char[] chars = new char[length]; - if(inputStreamReader.read(chars, 0, length) != length) + if (inputStreamReader.read(chars, 0, length) != length) Logger.getInstance().log(LogType.SEVERE, "End of stream"); String string = new String(chars); String[] data = string.split("\0"); - if(type == ConnectionType.SV_ONLINE) + if (type == ConnectionType.SV_ONLINE) return Integer.parseInt(data[4]) + "/" + Integer.parseInt(data[5]); - if(type == ConnectionType.SV_MOTD) + if (type == ConnectionType.SV_MOTD) return data[3]; - if(type == ConnectionType.SV_VERSION) + if (type == ConnectionType.SV_VERSION) return data[2]; } catch (Exception e) { return null; diff --git a/src/main/java/me/jdog/murapi/api/network/type/ConnectionType.java b/src/main/java/me/jdog/murapi/api/network/type/ConnectionType.java index e04b068..4ccc0d9 100644 --- a/src/main/java/me/jdog/murapi/api/network/type/ConnectionType.java +++ b/src/main/java/me/jdog/murapi/api/network/type/ConnectionType.java @@ -1,6 +1,14 @@ -package me.jdog.murapi.api.network.type; +/* + * Copyright (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ -import me.jdog.murapi.api.network.ServerUtils; +package me.jdog.murapi.api.network.type; /** * Created by Muricans on 11/23/16. diff --git a/target/classes/com/connorlinfoot/bountifulapi/Actionbar.class b/target/classes/com/connorlinfoot/bountifulapi/Actionbar.class index 7c7b10b..3dd32da 100644 Binary files a/target/classes/com/connorlinfoot/bountifulapi/Actionbar.class and b/target/classes/com/connorlinfoot/bountifulapi/Actionbar.class differ diff --git a/target/classes/me/jdog/murapi/MurAPI.class b/target/classes/me/jdog/murapi/MurAPI.class index c35db86..e421bce 100644 Binary files a/target/classes/me/jdog/murapi/MurAPI.class and b/target/classes/me/jdog/murapi/MurAPI.class differ diff --git a/target/classes/me/jdog/murapi/api/Color.class b/target/classes/me/jdog/murapi/api/Color.class index 8f6c4f7..53ff577 100644 Binary files a/target/classes/me/jdog/murapi/api/Color.class and b/target/classes/me/jdog/murapi/api/Color.class differ diff --git a/target/classes/me/jdog/murapi/api/Packet.class b/target/classes/me/jdog/murapi/api/Packet.class index bca0b99..9426162 100644 Binary files a/target/classes/me/jdog/murapi/api/Packet.class and b/target/classes/me/jdog/murapi/api/Packet.class differ diff --git a/target/classes/me/jdog/murapi/api/Title.class b/target/classes/me/jdog/murapi/api/Title.class index b8911e5..cfe614a 100644 Binary files a/target/classes/me/jdog/murapi/api/Title.class and b/target/classes/me/jdog/murapi/api/Title.class differ diff --git a/target/classes/me/jdog/murapi/api/Utilities.class b/target/classes/me/jdog/murapi/api/Utilities.class index 0b929ff..b1e4157 100644 Binary files a/target/classes/me/jdog/murapi/api/Utilities.class and b/target/classes/me/jdog/murapi/api/Utilities.class differ diff --git a/target/classes/me/jdog/murapi/api/cmd/CMD.class b/target/classes/me/jdog/murapi/api/cmd/CMD.class index 38f21ea..fd852d1 100644 Binary files a/target/classes/me/jdog/murapi/api/cmd/CMD.class and b/target/classes/me/jdog/murapi/api/cmd/CMD.class differ diff --git a/target/classes/me/jdog/murapi/api/cmd/CMDManager.class b/target/classes/me/jdog/murapi/api/cmd/CMDManager.class index 4017e08..4635372 100644 Binary files a/target/classes/me/jdog/murapi/api/cmd/CMDManager.class and b/target/classes/me/jdog/murapi/api/cmd/CMDManager.class differ diff --git a/target/classes/me/jdog/murapi/api/cmd/Mur.class b/target/classes/me/jdog/murapi/api/cmd/Mur.class index 4d89cd9..19645c6 100644 Binary files a/target/classes/me/jdog/murapi/api/cmd/Mur.class and b/target/classes/me/jdog/murapi/api/cmd/Mur.class differ diff --git a/target/classes/me/jdog/murapi/api/config/Config.class b/target/classes/me/jdog/murapi/api/config/Config.class index b2eb26e..6d4eba5 100644 Binary files a/target/classes/me/jdog/murapi/api/config/Config.class and b/target/classes/me/jdog/murapi/api/config/Config.class differ diff --git a/target/classes/me/jdog/murapi/api/gui/GuiBase.class b/target/classes/me/jdog/murapi/api/gui/GuiBase.class index d5397ff..9fa8381 100644 Binary files a/target/classes/me/jdog/murapi/api/gui/GuiBase.class and b/target/classes/me/jdog/murapi/api/gui/GuiBase.class differ diff --git a/target/classes/me/jdog/murapi/api/gui/GuiManager.class b/target/classes/me/jdog/murapi/api/gui/GuiManager.class index 21e6301..e45b7bc 100644 Binary files a/target/classes/me/jdog/murapi/api/gui/GuiManager.class and b/target/classes/me/jdog/murapi/api/gui/GuiManager.class differ diff --git a/target/classes/me/jdog/murapi/api/logger/LogType.class b/target/classes/me/jdog/murapi/api/logger/LogType.class index 8657999..0d03368 100644 Binary files a/target/classes/me/jdog/murapi/api/logger/LogType.class and b/target/classes/me/jdog/murapi/api/logger/LogType.class differ diff --git a/target/classes/me/jdog/murapi/api/logger/Logger.class b/target/classes/me/jdog/murapi/api/logger/Logger.class index d783c08..4048a5a 100644 Binary files a/target/classes/me/jdog/murapi/api/logger/Logger.class and b/target/classes/me/jdog/murapi/api/logger/Logger.class differ diff --git a/target/classes/me/jdog/murapi/api/network/ServerUtils.class b/target/classes/me/jdog/murapi/api/network/ServerUtils.class index 88b0479..4c75aff 100644 Binary files a/target/classes/me/jdog/murapi/api/network/ServerUtils.class and b/target/classes/me/jdog/murapi/api/network/ServerUtils.class differ diff --git a/target/classes/me/jdog/murapi/api/network/type/ConnectionType.class b/target/classes/me/jdog/murapi/api/network/type/ConnectionType.class index 88105bd..cd41ae8 100644 Binary files a/target/classes/me/jdog/murapi/api/network/type/ConnectionType.class and b/target/classes/me/jdog/murapi/api/network/type/ConnectionType.class differ