mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-22 16:05:00 +00:00
fix guild tags
- fix guild tags not showing - limit guild names to 24 characters - allow guild tag spacing instead of guild name spacing
This commit is contained in:
parent
dd045c06e3
commit
6e174a3f06
6 changed files with 59 additions and 19 deletions
32
TFGuilds.iml
Normal file
32
TFGuilds.iml
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TotalFreedomMod:5.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: me.rayzr522:jsonmessage:1.0.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
|
||||
</component>
|
||||
</module>
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>me.totalfreedom</groupId>
|
||||
<artifactId>TFGuilds</artifactId>
|
||||
<version>0.1.6</version>
|
||||
<version>0.1.7</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>TFGuilds</name>
|
||||
|
|
|
@ -48,6 +48,12 @@ public class CreateGuildCommand extends GBase implements CommandExecutor
|
|||
player.sendMessage(ChatColor.RED + "A guild with that name already exists.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].length() > 24)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Guild name must not be over 24 characters.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -3,6 +3,7 @@ package me.totalfreedom.tfguilds.command;
|
|||
import me.totalfreedom.tfguilds.util.GBase;
|
||||
import me.totalfreedom.tfguilds.util.GMessage;
|
||||
import me.totalfreedom.tfguilds.util.GUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
@ -14,11 +15,6 @@ public class GuildTagCommand extends GBase implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length == 0 || args.length > 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GUtil.isConsole(sender))
|
||||
{
|
||||
sender.sendMessage(GMessage.PLAYER_ONLY);
|
||||
|
@ -41,29 +37,32 @@ public class GuildTagCommand extends GBase implements CommandExecutor
|
|||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
if (args.length >= 2)
|
||||
{
|
||||
String tag = StringUtils.join(args, " ", 1, args.length);
|
||||
if (args[0].equalsIgnoreCase("set"))
|
||||
{
|
||||
if (!args[1].toLowerCase().contains(guild))
|
||||
if (!tag.contains(guild))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Your guild tag must contain your guild name.");
|
||||
return true;
|
||||
}
|
||||
|
||||
GUtil.setTag(GUtil.color(args[1]) + " ", guild);
|
||||
player.sendMessage(ChatColor.GREEN + "Guild tag set to \"" + GUtil.color(args[1]) + ChatColor.GREEN + "\"");
|
||||
GUtil.setTag(GUtil.color(tag) + " ", guild);
|
||||
player.sendMessage(ChatColor.GREEN + "Guild tag set to \"" + GUtil.color(tag) + ChatColor.GREEN + "\"");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!args[0].equalsIgnoreCase("clear"))
|
||||
if (args.length == 1)
|
||||
{
|
||||
return false;
|
||||
if (args[0].equalsIgnoreCase("clear"))
|
||||
{
|
||||
GUtil.setTag(GUtil.color("&8[&7" + guild + "&8]&r "), guild);
|
||||
player.sendMessage(ChatColor.GRAY + "Removed your guild's tag.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
GUtil.setTag(GUtil.color("&8[&7" + guild + "&8]&r "), guild);
|
||||
player.sendMessage(ChatColor.GRAY + "Removed your guild's tag.");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ public class TfGuildsCommand extends GBase implements CommandExecutor
|
|||
sender.sendMessage(GUtil.color("&2Developed by &aspeednt"));
|
||||
sender.sendMessage(GUtil.color("&2Contributors"));
|
||||
sender.sendMessage(GUtil.color("&a- supernt"));
|
||||
sender.sendMessage(GUtil.color("&2https://github.com/speedxx/TFGuilds"));
|
||||
sender.sendMessage(GUtil.color("&2https://github.com/TFPatches/TFGuilds"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import me.totalfreedom.tfguilds.util.GUtil;
|
|||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
|
@ -16,13 +17,15 @@ public class ChatManager implements Listener
|
|||
this.plugin = TFGuilds.plugin;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerChat(AsyncPlayerChatEvent e)
|
||||
{
|
||||
Player player = e.getPlayer();
|
||||
String guild = GUtil.getGuild(player);
|
||||
if (guild == null)
|
||||
{
|
||||
return;
|
||||
e.setFormat(GUtil.color(GUtil.getTag(guild)) + " " + ChatColor.RESET + e.getFormat());
|
||||
}
|
||||
e.setFormat(GUtil.color(GUtil.getTag(guild)) + ChatColor.RESET + e.getFormat());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue