Fixed things and added files...
This commit is contained in:
parent
c96a83af07
commit
76655a2c91
14 changed files with 382 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
|||
name: TheButtonMCPlugin
|
||||
main: io.github.norbipeti.thebuttonmc.PluginMain
|
||||
name: TheButtonMCChatPlugin
|
||||
main: io.github.norbipeti.thebuttonmcchat.PluginMain
|
||||
version: 4.0
|
||||
commands:
|
||||
u:
|
||||
|
@ -11,7 +11,7 @@ commands:
|
|||
alias: nrp
|
||||
unlol:
|
||||
description: Unlaugh the last laugh.
|
||||
alias: unlaugh
|
||||
alias: unlaugh
|
||||
mwiki:
|
||||
description: Search the wiki.
|
||||
usage: "&cUsage: /mwiki [query]&r"
|
||||
|
@ -26,7 +26,7 @@ commands:
|
|||
description: Enable chat only mode. Useful for chat clients.
|
||||
usage: "&cUsage: /chatonly&r"
|
||||
author: NorbiPeti
|
||||
depend: [Essentials, Towny, Minigames, Votifier, Factions, WorldGuard, WorldEdit, ProtocolLib, FastLogin, Vault, AuthMe]
|
||||
depend: [Essentials, Towny, Minigames, Votifier, WorldGuard, WorldEdit, ProtocolLib, FastLogin, Vault, AuthMe]
|
||||
permissions:
|
||||
tbmc.admin:
|
||||
description: Gives access to /un- commands and /u admin commands
|
||||
|
|
|
@ -13,8 +13,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
|
||||
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||
import com.palmergames.bukkit.towny.object.Nation;
|
||||
|
@ -456,13 +454,13 @@ public class ChatProcessing {
|
|||
} else if (currentchannel.equals(Channel.ModChat)) {
|
||||
try {
|
||||
if (player != null
|
||||
&& !PermissionsEx.getUser(player).inGroup("mod")) {
|
||||
&& !PluginMain.permission.playerInGroup(player, "mod")) {
|
||||
player.sendMessage("§cYou need to be a mod to use this channel.");
|
||||
return true;
|
||||
}
|
||||
Objective obj = PluginMain.SB.getObjective("mod");
|
||||
for (Player p : PluginMain.GetPlayers()) {
|
||||
if (PermissionsEx.getUser(p).inGroup("mod"))
|
||||
if (PluginMain.permission.playerInGroup(p, "mod"))
|
||||
obj.getScore(p.getName()).setScore(1);
|
||||
else
|
||||
obj.getScore(p.getName()).setScore(0);
|
||||
|
|
|
@ -47,8 +47,6 @@ import au.com.mineauz.minigames.Minigames;
|
|||
import com.earth2me.essentials.Essentials;
|
||||
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
||||
import com.github.games647.fastlogin.bukkit.PlayerProfile;
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||
import com.palmergames.bukkit.towny.object.Resident;
|
||||
import com.palmergames.bukkit.towny.object.Town;
|
||||
|
@ -358,7 +356,7 @@ public class PlayerListener implements Listener {
|
|||
.getPlayer().getDisplayName(), message));
|
||||
}
|
||||
}
|
||||
boolean tping = false;
|
||||
/*boolean tping = false;
|
||||
boolean tphering = false;
|
||||
if (cmd.equalsIgnoreCase("tpa") || cmd.equalsIgnoreCase("call")
|
||||
|| cmd.equalsIgnoreCase("ecall")
|
||||
|
@ -368,7 +366,7 @@ public class PlayerListener implements Listener {
|
|||
tping = true;
|
||||
if (cmd.equalsIgnoreCase("tpahere")
|
||||
|| cmd.equalsIgnoreCase("etpahere"))
|
||||
tphering = true;
|
||||
tphering = true;*/
|
||||
|
||||
/*
|
||||
* for (HelpTopic ht : PluginMain.Instance.getServer()
|
||||
|
@ -384,7 +382,7 @@ public class PlayerListener implements Listener {
|
|||
* break; }
|
||||
*/
|
||||
|
||||
if (tphering) {
|
||||
/*if (tphering) {
|
||||
Player target = Bukkit.getPlayer(event.getMessage()
|
||||
.substring(index + 1).split(" ")[0]);
|
||||
if (target != null
|
||||
|
@ -396,12 +394,12 @@ public class PlayerListener implements Listener {
|
|||
"§cYou are not allowed to teleport players out from the Tower");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
* for (String s : Bukkit.getCommandAliases().get("/tpahere")) { if
|
||||
* (cmd.equalsIgnoreCase(s)) { tping = true; break; } }
|
||||
*/
|
||||
if (tping) {
|
||||
/*if (tping) {
|
||||
if (
|
||||
// MPlayer.get(event.getPlayer()).getFaction().getId().equalsIgnoreCase("nomansland"))
|
||||
// {
|
||||
|
@ -414,7 +412,7 @@ public class PlayerListener implements Listener {
|
|||
"§cYou are not allowed to teleport to the Tower");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if (cmd.equalsIgnoreCase("sethome")) {
|
||||
TownyUniverse tu = PluginMain.Instance.TU;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class YeehawCommand extends TBMCCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- YEEHAW command ----",
|
||||
"This command makes you YEEHAW." };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
for (Player p : PluginMain.GetPlayers()) {
|
||||
p.playSound(p.getLocation(), "tbmc.yeehaw", 1f, 1f);
|
||||
p.sendMessage("§b* "
|
||||
+ (sender instanceof Player ? ((Player) sender)
|
||||
.getDisplayName() : sender.getName()) + " YEEHAWs.");
|
||||
} //Even a cmdblock could yeehaw in theory
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetCommandName() {
|
||||
return "yeehaw";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean GetPlayerOnly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CCommand extends UCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- Rainbow mode ----",
|
||||
"This command allows you to talk in rainbow colors",
|
||||
"You need to be a donator or a mod to use this command" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnUCommand(CommandSender sender, String alias, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
MaybeOfflinePlayer p = MaybeOfflinePlayer.AddPlayerIfNeeded(player
|
||||
.getUniqueId());
|
||||
if (args.length < 1) {
|
||||
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
|
||||
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
||||
p.OtherColorMode = "";
|
||||
if (p.RainbowPresserColorMode)
|
||||
player.sendMessage("§eRainbow colors §aenabled.");
|
||||
else
|
||||
player.sendMessage("§eRainbow colors §cdisabled.");
|
||||
} else {
|
||||
player.sendMessage("§cYou don't have permission for this command. Donate to get it!");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (PluginMain.permission.has(player, "tbmc.admin")) {
|
||||
p.RainbowPresserColorMode = false;
|
||||
p.OtherColorMode = args[0];
|
||||
if (p.OtherColorMode.length() > 0)
|
||||
player.sendMessage(String.format(
|
||||
"§eMessage color set to %s", p.OtherColorMode));
|
||||
else
|
||||
player.sendMessage("§eMessage color reset.");
|
||||
} else {
|
||||
player.sendMessage("§cYou don't have permission for this command.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetUCommandName() {
|
||||
return "c";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import au.com.mineauz.minigames.MinigamePlayer;
|
||||
import au.com.mineauz.minigames.Minigames;
|
||||
|
||||
import com.earth2me.essentials.Mob;
|
||||
import com.earth2me.essentials.Mob.MobException;
|
||||
|
||||
public class KittycannonCommand extends UCommandBase {
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
public static String KittyCannonMinigame = "KittyCannon";
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- Kittycannon ----",
|
||||
"This command is designed for the Kittycannon minigame" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnUCommand(CommandSender sender, String alias, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(player);
|
||||
if (!(mp.isInMinigame() && mp.getMinigame().getName(false)
|
||||
.equalsIgnoreCase(KittyCannonMinigame))) {
|
||||
sender.sendMessage("§cYou can only use KittyCannon in it's minigame!");
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
final Mob cat = Mob.OCELOT;
|
||||
final Ocelot ocelot = (Ocelot) cat.spawn(player.getWorld(),
|
||||
player.getServer(), player.getEyeLocation());
|
||||
if (ocelot == null) {
|
||||
return true;
|
||||
}
|
||||
final ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(player.getName());
|
||||
final int i = random.nextInt(Ocelot.Type.values().length);
|
||||
ocelot.setCatType(Ocelot.Type.values()[i]);
|
||||
ocelot.setTamed(true);
|
||||
ocelot.setBaby();
|
||||
ocelot.addPotionEffect(new PotionEffect(
|
||||
PotionEffectType.DAMAGE_RESISTANCE, 5, 5));
|
||||
ocelot.setVelocity(player.getEyeLocation().getDirection()
|
||||
.multiply(2));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(PluginMain.Instance,
|
||||
new Runnable() {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void run() {
|
||||
final Location loc = ocelot.getLocation();
|
||||
ocelot.remove();
|
||||
loc.getWorld().createExplosion(loc, 0F);
|
||||
final ItemStack head = new ItemStack(
|
||||
Material.SKULL_ITEM, 1, (short) 3, (byte) 3);
|
||||
SkullMeta im = (SkullMeta) head.getItemMeta();
|
||||
im.setDisplayName("§rOcelot Head");
|
||||
im.setOwner("MHF_Ocelot");
|
||||
im.setLore(lore);
|
||||
head.setItemMeta(im);
|
||||
loc.getWorld().dropItem(loc, head);
|
||||
}
|
||||
}, 20);
|
||||
} catch (MobException e) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetUCommandName() {
|
||||
return "kittycannon";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class NameCommand extends UCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] {
|
||||
"§6---- Get username ----",
|
||||
"This command allows you to see the Reddit username of a player if they have one associated",
|
||||
"Usage: /u name <playername>" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnUCommand(CommandSender sender, String alias, String[] args) {
|
||||
if (args.length == 1) {
|
||||
return false;
|
||||
}
|
||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.GetFromName(args[1]);
|
||||
if (mp == null) {
|
||||
sender.sendMessage("§cUnknown user (player has to be online): "
|
||||
+ args[1]);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage("§bUsername of " + args[1] + ": " + mp.UserName);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetUCommandName() {
|
||||
return "name";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class OpmeCommand extends UCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- OP me ----", "Totally makes you OP" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnUCommand(CommandSender sender, String alias, String[] args) {
|
||||
sender.sendMessage("It would be nice, wouldn't it?");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetUCommandName() {
|
||||
return "opme";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,8 +2,6 @@ package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
|
|||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.commands.TBMCCommandBase;
|
||||
|
||||
public final class UCommand extends UCommandBase {
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +12,7 @@ public final class UCommand extends UCommandBase {
|
|||
|
||||
@Override
|
||||
public boolean OnUCommand(CommandSender sender, String alias, String[] args) {
|
||||
return false;
|
||||
return false; //TODO: Forward call to the correct handler
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,8 @@ public abstract class UCommandBase extends TBMCCommandBase {
|
|||
|
||||
@Override
|
||||
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||
if (args.length == 0)
|
||||
return false;
|
||||
return OnUCommand(sender, alias,
|
||||
Arrays.copyOfRange(args, 1, args.length));
|
||||
}
|
||||
|
@ -24,7 +26,7 @@ public abstract class UCommandBase extends TBMCCommandBase {
|
|||
return "u";
|
||||
}
|
||||
|
||||
public abstract String GetUCommandName(); //TODO: Help for /u commands
|
||||
public abstract String GetUCommandName(); // TODO: Help for /u commands
|
||||
|
||||
@Override
|
||||
public boolean GetPlayerOnly() {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds.announce;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class EditCommand extends AnnounceCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- Edit announcement ----",
|
||||
"This command can only be used in a command block.",
|
||||
"Usage: /u annonunce edit <index> <text>" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnAnnounceCommand(CommandSender sender, String alias,
|
||||
String[] args) {
|
||||
if (!(sender instanceof BlockCommandSender)) {
|
||||
sender.sendMessage("§cError: This command can only be used from a command block. You can use add and remove, though it's not recommended.");
|
||||
return true;
|
||||
}
|
||||
if (args.length < 4) {
|
||||
return false;
|
||||
}
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
for (int i1 = 3; i1 < args.length; i1++) {
|
||||
sb1.append(args[i1]);
|
||||
if (i1 != args.length - 1)
|
||||
sb1.append(" ");
|
||||
}
|
||||
String finalmessage1 = sb1.toString().replace('&', '§');
|
||||
int index = Integer.parseInt(args[2]);
|
||||
if (index > 100)
|
||||
return false;
|
||||
while (PluginMain.AnnounceMessages.size() <= index)
|
||||
PluginMain.AnnounceMessages.add("");
|
||||
PluginMain.AnnounceMessages.set(Integer.parseInt(args[2]),
|
||||
finalmessage1);
|
||||
sender.sendMessage("Announcement edited.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetAnnounceCommandName() {
|
||||
return "edit";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds.announce;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ListCommand extends AnnounceCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- List announcements ----",
|
||||
"This command lists the announcements and the time between them" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnAnnounceCommand(CommandSender sender, String alias,
|
||||
String[] args) {
|
||||
sender.sendMessage("§bList of announce messages:§r");
|
||||
sender.sendMessage("§bFormat: [index] message§r");
|
||||
int i = 0;
|
||||
for (String message : PluginMain.AnnounceMessages)
|
||||
sender.sendMessage("[" + i++ + "] " + message);
|
||||
sender.sendMessage("§bCurrent wait time between announcements: "
|
||||
+ PluginMain.AnnounceTime / 60 / 1000 + " minute(s)§r");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetAnnounceCommandName() {
|
||||
return "list";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package io.github.norbipeti.thebuttonmcchat.commands.ucmds.announce;
|
||||
|
||||
import io.github.norbipeti.thebuttonmcchat.PluginMain;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class SetTimeCommand extends AnnounceCommandBase {
|
||||
|
||||
@Override
|
||||
public String[] GetHelpText(String alias) {
|
||||
return new String[] { "§6---- Set time ----",
|
||||
"This command sets the time between the announcements",
|
||||
"Usage: /u anonunce settime <minutes>", "Default: 15" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnAnnounceCommand(CommandSender sender, String alias,
|
||||
String[] args) {
|
||||
if (args.length < 3) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
PluginMain.AnnounceTime = Integer.parseInt(args[0]) * 60 * 1000;
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage("§cMinutes argument must be a number. Got: "
|
||||
+ args[0]);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage("Time set between announce messages");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetAnnounceCommandName() {
|
||||
return "settime";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue