Compare commits

...
44 Commits
Author SHA1 Message Date
RoinujNosde e07c8a9343 Updating download link 2019-08-26 22:02:05 -03:00
RoinujNosde b84e46d156 Clans can now have a description
It can be changed using the /clan description command
Its max and min length can be set in the config

Closes #537
2019-08-26 21:55:02 -03:00
RoinujNosde daba767a5a Charge upkeep if member fee is enabled
Closes #539
2019-08-26 19:27:25 -03:00
RoinujNosde e59a760776 Upkeep system implemented
Closes #524
2019-08-25 17:14:39 -03:00
RoinujNosde 6aa30a5d2d Closes #535 2019-08-14 19:42:29 -03:00
RoinujNosde 9fe944fe5b Fixing percentage formula + typos 2019-08-13 22:45:44 -03:00
RoinujNosde 178382e685 Purge command, percentage to demote & bb on purge
Command to purge a player was added, it can be used by the console or by an admin
Menu command edited to show the new command and the demote command for admins
When a player is purged, a message is added to the clan bb
The plugin now considers the percentage (set in the config) of online leaders to demote another player
Closes #528
Closes #526
Closes #517
2019-08-13 22:34:18 -03:00
RoinujNosde 2fcc765447 Players now can pay for setting the member fee
Closes #534
2019-08-13 20:30:10 -03:00
RoinujNosde 6d5dc79568 Fee on profile and feedback on wrong value
Fee status is now displayed on /clan profile
A message is sent to the player when he inserts an invalid value
Closes #529
2019-08-13 20:11:48 -03:00
RoinujNosde 29c8955f9d Fixed MySQL syntax error
Closes #525
2019-08-10 19:36:43 -03:00
RoinujNosde 62f69e0a1e Fixed messages not being sent on resign 2019-08-07 20:42:50 -03:00
RoinujNosde 3518024428 Improved resign confirmation
- the input is not case sensitive
- anything other than "yes", means "no"
- calling spigot() to send the hover message on bb to support 1.13
Closes #493
2019-08-07 20:25:17 -03:00
RoinujNosde ad7f6fd402 Member fee system implemented
- If enabled by the server and the clan, a fee set by the clan leader will be collected from non-leaders at 1am everyday; a player that doesn't have enough to pay it, will be kicked
Closes #254
2019-08-06 19:50:38 -03:00
RoinujNosde 732932763d Added messages related to the fee 2019-08-06 19:32:52 -03:00
RoinujNosde 6440e937bc Added login-size config node 2019-08-02 21:38:00 -03:00
RoinujNosde 72ffaaa7fe Fixed hardcoded messages 2019-08-02 21:17:27 -03:00
RoinujNosde 9b69020677 Merge branch 'better-bb' of https://github.com/MLG-Fortress/SimpleClans into MLG-Fortress-better-bb 2019-08-02 21:15:06 -03:00
RoinujNosde 50d25bb881 Merge origin/master 2019-08-01 20:10:53 -03:00
RoinujNosde 5fc0477e9f Admins can demote clan leaders
Permission added: "simpleclans.admin.demote"
3 new messages added as well
Closes #517
2019-08-01 19:58:01 -03:00
RoinujNosde 10482ecf23 Closes #519 2019-08-01 19:30:49 -03:00
Edson Passos 00158a3e3c Download link changed 2019-08-01 19:07:56 -03:00
RoinujNosde 96d65c2d8f Resign command now asks for confirmation
Closes #493
2019-08-01 18:56:20 -03:00
RoinujNosde 4036b13bad Added some missing messages 2019-08-01 18:50:15 -03:00
RoinujNosde 2abe64284b Instead of returning null, getLang will return a useful message 2019-08-01 18:49:10 -03:00
RoinujNosde 1b62ecf296 Verifying you want to leave a clan
Closes #493
2019-07-26 20:06:54 -03:00
RoinujNosde c59afd27b3 Updating version 2019-07-26 19:18:56 -03:00
RoinujNosde fecc50c083 Fixed clan and ally chats using the same format
Also removed unnecessary usage of replaceAll
Closes #516
2019-07-26 19:12:35 -03:00
Edson Passos 230a0e9ba5 Merge pull request #515 from marcelo-mason/patch-3
Fixing ChatEvent + Denying same IP kills
2019-07-21 10:23:08 -03:00
RoinujNosde 9f96f8c19f Merge branch 'ArtNRG-master' into patch-3
Deny calculating kills with the same IP
2019-07-21 10:15:31 -03:00
RoinujNosde 1b16fd3b2b Merge branch 'master' of https://github.com/ArtNRG/SimpleClans into ArtNRG-master
Testing
2019-07-21 10:10:26 -03:00
RoinujNosde 4e5461b533 ChatEvent is now triggered sync
Closes #514
2019-07-21 10:07:42 -03:00
ArtNRG 70f4a4a109 If some player is killed by another one, check both attacker and victim IP addresses.
If they are the same don't calculate that kill and send the message to the server console.
2018-05-04 11:33:15 +05:00
ArtNRG ae3ebee649 Add kill-weights.deny-same-ip-kills:false boolean to config.yml 2018-05-04 11:32:46 +05:00
ArtNRG 235a69cf15 Update SettingsManager to get kill-weights.deny-same-ip-kills boolean from config.yml 2018-05-04 11:31:31 +05:00
RoboMWM 2c18498f08 Have travis use Java 8
Since Minecraft requires Java 8 now anyways.
2018-04-12 15:31:36 -07:00
RoboMWM 2ac4085915 typod parenthesis 2018-03-26 09:06:10 -07:00
RoboMWM 9b5e727fed forgot that formatTime uses seconds, not milliseconds 2018-03-12 13:12:04 -07:00
RoboMWM dcf1659e6b and this one too 2018-03-12 13:04:25 -07:00
RoboMWM d64190cc8f typo 2018-03-12 13:03:19 -07:00
RoboMWM dc1c417222 refactor formatTime to Dates class 2018-03-12 12:47:50 -07:00
RoboMWM 3872790c25 rename config key bb.join-size to bb.login-size
This is to match the other key `show-on-login`
2018-03-12 12:42:05 -07:00
RoboMWM da1894e55d fix substring mistake 2018-03-12 12:38:53 -07:00
RoboMWM 63763e9afd Allow size of bb displayed on join to be configured
bb.join-size, defaults to value in bb.size
2018-03-12 12:25:49 -07:00
RoboMWM 756a30303e timestamp bb messages 2018-03-12 12:13:53 -07:00
36 changed files with 1939 additions and 585 deletions

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ language: java
script: mvn install
jdk: [openjdk7]
jdk: [openjdk8]
# if one build failed, exit testing
matrix:
+15 -15
View File
@@ -1,15 +1,15 @@
SimpleClans
==========
Full featured clan system for PVP Minecraft Servers
[![Build Status](https://travis-ci.org/marcelo-mason/SimpleClans.svg)](https://travis-ci.org/marcelo-mason/SimpleClans)
[![Download](https://img.shields.io/badge/snapshot-download-blue.svg)](http://104.236.246.108:8080/job/SimpleClans/)
[![Issues](https://img.shields.io/github/issues/marcelo-mason/SimpleClans.svg)](https://github.com/marcelo-mason/SimpleClans/issues)
[![ghit.me](https://ghit.me/badge.svg?repo=marcelo-mason/SimpleClans)](https://ghit.me/repo/marcelo-mason/SimpleClans)
## Disclaimer:
Active development for this plugin has stopped. It is in maintenance mode and will continue to be kept up to date as-is with any new Minecraft version indefinitely.
Pull-requests for bug fixes or new features are welcomed and will be merged in if they do not break existing functionalities.
SimpleClans
==========
Full featured clan system for PVP Minecraft Servers
[![Build Status](https://travis-ci.org/marcelo-mason/SimpleClans.svg)](https://travis-ci.org/marcelo-mason/SimpleClans)
[![Download](https://img.shields.io/badge/snapshot-download-blue.svg)](https://github.com/marcelo-mason/SimpleClans/releases)
[![Issues](https://img.shields.io/github/issues/marcelo-mason/SimpleClans.svg)](https://github.com/marcelo-mason/SimpleClans/issues)
[![ghit.me](https://ghit.me/badge.svg?repo=marcelo-mason/SimpleClans)](https://ghit.me/repo/marcelo-mason/SimpleClans)
## Disclaimer:
Active development for this plugin has stopped. It is in maintenance mode and will continue to be kept up to date as-is with any new Minecraft version indefinitely.
Pull-requests for bug fixes or new features are welcomed and will be merged in if they do not break existing functionalities.
+13 -3
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.7.12</version>
<version>2.7.22</version>
<name>SimpleClans</name>
<url>http://dev.bukkit.org/server-mods/simpleclans/</url>
@@ -33,8 +33,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
@@ -58,6 +58,12 @@
</build>
<!-- Dependencies -->
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
@@ -87,6 +93,10 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>paper-repo</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
</repository>
</repositories>
<!-- GitHub/Jenkins -->
@@ -638,6 +638,10 @@ public class ChatBlock {
public static String[] say(String message) {
return colorize(wordWrap(message));
}
public static String[] getColorizedMessage(String msg) {
return colorize(wordWrap(msg));
}
/**
* @param message
@@ -697,4 +701,4 @@ public class ChatBlock {
return message;
}
}
}
@@ -1,5 +1,7 @@
package net.sacredlabyrinth.phaed.simpleclans;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
import net.sacredlabyrinth.phaed.simpleclans.events.*;
import org.bukkit.ChatColor;
@@ -15,6 +17,7 @@ import java.io.Serializable;
import java.sql.Timestamp;
import java.text.MessageFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author phaed
@@ -26,7 +29,9 @@ public class Clan implements Serializable, Comparable<Clan> {
private String tag;
private String colorTag;
private String name;
private String description;
private double balance;
private double fee;
private boolean friendlyFire;
private long founded;
private long lastUsed;
@@ -42,6 +47,7 @@ public class Clan implements Serializable, Comparable<Clan> {
private String homeWorld = "";
private boolean allowWithdraw = false;
private boolean allowDeposit = true;
private boolean feeEnabled;
/**
*
@@ -152,7 +158,46 @@ public class Clan implements Serializable, Comparable<Clan> {
public void setName(String name) {
this.name = name;
}
/**
* Returns the clan's description
*
* @return the description or null if it doesn't have one
*/
public String getDescription() {
return description;
}
/**
* (used internally)
*
* @param description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* Sets the clan's fee
*
* @param fee
*/
public void setMemberFee(double fee) {
if (fee < 0) {
fee = 0;
}
this.fee = fee;
}
/**
* Returns the clan's fee
*
* @return the fee
*/
public double getMemberFee() {
return fee;
}
/**
* Returns the clan's balance
*
@@ -373,23 +418,33 @@ public class Clan implements Serializable, Comparable<Clan> {
bb.remove(0);
}
bb.add(msg);
bb.add(System.currentTimeMillis() + "_" + msg);
SimpleClans.getInstance().getStorageManager().updateClan(this);
}
/**
* Adds a bulletin board message without announcer
* Adds a bulletin board message without saving it to the database
*
* @param msg
*/
public void addBbWithoutSaving(String msg) {
while (bb.size() > SimpleClans.getInstance().getSettingsManager().getBbSize()) {
bb.remove(0);
}
bb.add(System.currentTimeMillis() + "_" + msg);
}
/**
* Adds a bulletin board message without announcer and saves it to the database
*
* @param msg
*
* @param updateLastUsed should the clan's last used time be updated as well?
*/
public void addBb(String msg, boolean updateLastUsed) {
while (bb.size() > SimpleClans.getInstance().getSettingsManager().getBbSize()) {
bb.remove(0);
}
bb.add(msg);
addBbWithoutSaving(msg);
SimpleClans.getInstance().getStorageManager().updateClan(this, updateLastUsed);
}
@@ -1341,7 +1396,34 @@ public class Clan implements Serializable, Comparable<Clan> {
return false;
}
/**
* Checks if there are enough leaders online to vote
*
* @param cp the one to demote
* @return true if there are
*/
public boolean enoughLeadersOnlineToDemote(ClanPlayer cp) {
List<ClanPlayer> online = getOnlineLeaders();
online.remove(cp);
double minimum = SimpleClans.getInstance().getSettingsManager().getPercentageOnlineToDemote();
double totalLeaders = getLeaders().size();
double onlineLeaders = online.size();
return ((onlineLeaders / totalLeaders) * 100) >= minimum;
}
/**
* Gets the online leaders
*
* @return the online leaders
*/
public List<ClanPlayer> getOnlineLeaders() {
return getOnlineMembers().stream().filter(ClanPlayer::isLeader).collect(Collectors.toList());
}
/**
* Check whether all leaders of a clan are online
*
@@ -1504,12 +1586,72 @@ public class Clan implements Serializable, Comparable<Clan> {
}
for (String msg : bb) {
ChatBlock.sendMessage(player, SimpleClans.getInstance().getSettingsManager().getBbAccentColor() + "* " + SimpleClans.getInstance().getSettingsManager().getBbColor() + Helper.parseColors(msg));
if (!sendBbTime(player, msg)) {
ChatBlock.sendMessage(player, SimpleClans.getInstance().getSettingsManager().getBbAccentColor() + "* " + SimpleClans.getInstance().getSettingsManager().getBbColor() + Helper.parseColors(msg));
}
}
ChatBlock.sendBlank(player);
}
}
/**
* Displays bb to a player
* @implNote may want to refactor displaybb(Player) to use this?
*
* @param player
* @param maxSize amount of lines to display
*/
public void displayBb(Player player, int maxSize) {
if (isVerified()) {
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, MessageFormat.format(SimpleClans.getInstance().getLang("bulletin.board.header"), SimpleClans.getInstance().getSettingsManager().getBbAccentColor(), SimpleClans.getInstance().getSettingsManager().getPageHeadingsColor(), Helper.capitalize(getName())));
List<String> localBb = new ArrayList<>(bb);
while (localBb.size() > maxSize) {
localBb.remove(0);
}
for (String msg : localBb) {
if (!sendBbTime(player, msg)) {
ChatBlock.sendMessage(player, SimpleClans.getInstance().getSettingsManager().getBbAccentColor() + "* " + SimpleClans.getInstance().getSettingsManager().getBbColor() + Helper.parseColors(msg));
}
}
ChatBlock.sendBlank(player);
}
}
/**
* Sends a bb message with the timestamp in a hover message, if the bb message is timestamped
* @param msg the bb message
* @return true if sent
*/
private boolean sendBbTime(Player player, String msg) {
try {
int index = msg.indexOf("_");
if (index < 1)
return false;
long time;
time = (System.currentTimeMillis()
- Long.parseLong(msg.substring(0, index))) / 1000L;
msg = String.join("", ChatBlock
.getColorizedMessage(SimpleClans.getInstance()
.getSettingsManager().getBbAccentColor() + "* " +
SimpleClans.getInstance().getSettingsManager()
.getBbColor() + Helper.parseColors(
msg.substring(++index, msg.length()))));
TextComponent textComponent = new TextComponent(msg);
textComponent.setHoverEvent(
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
TextComponent.fromLegacyText(
Dates.formatTime(time, 1) + SimpleClans
.getInstance().getLang("bb.ago"))));
player.spigot().sendMessage(textComponent);
return true;
} catch (Throwable rock) {
return false;
}
}
/**
* Disband a clan
*/
@@ -1776,6 +1918,24 @@ public class Clan implements Serializable, Comparable<Clan> {
}
}
/**
* Checks if the fee is enabled
*
* @return true if enabled
*/
public boolean isMemberFeeEnabled() {
return feeEnabled;
}
/**
* Enables or disables the fee
*
* @param enable
*/
public void setMemberFeeEnabled(boolean enable) {
feeEnabled = enable;
}
/**
* @return the allowWithdraw
*/
@@ -1,138 +1,196 @@
package net.sacredlabyrinth.phaed.simpleclans;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
/**
* @author phaed
*/
public class Dates {
private Dates() {
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMonths(Timestamp date1, Timestamp date2) {
return differenceInMonths(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInYears(Timestamp date1, Timestamp date2) {
return differenceInYears(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInDays(Timestamp date1, Timestamp date2) {
return differenceInDays(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInHours(Timestamp date1, Timestamp date2) {
return differenceInHours(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMinutes(Timestamp date1, Timestamp date2) {
return differenceInMinutes(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInSeconds(Timestamp date1, Timestamp date2) {
return differenceInSeconds(new Date(date1.getTime()), new Date(date2.getTime()));
}
private static double differenceInMilliseconds(Timestamp date1, Timestamp date2) {
return differenceInMilliseconds(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMonths(Date date1, Date date2) {
return differenceInYears(date1, date2) * 12;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInYears(Date date1, Date date2) {
double days = differenceInDays(date1, date2);
return days / 365.2425;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInDays(Date date1, Date date2) {
return differenceInHours(date1, date2) / 24.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInHours(Date date1, Date date2) {
return differenceInMinutes(date1, date2) / 60.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMinutes(Date date1, Date date2) {
return differenceInSeconds(date1, date2) / 60.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInSeconds(Date date1, Date date2) {
return differenceInMilliseconds(date1, date2) / 1000.0;
}
private static double differenceInMilliseconds(Date date1, Date date2) {
return Math.abs(getTimeInMilliseconds(date1) - getTimeInMilliseconds(date2));
}
private static long getTimeInMilliseconds(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis() + cal.getTimeZone().getOffset(cal.getTimeInMillis());
}
}
package net.sacredlabyrinth.phaed.simpleclans;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
/**
* @author phaed
*/
public class Dates {
private Dates() {
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMonths(Timestamp date1, Timestamp date2) {
return differenceInMonths(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInYears(Timestamp date1, Timestamp date2) {
return differenceInYears(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInDays(Timestamp date1, Timestamp date2) {
return differenceInDays(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInHours(Timestamp date1, Timestamp date2) {
return differenceInHours(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMinutes(Timestamp date1, Timestamp date2) {
return differenceInMinutes(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInSeconds(Timestamp date1, Timestamp date2) {
return differenceInSeconds(new Date(date1.getTime()), new Date(date2.getTime()));
}
private static double differenceInMilliseconds(Timestamp date1, Timestamp date2) {
return differenceInMilliseconds(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMonths(Date date1, Date date2) {
return differenceInYears(date1, date2) * 12;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInYears(Date date1, Date date2) {
double days = differenceInDays(date1, date2);
return days / 365.2425;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInDays(Date date1, Date date2) {
return differenceInHours(date1, date2) / 24.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInHours(Date date1, Date date2) {
return differenceInMinutes(date1, date2) / 60.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMinutes(Date date1, Date date2) {
return differenceInSeconds(date1, date2) / 60.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInSeconds(Date date1, Date date2) {
return differenceInMilliseconds(date1, date2) / 1000.0;
}
private static double differenceInMilliseconds(Date date1, Date date2) {
return Math.abs(getTimeInMilliseconds(date1) - getTimeInMilliseconds(date2));
}
private static long getTimeInMilliseconds(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.getTimeInMillis() + cal.getTimeZone().getOffset(cal.getTimeInMillis());
}
/**
* Returns the string representation of the amount of time labeled as days, hours, minutes, seconds
* @author RoboMWM, LaxWasHere
* @param seconds the time in seconds
* @param depth Max amount of detail (e.g. only display days and hours if set to 1 and seconds > 1 day)
* @return
*/
public static String formatTime(Long seconds, int depth)
{
SimpleClans plugin = SimpleClans.getInstance();
if (seconds == null || seconds < 1) {
return plugin.getLang("bb.moments");
}
if (seconds < 60) {
return seconds + plugin.getLang("bb.seconds");
}
if (seconds < 3600) {
Long count = (long) Math.ceil(seconds / 60);
String res;
if (count > 1) {
res = count + plugin.getLang("bb.minutes");
} else {
res = plugin.getLang("bb.one.minute");
}
Long remaining = seconds % 60;
if (depth > 0 && remaining >= 5) {
return res + ", " + formatTime(remaining, --depth);
}
return res;
}
if (seconds < 86400) {
Long count = (long) Math.ceil(seconds / 3600);
String res;
if (count > 1) {
res = count + plugin.getLang("bb.hours");
} else {
res = plugin.getLang("bb.one.hour");
}
if (depth > 0) {
return res + ", " + formatTime(seconds % 3600, --depth);
}
return res;
}
Long count = (long) Math.ceil(seconds / 86400);
String res;
if (count > 1) {
res = count + plugin.getLang("bb.days");
} else {
res = plugin.getLang("bb.one.day");
}
if (depth > 0) {
return res + ", " + formatTime(seconds % 86400, --depth);
}
return res;
}
}
@@ -10,9 +10,11 @@ import java.io.IOException;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
/**
@@ -31,6 +33,26 @@ public class Helper {
SimpleClans.debug(el.toString());
}
}
/**
* Returns the delay in seconds to the specified hour and minute.
*
* @param hour hour
* @param minute minute
* @return the delay in seconds
*/
public static long getDelayTo(int hour, int minute) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime d = LocalDateTime.of(now.toLocalDate(), LocalTime.of(1, 0));
long delay;
if (now.isAfter(d)) {
delay = now.until(d.plusDays(1), ChronoUnit.SECONDS);
} else {
delay = now.until(d, ChronoUnit.SECONDS);
}
return delay;
}
/**
* Get a players full color name if he is online
@@ -626,24 +648,24 @@ public class Helper {
String leaderColor = sm.getAllyChatLeaderColor();
String memberColor = sm.getAllyChatMemberColor();
String rank = cp.getRank().isEmpty() ? null : ChatColor.translateAlternateColorCodes('&', cp.getRank());
String rankFormat = rank != null ? ChatColor.translateAlternateColorCodes('&', sm.getAllyChatRank()).replaceAll("%rank%", rank) : "";
String rankFormat = rank != null ? ChatColor.translateAlternateColorCodes('&', sm.getAllyChatRank()).replace("%rank%", rank) : "";
String message = replacePlaceholders(sm, cp, leaderColor, memberColor, rankFormat, msg);
String message = replacePlaceholders(sm.getAllyChatFormat(), cp, leaderColor, memberColor, rankFormat, msg);
if (placeholders != null) {
for (Entry<String, String> e : placeholders.entrySet()) {
message = message.replaceAll("%"+e.getKey()+"%", e.getValue());
message = message.replace("%"+e.getKey()+"%", e.getValue());
}
}
return message;
}
private static String replacePlaceholders(SettingsManager sm, ClanPlayer cp, String leaderColor, String memberColor, String rankFormat, String msg) {
String message = ChatColor.translateAlternateColorCodes('&', sm.getAllyChatFormat())
.replaceAll("%clan%", cp.getClan().getColorTag())
.replaceAll("%nick-color%", (cp.isLeader() ? leaderColor : memberColor))
.replaceAll("%player%", cp.getName())
.replaceAll("%rank%", rankFormat)
.replaceAll("%message%", Matcher.quoteReplacement(msg));
private static String replacePlaceholders(String messageFormat, ClanPlayer cp, String leaderColor, String memberColor, String rankFormat, String msg) {
String message = ChatColor.translateAlternateColorCodes('&', messageFormat)
.replace("%clan%", cp.getClan().getColorTag())
.replace("%nick-color%", (cp.isLeader() ? leaderColor : memberColor))
.replace("%player%", cp.getName())
.replace("%rank%", rankFormat)
.replace("%message%", msg);
return message;
}
@@ -661,13 +683,13 @@ public class Helper {
String leaderColor = sm.getClanChatLeaderColor();
String memberColor = sm.getClanChatMemberColor();
String rank = cp.getRank().isEmpty() ? null : ChatColor.translateAlternateColorCodes('&', cp.getRank());
String rankFormat = rank != null ? ChatColor.translateAlternateColorCodes('&', sm.getClanChatRank()).replaceAll("%rank%", rank) : "";
String rankFormat = rank != null ? ChatColor.translateAlternateColorCodes('&', sm.getClanChatRank()).replace("%rank%", rank) : "";
String message = replacePlaceholders(sm, cp, leaderColor, memberColor, rankFormat, msg);
String message = replacePlaceholders(sm.getClanChatFormat(), cp, leaderColor, memberColor, rankFormat, msg);
if (placeholders != null) {
for (Entry<String, String> e : placeholders.entrySet()) {
message = message.replaceAll("%"+e.getKey()+"%", e.getValue());
message = message.replace("%"+e.getKey()+"%", e.getValue());
}
}
return message;
@@ -13,6 +13,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sacredlabyrinth.phaed.simpleclans.tasks.CollectFeeTask;
import net.sacredlabyrinth.phaed.simpleclans.tasks.CollectUpkeepTask;
import net.sacredlabyrinth.phaed.simpleclans.tasks.UpkeepWarningTask;
/**
* @author Phaed
@@ -106,6 +109,18 @@ public class SimpleClans extends JavaPlugin {
logger.info("[SimpleClans] Online Mode: " + hasUUID); //TODO: Is this necessary?
logger.info("[SimpleClans] Modo Multithreading: " + SimpleClans.getInstance().getSettingsManager().getUseThreads());
logger.info("[SimpleClans] Modo BungeeCord: " + SimpleClans.getInstance().getSettingsManager().getUseBungeeCord());
startTasks();
}
private void startTasks() {
if (getSettingsManager().isMemberFee()) {
new CollectFeeTask().start();
}
if (getSettingsManager().isClanUpkeep()) {
new CollectUpkeepTask().start();
new UpkeepWarningTask().start();
}
}
@Override
@@ -17,6 +17,7 @@ import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
* @author phaed
*/
public class DemoteCommand {
public DemoteCommand() {
}
@@ -29,6 +30,48 @@ public class DemoteCommand {
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.demote.leader"), plugin.getSettingsManager().getCommandClan()));
return;
}
String demotedName = arg[0];
if (demotedName == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
final boolean hasUUID = SimpleClans.getInstance().hasUUID();
ClanPlayer toDemote;
if (hasUUID) {
UUID uuid = UUIDMigration.getForcedPlayerUUID(demotedName);
toDemote = plugin.getClanManager().getAnyClanPlayer(uuid);
} else {
toDemote = plugin.getClanManager().getAnyClanPlayer(demotedName);
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.demote")) {
if (!toDemote.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("player.is.not.a.leader.of.any.clan"));
return;
}
final Clan clan = toDemote.getClan();
if (clan.getLeaders().size() == 1) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.demote.the.last.leader"));
return;
}
if (hasUUID) {
clan.demote(toDemote.getUniqueId());
} else {
clan.demote(demotedName);
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("demoted.back.to.member"), Helper.capitalize(demotedName)));
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.successfully.demoted"));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.demote")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
@@ -46,39 +89,16 @@ public class DemoteCommand {
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.demote.leader"), plugin.getSettingsManager().getCommandClan()));
}
if (!clan.enoughLeadersOnlineToDemote(toDemote)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.enough.leaders.online.to.vote.on.demotion"));
return;
}
String demotedName = arg[0];
boolean allOtherLeadersOnline;
if (demotedName == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
if (SimpleClans.getInstance().hasUUID()) {
UUID PlayerUniqueId = UUIDMigration.getForcedPlayerUUID(demotedName);
if (PlayerUniqueId == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
allOtherLeadersOnline = clan.allOtherLeadersOnline(PlayerUniqueId);
} else {
allOtherLeadersOnline = clan.allOtherLeadersOnline(demotedName);
}
if (!allOtherLeadersOnline) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("leaders.must.be.online.to.vote.on.demotion"));
return;
}
if (SimpleClans.getInstance().hasUUID()) {
UUID PlayerUniqueId = UUIDMigration.getForcedPlayerUUID(demotedName);
if (!clan.isLeader(PlayerUniqueId)) {
if (hasUUID) {
UUID uuid = UUIDMigration.getForcedPlayerUUID(demotedName);
if (!clan.isLeader(uuid)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("player.is.not.a.leader.of.your.clan"));
return;
}
@@ -88,7 +108,7 @@ public class DemoteCommand {
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("demoted.back.to.member"), Helper.capitalize(demotedName)));
clan.demote(PlayerUniqueId);
clan.demote(uuid);
} else {
if (!clan.isLeader(demotedName)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("player.is.not.a.leader.of.your.clan"));
@@ -0,0 +1,68 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import java.text.MessageFormat;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
public class DescriptionCommand {
/**
* Execute the command
*
* @param player
* @param args
*/
public void execute(Player player, String[] args) {
final SimpleClans plugin = SimpleClans.getInstance();
final SettingsManager sm = plugin.getSettingsManager();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.description")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (args.length < 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.description"), plugin.getSettingsManager().getCommandClan()));
return;
}
String description = Helper.toMessage(args);
if (description.length() < sm.getClanMinDescriptionLength()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.clan.description.must.be.longer.than"), sm.getClanMinDescriptionLength()));
return;
}
if (description.length() > sm.getClanMaxDescriptionLength()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.clan.description.cannot.be.longer.than"), sm.getClanMaxDescriptionLength()));
return;
}
clan.setDescription(description);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("description.changed"));
plugin.getStorageManager().updateClanAsync(clan);
}
}
@@ -0,0 +1,85 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import java.text.MessageFormat;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
/**
*
* @author roinujnosde
*/
public class FeeCommand {
/**
* Executes the command
*
* @param player
* @param args
*/
public void execute(Player player, String[] args) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getSettingsManager().isMemberFee()) {
return;
}
if (args.length >= 1) {
ClanPlayer cp = plugin.getClanManager().getAnyClanPlayer(player.getUniqueId());
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (args[0].equalsIgnoreCase("check")) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.fee-check")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ChatBlock.sendMessage(player, ChatColor.AQUA
+ MessageFormat.format(
plugin.getLang("the.fee.is.0.and.its.current.value.is.1"),
clan.isMemberFeeEnabled() ? plugin.getLang("fee.enabled") : plugin.getLang("fee.disabled"),
clan.getMemberFee()
));
return;
}
if (args.length == 2 && args[0].equalsIgnoreCase("set")) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.fee")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (!cp.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
double newFee = 0;
try {
newFee = Double.parseDouble(args[1]);
} catch (NumberFormatException ignored) {
player.sendMessage(ChatColor.RED + plugin.getLang("invalid.fee"));
return;
}
double maxFee = plugin.getSettingsManager().getMaxMemberFee();
if (newFee > maxFee) {
ChatBlock.sendMessage(player, ChatColor.RED
+ MessageFormat.format(plugin.getLang("max.fee.allowed.is.0"), maxFee));
return;
}
if (plugin.getClanManager().purchaseMemberFeeSet(player)) {
clan.setMemberFee(newFee);
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("bb.fee.set"), newFee));
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("fee.set"));
plugin.getStorageManager().updateClanAsync(clan);
}
return;
}
}
ChatBlock.sendMessage(player, ChatColor.RED
+ MessageFormat.format(plugin.getLang("usage.fee"), plugin.getSettingsManager().getCommandClan()));
}
}
@@ -96,6 +96,12 @@ public class MenuCommand {
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.kills")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.killsplayer"), clanCommand, ChatColor.WHITE));
}
if (isVerified && plugin.getPermissionsManager().has(player, "simpleclans.member.fee-check")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.fee.check"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.fee")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.fee.set"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.ally")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.ally.add.remove.tag.1.add.remove.an.ally.clan"), clanCommand, ChatColor.WHITE));
}
@@ -129,6 +135,9 @@ public class MenuCommand {
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.modtag")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.modtag.tag.1.modify.the.clan.s.tag"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.description")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.description.description.1.modify.the.clan.s.description"), clanCommand, ChatColor.WHITE));
}
String toggles = "";
@@ -139,6 +148,10 @@ public class MenuCommand {
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.tag-toggle")) {
toggles += "tag/";
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.fee")) {
toggles += "fee/";
}
if (!toggles.isEmpty()) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.toggle.command"), clanCommand, ChatColor.WHITE, Helper.stripTrailing(toggles, "/")));
@@ -203,6 +216,12 @@ public class MenuCommand {
if (plugin.getPermissionsManager().has(player, "simpleclans.mod.globalff")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.globalff.allow.auto.1.set.global.friendly.fire"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.demote")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.demote.leader.1.demote.a.leader.to.member"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.purge")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.purge.player.1.purge.a.player"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.resetkdr")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.resetkdr.1.resets.kdr"), clanCommand, ChatColor.WHITE));
}
@@ -244,6 +263,7 @@ public class MenuCommand {
ChatBlock chatBlock = new ChatBlock();
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.purge.player.1.purge.a.player"), clanCommand, ChatColor.WHITE));
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.verify.tag.1.verify.an.unverified.clan"), clanCommand, ChatColor.WHITE));
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.reload.1.reload.configuration"), clanCommand, ChatColor.WHITE));
@@ -1,101 +1,106 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.NumberFormat;
/**
* @author phaed
*/
public class ProfileCommand {
public ProfileCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
NumberFormat formatter = new DecimalFormat("#.#");
Clan clan = null;
if (arg.length == 0) {
if (plugin.getPermissionsManager().has(player, "simpleclans.member.profile")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
} else {
if (cp.getClan().isVerified()) {
clan = cp.getClan();
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
} else if (arg.length == 1) {
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.profile")) {
clan = plugin.getClanManager().getClan(arg[0]);
if (clan == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clan.matched"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.profile.tag"), plugin.getSettingsManager().getCommandClan()));
}
if (clan != null) {
if (clan.isVerified()) {
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getPageClanNameColor() + Helper.capitalize(clan.getName()) + subColor + " " + plugin.getLang("profile") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
String name = plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketLeft() + plugin.getSettingsManager().getTagDefaultColor() + clan.getColorTag() + plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketRight() + " " + plugin.getSettingsManager().getPageClanNameColor() + clan.getName();
String leaders = clan.getLeadersString(plugin.getSettingsManager().getPageLeaderColor(), subColor + ", ");
String onlineCount = ChatColor.WHITE + "" + Helper.stripOffLinePlayers(clan.getMembers()).size();
String membersOnline = onlineCount + subColor + "/" + ChatColor.WHITE + clan.getSize();
String inactive = ChatColor.WHITE + "" + clan.getInactiveDays() + subColor + "/" + ChatColor.WHITE + (clan.isVerified() ? plugin.getSettingsManager().getPurgeClan() : plugin.getSettingsManager().getPurgeUnverified()) + " " + plugin.getLang("days");
String founded = ChatColor.WHITE + "" + clan.getFoundedString();
String allies = ChatColor.WHITE + "" + clan.getAllyString(subColor + ", ");
String rivals = ChatColor.WHITE + "" + clan.getRivalString(subColor + ", ");
String kdr = ChatColor.YELLOW + "" + formatter.format(clan.getTotalKDR());
String deaths = ChatColor.WHITE + "" + clan.getTotalDeaths();
String rival = ChatColor.WHITE + "" + clan.getTotalRival();
String neutral = ChatColor.WHITE + "" + clan.getTotalNeutral();
String civ = ChatColor.WHITE + "" + clan.getTotalCivilian();
String status = ChatColor.WHITE + "" + (clan.isVerified() ? plugin.getSettingsManager().getPageTrustedColor() + plugin.getLang("verified") : plugin.getSettingsManager().getPageUnTrustedColor() + plugin.getLang("unverified"));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("name.0"), name));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("status.0"), status));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("leaders.0"), leaders));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("members.online.0"), membersOnline));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("kdr.0"), kdr));
ChatBlock.sendMessage(player, " " + subColor + plugin.getLang("kill.totals") + " " + headColor + "[" + plugin.getLang("rival") + ":" + rival + " " + headColor + "" + plugin.getLang("neutral") + ":" + neutral + " " + headColor + "" + plugin.getLang("civilian") + ":" + civ + headColor + "]");
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("deaths.0"), deaths));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("allies.0"), allies));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("rivals.0"), rivals));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("founded.0"), founded));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("inactive.0"), inactive));
ChatBlock.sendBlank(player);
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
}
}
}
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.NumberFormat;
/**
* @author phaed
*/
public class ProfileCommand {
public ProfileCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
NumberFormat formatter = new DecimalFormat("#.#");
Clan clan = null;
if (arg.length == 0) {
if (plugin.getPermissionsManager().has(player, "simpleclans.member.profile")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
} else {
if (cp.getClan().isVerified()) {
clan = cp.getClan();
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
} else if (arg.length == 1) {
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.profile")) {
clan = plugin.getClanManager().getClan(arg[0]);
if (clan == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clan.matched"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.profile.tag"), plugin.getSettingsManager().getCommandClan()));
}
if (clan != null) {
if (clan.isVerified()) {
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getPageClanNameColor() + Helper.capitalize(clan.getName()) + subColor + " " + plugin.getLang("profile") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
String name = plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketLeft() + plugin.getSettingsManager().getTagDefaultColor() + clan.getColorTag() + plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketRight() + " " + plugin.getSettingsManager().getPageClanNameColor() + clan.getName();
String description = ChatColor.WHITE + (clan.getDescription() != null && !clan.getDescription().isEmpty() ? clan.getDescription() : plugin.getLang("no.description"));
String leaders = clan.getLeadersString(plugin.getSettingsManager().getPageLeaderColor(), subColor + ", ");
String onlineCount = ChatColor.WHITE + "" + Helper.stripOffLinePlayers(clan.getMembers()).size();
String membersOnline = onlineCount + subColor + "/" + ChatColor.WHITE + clan.getSize();
String inactive = ChatColor.WHITE + "" + clan.getInactiveDays() + subColor + "/" + ChatColor.WHITE + (clan.isVerified() ? plugin.getSettingsManager().getPurgeClan() : plugin.getSettingsManager().getPurgeUnverified()) + " " + plugin.getLang("days");
String founded = ChatColor.WHITE + "" + clan.getFoundedString();
String allies = ChatColor.WHITE + "" + clan.getAllyString(subColor + ", ");
String rivals = ChatColor.WHITE + "" + clan.getRivalString(subColor + ", ");
String kdr = ChatColor.YELLOW + "" + formatter.format(clan.getTotalKDR());
String deaths = ChatColor.WHITE + "" + clan.getTotalDeaths();
String rival = ChatColor.WHITE + "" + clan.getTotalRival();
String neutral = ChatColor.WHITE + "" + clan.getTotalNeutral();
String civ = ChatColor.WHITE + "" + clan.getTotalCivilian();
String status = ChatColor.WHITE + "" + (clan.isVerified() ? plugin.getSettingsManager().getPageTrustedColor() + plugin.getLang("verified") : plugin.getSettingsManager().getPageUnTrustedColor() + plugin.getLang("unverified"));
String feeEnabled = ChatColor.WHITE + (clan.isMemberFeeEnabled() ? plugin.getLang("fee.enabled") : plugin.getLang("fee.disabled"));
String feeValue = ChatColor.WHITE + "" + clan.getMemberFee();
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("name.0"), name));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("description.0"), description));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("status.0"), status));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("leaders.0"), leaders));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("members.online.0"), membersOnline));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("kdr.0"), kdr));
ChatBlock.sendMessage(player, " " + subColor + plugin.getLang("kill.totals") + " " + headColor + "[" + plugin.getLang("rival") + ":" + rival + " " + headColor + "" + plugin.getLang("neutral") + ":" + neutral + " " + headColor + "" + plugin.getLang("civilian") + ":" + civ + headColor + "]");
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("deaths.0"), deaths));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("fee.0.value.1"), feeEnabled, feeValue));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("allies.0"), allies));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("rivals.0"), rivals));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("founded.0"), founded));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("inactive.0"), inactive));
ChatBlock.sendBlank(player);
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
}
}
}
@@ -0,0 +1,47 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import java.text.MessageFormat;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*
* @author roinujnosde
*/
public class PurgeCommand {
/**
* Executes the command
*
* @param sender
* @param args
*/
public void execute(CommandSender sender, String args[]) {
SimpleClans plugin = SimpleClans.getInstance();
if (sender instanceof Player) {
if (!plugin.getPermissionsManager().has((Player) sender, "simpleclans.admin.purge")) {
ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
}
if (args.length == 1) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(args[0]);
if (cp == null) {
ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
plugin.getClanManager().deleteClanPlayer(cp);
ChatBlock.sendMessage(sender, ChatColor.AQUA + plugin.getLang("player.purged"));
return;
}
ChatBlock.sendMessage(sender, ChatColor.RED
+ MessageFormat.format(plugin.getLang("usage.purge"), plugin.getSettingsManager().getCommandClan()));
}
}
@@ -1,14 +1,13 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import net.sacredlabyrinth.phaed.simpleclans.conversation.ResignPrompt;
import org.bukkit.conversations.ConversationFactory;
/**
* @author phaed
@@ -36,20 +35,11 @@ public class ResignCommand {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player) || clan.getLeaders().size() > 1) {
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("0.has.resigned"), Helper.capitalize(player.getName())));
if (SimpleClans.getInstance().hasUUID()) {
clan.removePlayerFromClan(player.getUniqueId());
} else {
clan.removePlayerFromClan(player.getName());
}
} else if (clan.isLeader(player) && clan.getLeaders().size() == 1) {
plugin.getClanManager().serverAnnounce(ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.has.been.disbanded"), clan.getName()));
clan.disband();
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("last.leader.cannot.resign.you.must.appoint.another.leader.or.disband.the.clan"));
}
new ConversationFactory(plugin)
.withFirstPrompt(new ResignPrompt())
.withLocalEcho(true)
.withTimeout(10)
.buildConversation(player).begin();
}
}
@@ -1,138 +1,159 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
/**
* @author phaed
*/
public class ToggleCommand {
public ToggleCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg.length == 0) {
return;
}
String cmd = arg[0];
if (cmd.equalsIgnoreCase("cape")) {
if (plugin.getPermissionsManager().has(player, "simpleclans.member.cape-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isCapeEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("capeoff"));
cp.setCapeEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("capeon"));
cp.setCapeEnabled(true);
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
}
if (cmd.equalsIgnoreCase("bb") && plugin.getPermissionsManager().has(player, "simpleclans.member.bb-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isBbEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("bboff"));
cp.setBbEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("bbon"));
cp.setBbEnabled(true);
}
plugin.getStorageManager().updateClanPlayer(cp);
}
}
}
if (cmd.equalsIgnoreCase("tag") && plugin.getPermissionsManager().has(player, "simpleclans.member.tag-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isTagEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("tagoff"));
cp.setTagEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("tagon"));
cp.setTagEnabled(true);
}
plugin.getStorageManager().updateClanPlayer(cp);
}
}
}
if (cmd.equalsIgnoreCase("deposit") && plugin.getPermissionsManager().has(player, "simpleclans.leader.deposit-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isLeader(player)) {
if (clan.isVerified()) {
if (clan.isAllowDeposit()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("depositoff"));
clan.setAllowDeposit(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("depositon"));
clan.setAllowDeposit(true);
}
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
}
}
if (cmd.equalsIgnoreCase("withdraw") && plugin.getPermissionsManager().has(player, "simpleclans.leader.withdraw-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (clan.isLeader(player)) {
if (clan.isAllowWithdraw()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("withdrawoff"));
clan.setAllowWithdraw(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("withdrawon"));
clan.setAllowWithdraw(true);
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
}
}
}
}
}
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
/**
* @author phaed
*/
public class ToggleCommand {
public ToggleCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg.length == 0) {
return;
}
String cmd = arg[0];
if (cmd.equalsIgnoreCase("cape")) {
if (plugin.getPermissionsManager().has(player, "simpleclans.member.cape-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isCapeEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("capeoff"));
cp.setCapeEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("capeon"));
cp.setCapeEnabled(true);
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
}
if (cmd.equalsIgnoreCase("bb") && plugin.getPermissionsManager().has(player, "simpleclans.member.bb-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isBbEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("bboff"));
cp.setBbEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("bbon"));
cp.setBbEnabled(true);
}
plugin.getStorageManager().updateClanPlayer(cp);
}
}
}
if (cmd.equalsIgnoreCase("tag") && plugin.getPermissionsManager().has(player, "simpleclans.member.tag-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isTagEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("tagoff"));
cp.setTagEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("tagon"));
cp.setTagEnabled(true);
}
plugin.getStorageManager().updateClanPlayer(cp);
}
}
}
if (cmd.equalsIgnoreCase("deposit") && plugin.getPermissionsManager().has(player, "simpleclans.leader.deposit-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isLeader(player)) {
if (clan.isVerified()) {
if (clan.isAllowDeposit()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("depositoff"));
clan.setAllowDeposit(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("depositon"));
clan.setAllowDeposit(true);
}
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
}
}
if (cmd.equalsIgnoreCase("fee") && plugin.getPermissionsManager().has(player, "simpleclans.leader.fee")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (clan.isLeader(player)) {
if (clan.isMemberFeeEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("feeoff"));
clan.setMemberFeeEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("feeon"));
clan.setMemberFeeEnabled(true);
}
plugin.getStorageManager().updateClanAsync(clan);
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
}
}
}
if (cmd.equalsIgnoreCase("withdraw") && plugin.getPermissionsManager().has(player, "simpleclans.leader.withdraw-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (clan.isLeader(player)) {
if (clan.isAllowWithdraw()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("withdrawoff"));
clan.setAllowWithdraw(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("withdrawon"));
clan.setAllowWithdraw(true);
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
}
}
}
}
}
@@ -0,0 +1,28 @@
package net.sacredlabyrinth.phaed.simpleclans.conversation;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
/**
*
* @author roinujnosde
*/
public class MessagePromptImpl extends org.bukkit.conversations.MessagePrompt {
private final String message;
public MessagePromptImpl(String message) {
this.message = message;
}
@Override
protected Prompt getNextPrompt(ConversationContext cc) {
return END_OF_CONVERSATION;
}
@Override
public String getPromptText(ConversationContext cc) {
return message;
}
}
@@ -0,0 +1,62 @@
package net.sacredlabyrinth.phaed.simpleclans.conversation;
import java.text.MessageFormat;
import java.util.Arrays;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import static org.bukkit.conversations.Prompt.END_OF_CONVERSATION;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.entity.Player;
/**
*
* @author roinujnosde
*/
public class ResignPrompt extends StringPrompt {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
final SimpleClans plugin = (SimpleClans) cc.getPlugin();
String yes = plugin.getLang("resign.yes");
Player player = (Player) cc.getForWhom();
ClanManager cm = plugin.getClanManager();
ClanPlayer cp = cm.getClanPlayer(player);
Clan clan = cp.getClan();
if (yes.equalsIgnoreCase(input)) {
if (!clan.isLeader(player) || clan.getLeaders().size() > 1) {
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("0.has.resigned"), Helper.capitalize(player.getName())));
if (SimpleClans.getInstance().hasUUID()) {
clan.removePlayerFromClan(player.getUniqueId());
} else {
clan.removePlayerFromClan(player.getName());
}
return new MessagePromptImpl(ChatColor.AQUA + plugin.getLang("resign.success"));
} else if (clan.isLeader(player) && clan.getLeaders().size() == 1) {
plugin.getClanManager().serverAnnounce(ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.has.been.disbanded"), clan.getName()));
clan.disband();
} else {
return new MessagePromptImpl(ChatColor.RED + plugin.getLang("last.leader.cannot.resign.you.must.appoint.another.leader.or.disband.the.clan"));
}
}
return END_OF_CONVERSATION;
}
@Override
public String getPromptText(ConversationContext cc) {
final SimpleClans plugin = (SimpleClans) cc.getPlugin();
return ChatColor.RED + MessageFormat.format(
plugin.getLang("resign.confirmation"), Arrays.asList(
plugin.getLang("resign.yes"), plugin.getLang("resign.no")));
}
}
@@ -12,47 +12,50 @@ import java.text.MessageFormat;
* @author phaed
*/
public final class ClanCommandExecutor implements CommandExecutor {
private SimpleClans plugin;
private CreateCommand createCommand;
private ListCommand listCommand;
private ProfileCommand profileCommand;
private RosterCommand rosterCommand;
private LookupCommand lookupCommand;
private LeaderboardCommand leaderboardCommand;
private AlliancesCommand alliancesCommand;
private RivalriesCommand rivalriesCommand;
private VitalsCommand vitalsCommand;
private CoordsCommand coordsCommand;
private StatsCommand statsCommand;
private AllyCommand allyCommand;
private RivalCommand rivalCommand;
private BbCommand bbCommand;
private ModtagCommand modtagCommand;
private ToggleCommand toggleCommand;
private InviteCommand inviteCommand;
private KickCommand kickCommand;
private TrustCommand trustCommand;
private UntrustCommand untrustCommand;
private PromoteCommand promoteCommand;
private DemoteCommand demoteCommand;
private ClanffCommand clanffCommand;
private FfCommand ffCommand;
private ResignCommand resignCommand;
private DisbandCommand disbandCommand;
private VerifyCommand verifyCommand;
private BanCommand banCommand;
private UnbanCommand unbanCommand;
private ReloadCommand reloadCommand;
private GlobalffCommand globalffCommand;
private MenuCommand menuCommand;
private WarCommand warCommand;
private HomeCommand homeCommand;
private KillsCommand killsCommand;
private MostKilledCommand mostKilledCommand;
private SetRankCommand setRankCommand;
private BankCommand bankCommand;
private PlaceCommand placeCommand;
private ResetKDRCommand resetKDRCommand;
private final SimpleClans plugin;
private final CreateCommand createCommand;
private final ListCommand listCommand;
private final ProfileCommand profileCommand;
private final RosterCommand rosterCommand;
private final LookupCommand lookupCommand;
private final LeaderboardCommand leaderboardCommand;
private final AlliancesCommand alliancesCommand;
private final RivalriesCommand rivalriesCommand;
private final VitalsCommand vitalsCommand;
private final CoordsCommand coordsCommand;
private final StatsCommand statsCommand;
private final AllyCommand allyCommand;
private final RivalCommand rivalCommand;
private final BbCommand bbCommand;
private final ModtagCommand modtagCommand;
private final ToggleCommand toggleCommand;
private final InviteCommand inviteCommand;
private final KickCommand kickCommand;
private final TrustCommand trustCommand;
private final UntrustCommand untrustCommand;
private final PromoteCommand promoteCommand;
private final DemoteCommand demoteCommand;
private final ClanffCommand clanffCommand;
private final FfCommand ffCommand;
private final ResignCommand resignCommand;
private final DisbandCommand disbandCommand;
private final VerifyCommand verifyCommand;
private final BanCommand banCommand;
private final FeeCommand feeCommand;
private final UnbanCommand unbanCommand;
private final ReloadCommand reloadCommand;
private final GlobalffCommand globalffCommand;
private final MenuCommand menuCommand;
private final WarCommand warCommand;
private final HomeCommand homeCommand;
private final KillsCommand killsCommand;
private final MostKilledCommand mostKilledCommand;
private final SetRankCommand setRankCommand;
private final BankCommand bankCommand;
private final PlaceCommand placeCommand;
private final ResetKDRCommand resetKDRCommand;
private final PurgeCommand purgeCommand;
private final DescriptionCommand descriptionCommand;
/**
*
@@ -99,6 +102,9 @@ public final class ClanCommandExecutor implements CommandExecutor {
bankCommand = new BankCommand();
placeCommand = new PlaceCommand();
resetKDRCommand = new ResetKDRCommand();
feeCommand = new FeeCommand();
purgeCommand = new PurgeCommand();
descriptionCommand = new DescriptionCommand();
}
@Override
@@ -200,7 +206,13 @@ public final class ClanCommandExecutor implements CommandExecutor {
placeCommand.execute(player, subargs);
} else if (subcommand.equalsIgnoreCase(plugin.getLang("resetkdr.command")) || subcommand.equalsIgnoreCase("resetkdr")) {
resetKDRCommand.execute(player, subargs);
} else {
} else if (subcommand.equalsIgnoreCase(plugin.getLang("fee.command")) || subcommand.equalsIgnoreCase("fee")) {
feeCommand.execute(player, subargs);
} else if (subcommand.equalsIgnoreCase(plugin.getLang("purge.command")) || subcommand.equalsIgnoreCase("purge")){
purgeCommand.execute(player, subargs);
} else if (subcommand.equalsIgnoreCase(plugin.getLang("description.command")) || subcommand.equalsIgnoreCase("description")) {
descriptionCommand.execute(player, subargs);
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("does.not.match"));
}
}
@@ -219,8 +231,9 @@ public final class ClanCommandExecutor implements CommandExecutor {
placeCommand.execute(sender, subargs);
} else if (subcommand.equalsIgnoreCase(plugin.getLang("globalff.command")) || subcommand.equalsIgnoreCase("globalff")) {
globalffCommand.execute(sender, subargs);
}
else {
} else if (subcommand.equalsIgnoreCase(plugin.getLang("purge.command")) || subcommand.equalsIgnoreCase("purge")) {
purgeCommand.execute(sender, subargs);
} else {
ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("does.not.match"));
}
}
@@ -15,6 +15,7 @@ import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import java.text.MessageFormat;
import java.util.logging.Level;
/**
* @author phaed
@@ -78,6 +79,18 @@ public class SCEntityListener implements Listener
if (attacker != null && victim != null)
{
if (SimpleClans.getInstance().getSettingsManager().isDenySameIPKills())
{
if (attacker.getAddress().getHostString().equals(victim.getAddress().getHostString()))
{
plugin.getLogger().log(Level.INFO, "Blocked same IP kill calculating: {0} killed {1}. IP: {2}", new Object[]{
attacker.getDisplayName(), victim.getDisplayName(), attacker.getAddress().getHostString()
});
return;
}
}
ClanPlayer acp;
ClanPlayer vcp;
if (SimpleClans.getInstance().hasUUID())
@@ -97,6 +110,7 @@ public class SCEntityListener implements Listener
if (vcp.getClan() == null || acp.getClan() == null || !vcp.getClan().isVerified() || !acp.getClan().isVerified())
{
acp.addCivilianKill();
//TODO: Is this slowing down the server?
plugin.getStorageManager().insertKill(attacker, acp.getTag(), victim, "", "c");
} else if (acp.getClan().isRival(vcp.getTag()))
{
@@ -259,7 +259,7 @@ public class SCPlayerListener implements Listener {
SimpleClans.getInstance().getPermissionsManager().addPlayerPermissions(cp);
if (plugin.getSettingsManager().isBbShowOnLogin() && cp.isBbEnabled()) {
cp.getClan().displayBb(player);
cp.getClan().displayBb(player, plugin.getSettingsManager().getBbLoginSize());
}
SimpleClans.getInstance().getPermissionsManager().addClanPermissions(cp);
@@ -14,6 +14,7 @@ import java.util.*;
import net.sacredlabyrinth.phaed.simpleclans.events.ChatEvent;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.scheduler.BukkitRunnable;
/**
* @author phaed
@@ -91,10 +92,11 @@ public final class ClanManager {
SimpleClans.getInstance().getPermissionsManager().updateClanPermissions(clan);
SimpleClans.getInstance().getServer().getPluginManager().callEvent(new CreateClanEvent(clan));
}
/**
* Reset a player's kdr
* @param cp
*
* @param cp
*/
public void resetKdr(ClanPlayer cp) {
cp.setCivilianKills(0);
@@ -110,6 +112,14 @@ public final class ClanManager {
* @param cp
*/
public void deleteClanPlayer(ClanPlayer cp) {
Clan clan = cp.getClan();
if (clan != null) {
if (SimpleClans.getInstance().hasUUID()) {
clan.removePlayerFromClan(cp.getUniqueId());
} else {
clan.removePlayerFromClan(cp.getName());
}
}
clanPlayers.remove(cp.getCleanName());
plugin.getStorageManager().deleteClanPlayer(cp);
}
@@ -232,8 +242,7 @@ public final class ClanManager {
return getClanPlayer(player.getName());
}
}
/**
* Gets the ClanPlayer data object if a player is currently in a clan, null
* if he's not in a clan
@@ -880,6 +889,32 @@ public final class ClanManager {
}
});
}
/**
* Purchase member fee set
*
* @param player
* @return
*/
public boolean purchaseMemberFeeSet(Player player) {
if (!plugin.getSettingsManager().isePurchaseMemberFeeSet()) {
return true;
}
double price = plugin.getSettingsManager().geteMemberFeeSetPrice();
if (plugin.getPermissionsManager().hasEconomy()) {
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
plugin.getPermissionsManager().playerChargeMoney(player, price);
player.sendMessage(ChatColor.RED + MessageFormat.format(plugin.getLang("account.has.been.debited"), price));
} else {
player.sendMessage(ChatColor.RED + plugin.getLang("not.sufficient.money"));
return false;
}
}
return true;
}
/**
* Purchase clan creation
@@ -984,10 +1019,10 @@ public final class ClanManager {
return true;
}
/**
* Purchase Reset Kdr
*
*
* @param player
* @return
*/
@@ -995,9 +1030,9 @@ public final class ClanManager {
if (!plugin.getSettingsManager().isePurchaseResetKdr()) {
return true;
}
double price = plugin.getSettingsManager().geteResetKdr();
if (plugin.getPermissionsManager().hasEconomy()) {
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
plugin.getPermissionsManager().playerChargeMoney(player, price);
@@ -1101,8 +1136,8 @@ public final class ClanManager {
* @param player
* @param msg
*/
public void processClanChat(Player player, String msg) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
public void processClanChat(Player player, final String msg) {
final ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
return;
@@ -1141,29 +1176,34 @@ public final class ClanManager {
ChatBlock.sendMessage(player, ChatColor.AQUA + "You have unmuted clan chat");
}
} else {
List<ClanPlayer> receivers = new LinkedList<>();
final List<ClanPlayer> receivers = new LinkedList<>();
for (ClanPlayer p : cp.getClan().getOnlineMembers()) {
if (!p.isMuted()) {
receivers.add(p);
}
}
ChatEvent ce = new ChatEvent(msg, cp, receivers, ChatEvent.Type.CLAN);
Bukkit.getServer().getPluginManager().callEvent(ce);
if (ce.isCancelled()) {
return;
}
String message = Helper.formatClanChat(cp, ce.getMessage(), ce.getPlaceholders());
String eyeMessage = Helper.formatSpyClanChat(cp, message);
plugin.getServer().getConsoleSender().sendMessage(eyeMessage);
for (ClanPlayer p : ce.getReceivers()) {
ChatBlock.sendMessage(p.toPlayer(), message);
}
sendToAllSeeing(eyeMessage, ce.getReceivers());
new BukkitRunnable() {
@Override
public void run() {
ChatEvent ce = new ChatEvent(msg, cp, receivers, ChatEvent.Type.CLAN);
Bukkit.getServer().getPluginManager().callEvent(ce);
if (ce.isCancelled()) {
return;
}
String message = Helper.formatClanChat(cp, ce.getMessage(), ce.getPlaceholders());
String eyeMessage = Helper.formatSpyClanChat(cp, message);
plugin.getServer().getConsoleSender().sendMessage(eyeMessage);
for (ClanPlayer p : ce.getReceivers()) {
ChatBlock.sendMessage(p.toPlayer(), message);
}
sendToAllSeeing(eyeMessage, ce.getReceivers());
}
}.runTask(plugin);
}
}
@@ -1199,8 +1239,8 @@ public final class ClanManager {
* @param player
* @param msg
*/
public void processAllyChat(Player player, String msg) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
public void processAllyChat(Player player, final String msg) {
final ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
return;
@@ -1239,7 +1279,7 @@ public final class ClanManager {
ChatBlock.sendMessage(player, ChatColor.AQUA + "You have unmuted ally chat");
}
} else {
List<ClanPlayer> receivers = new LinkedList<>();
final List<ClanPlayer> receivers = new LinkedList<>();
Set<ClanPlayer> allies = cp.getClan().getAllAllyMembers();
allies.addAll(cp.getClan().getMembers());
for (ClanPlayer ally : allies) {
@@ -1257,23 +1297,28 @@ public final class ClanManager {
}
receivers.add(ally);
}
ChatEvent ce = new ChatEvent(msg, cp, receivers, ChatEvent.Type.ALLY);
Bukkit.getServer().getPluginManager().callEvent(ce);
if (ce.isCancelled()) {
return;
}
String message = Helper.formatAllyChat(cp, ce.getMessage(), ce.getPlaceholders());
SimpleClans.log(message);
Player self = cp.toPlayer();
ChatBlock.sendMessage(self, message);
new BukkitRunnable() {
@Override
public void run() {
ChatEvent ce = new ChatEvent(msg, cp, receivers, ChatEvent.Type.ALLY);
Bukkit.getServer().getPluginManager().callEvent(ce);
for (ClanPlayer p : ce.getReceivers()) {
ChatBlock.sendMessage(p.toPlayer(), message);
}
if (ce.isCancelled()) {
return;
}
String message = Helper.formatAllyChat(cp, ce.getMessage(), ce.getPlaceholders());
SimpleClans.log(message);
Player self = cp.toPlayer();
ChatBlock.sendMessage(self, message);
for (ClanPlayer p : ce.getReceivers()) {
ChatBlock.sendMessage(p.toPlayer(), message);
}
}
}.runTask(plugin);
}
}
@@ -7,7 +7,6 @@ import org.yaml.snakeyaml.Yaml;
import java.io.*;
import java.util.HashMap;
import java.util.TreeMap;
@SuppressWarnings("unchecked")
public class LanguageManager {
@@ -85,6 +84,6 @@ public class LanguageManager {
return o.toString();
}
return null;
return "Missing language for "+key;
}
}
@@ -157,6 +157,17 @@ public final class PermissionsManager {
public Map<Player, PermissionAttachment> getPermAttaches() {
return permAttaches;
}
/**
* Charge a player some money
*
* @param player
* @param money
* @return
*/
public boolean playerChargeMoney(String player, double money) {
return economy.withdrawPlayer(player, money).transactionSuccess();
}
/**
* Charge a player some money
@@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.*;
import org.bukkit.scheduler.BukkitRunnable;
/**
* @author phaed
@@ -436,7 +437,7 @@ public final class RequestManager {
*
* @param req
*/
public void ask(Request req) {
public void ask(final Request req) {
final String tag = plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketLeft() + plugin.getSettingsManager().getTagDefaultColor() + req.getClan().getColorTag() + plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketRight();
final String message = tag + " " + plugin.getSettingsManager().getRequestMessageColor() + req.getMsg();
final String options = MessageFormat.format(plugin.getLang("accept.or.deny"), ChatBlock.makeEmpty(Helper.stripColors(tag)) + " " + ChatColor.DARK_GREEN + "/" + plugin.getSettingsManager().getCommandAccept() + plugin.getSettingsManager().getPageHeadingsColor(), ChatColor.DARK_RED + "/" + plugin.getSettingsManager().getCommandDeny());
@@ -465,6 +466,11 @@ public final class RequestManager {
}
}
SimpleClans.getInstance().getServer().getPluginManager().callEvent(new RequestEvent(req));
new BukkitRunnable() {
@Override
public void run() {
SimpleClans.getInstance().getServer().getPluginManager().callEvent(new RequestEvent(req));
}
}.runTask(plugin);
}
}
@@ -23,13 +23,13 @@ public final class SettingsManager {
private boolean dropOnHome;
private boolean keepOnHome;
private boolean debugging;
@SuppressWarnings("FieldMayBeFinal")
private SimpleClans plugin;
private final SimpleClans plugin;
private boolean mChatIntegration;
private boolean pvpOnlywhileInWar;
private boolean useColorCodeFromPrefix;
private boolean confirmationForPromote;
private boolean confirmationForDemote;
private double percentageOnlineToDemote;
private boolean globalff;
private boolean allowResetKdr;
private boolean showUnverifiedOnList;
@@ -50,6 +50,11 @@ public final class SettingsManager {
private boolean eIssuerPaysRegroup;
private boolean ePurchaseHomeTeleportSet;
private boolean ePurchaseResetKdr;
private boolean eMemberFee;
private boolean ePurchaseMemberFeeSet;
private boolean eClanUpkeepEnabled;
private boolean eMultiplyUpkeepBySize;
private boolean eChargeUpkeepOnlyIfMemberFeeEnabled;
private double eCreationPrice;
private double eVerificationPrice;
private double eInvitePrice;
@@ -57,6 +62,9 @@ public final class SettingsManager {
private double eHomeRegroupPrice;
private double eHomeTeleportPriceSet;
private double eResetKdr;
private double eMaxMemberFee;
private double eMemberFeeSetPrice;
private double eClanUpkeep;
private String serverName;
private boolean chatTags;
private int purgeClan;
@@ -73,6 +81,7 @@ public final class SettingsManager {
private String pageUnTrustedColor;
private boolean bbShowOnLogin;
private int bbSize;
private int bbLoginSize;
private String bbColor;
private String bbAccentColor;
private String commandClan;
@@ -86,6 +95,8 @@ public final class SettingsManager {
private int clanMinSizeToRival;
private int clanMinLength;
private int clanMaxLength;
private int clanMaxDescriptionLength;
private int clanMinDescriptionLength;
private String pageClanNameColor;
private int tagMinLength;
private int tagMaxLength;
@@ -135,14 +146,13 @@ public final class SettingsManager {
private String username;
private String password;
private boolean safeCivilians;
@SuppressWarnings("FieldMayBeFinal")
private File main;
@SuppressWarnings("FieldMayBeFinal")
private FileConfiguration config;
private final File main;
private final FileConfiguration config;
private boolean compatMode;
private boolean homebaseSetOnce;
private int waitSecs;
private boolean enableAutoGroups;
private boolean denySameIPKills;
private boolean moneyperkill;
private double KDRMultipliesPerKill;
private boolean teleportBlocks;
@@ -214,6 +224,8 @@ public final class SettingsManager {
ePurchaseHomeRegroup = getConfig().getBoolean("economy.purchase-home-regroup");
ePurchaseHomeTeleportSet = getConfig().getBoolean("economy.purchase-home-teleport-set");
ePurchaseResetKdr = getConfig().getBoolean("economy.purchase-reset-kdr");
ePurchaseMemberFeeSet = getConfig().getBoolean("economy.purchase-member-fee-set");
eMemberFeeSetPrice = getConfig().getDouble("economy.member-fee-set-price");
eResetKdr = getConfig().getDouble("economy.reset-kdr-price");
eCreationPrice = getConfig().getDouble("economy.creation-price");
eVerificationPrice = getConfig().getDouble("economy.verification-price");
@@ -223,6 +235,12 @@ public final class SettingsManager {
eUniqueTaxOnRegroup = getConfig().getBoolean("economy.unique-tax-on-regroup");
eIssuerPaysRegroup = getConfig().getBoolean("economy.issuer-pays-regroup");
eHomeTeleportPriceSet = getConfig().getDouble("economy.home-teleport-set-price");
eMaxMemberFee = getConfig().getDouble("economy.max-member-fee");
eClanUpkeep = getConfig().getDouble("economy.upkeep");
eClanUpkeepEnabled = getConfig().getBoolean("economy.upkeep-enabled");
eChargeUpkeepOnlyIfMemberFeeEnabled = getConfig().getBoolean("economy.charge-upkeep-only-if-member-fee-enabled");
eMultiplyUpkeepBySize = getConfig().getBoolean("economy.multiply-upkeep-by-clan-size");
eMemberFee = getConfig().getBoolean("economy.member-fee-enabled");
purgeClan = getConfig().getInt("purge.inactive-clan-days");
purgeUnverified = getConfig().getInt("purge.unverified-clan-days");
purgePlayers = getConfig().getInt("purge.inactive-player-data-days");
@@ -239,6 +257,7 @@ public final class SettingsManager {
pageClanNameColor = getConfig().getString("page.clan-name-color");
bbShowOnLogin = getConfig().getBoolean("bb.show-on-login");
bbSize = getConfig().getInt("bb.size");
bbLoginSize = getConfig().getInt("bb.login-size", bbSize);
bbColor = getConfig().getString("bb.color");
bbAccentColor = getConfig().getString("bb.accent-color");
commandClan = getConfig().getString("commands.clan");
@@ -253,11 +272,14 @@ public final class SettingsManager {
waitSecs = getConfig().getInt("clan.homebase-teleport-wait-secs");
confirmationForPromote = getConfig().getBoolean("clan.confirmation-for-demote");
confirmationForDemote = getConfig().getBoolean("clan.confirmation-for-promote");
percentageOnlineToDemote = getConfig().getDouble("clan.percentage-online-to-demote");
clanTrustByDefault = getConfig().getBoolean("clan.trust-members-by-default");
clanMinSizeToAlly = getConfig().getInt("clan.min-size-to-set-ally");
clanMinSizeToRival = getConfig().getInt("clan.min-size-to-set-rival");
clanMinLength = getConfig().getInt("clan.min-length");
clanMaxLength = getConfig().getInt("clan.max-length");
clanMaxDescriptionLength = getConfig().getInt("clan.max-description-length");
clanMinDescriptionLength = getConfig().getInt("clan.min-description-length");
clanFFOnByDefault = getConfig().getBoolean("clan.ff-on-by-default");
tagMinLength = getConfig().getInt("tag.min-length");
tagMaxLength = getConfig().getInt("tag.max-length");
@@ -300,6 +322,7 @@ public final class SettingsManager {
kwRival = getConfig().getDouble("kill-weights.rival");
kwNeutral = getConfig().getDouble("kill-weights.neutral");
kwCivilian = getConfig().getDouble("kill-weights.civilian");
denySameIPKills = getConfig().getBoolean("kill-weights.deny-same-ip-kills");
useMysql = getConfig().getBoolean("mysql.enable");
host = getConfig().getString("mysql.host");
port = getConfig().getInt("mysql.port");
@@ -388,6 +411,62 @@ public final class SettingsManager {
return word.equalsIgnoreCase("clan") || word.equalsIgnoreCase(commandMore) || word.equalsIgnoreCase(commandDeny) || word.equalsIgnoreCase(commandAccept);
}
/**
* Checks if the upkeep is to be charged only from clans with the member fee enabled
*
* @return
*/
public boolean isChargeUpkeepOnlyIfMemberFeeEnabled() {
return eChargeUpkeepOnlyIfMemberFeeEnabled;
}
/**
* Checks if the upkeep should be multiplied by the clan size
*
* @return
*/
public boolean isMultiplyUpkeepBySize() {
return eMultiplyUpkeepBySize;
}
/**
* Checks if the upkeep is enabled
*
* @return
*/
public boolean isClanUpkeep() {
return eClanUpkeepEnabled;
}
/**
* Returns the upkeep
*
* @return
*/
public double getClanUpkeep() {
if (eClanUpkeep < 0) {
eClanUpkeep = 0;
}
return eClanUpkeep;
}
/**
* Returns the max member fee allowed
* @return
*/
public double getMaxMemberFee() {
return eMaxMemberFee;
}
/**
* Checks if the member fee is enabled
* @return
*/
public boolean isMemberFee() {
return eMemberFee;
}
public boolean isAllowResetKdr() {
return allowResetKdr;
@@ -396,6 +475,23 @@ public final class SettingsManager {
public boolean isePurchaseResetKdr() {
return ePurchaseResetKdr;
}
/**
* Gets the price to pay for setting the member fee
*
* @return the price
*/
public double geteMemberFeeSetPrice() {
return eMemberFeeSetPrice;
}
/**
* Do leaders need to pay for setting the member fee?
* @return true if so
*/
public boolean isePurchaseMemberFeeSet() {
return ePurchaseMemberFeeSet;
}
/**
* Gets the price to reset the KDR
@@ -679,6 +775,13 @@ public final class SettingsManager {
return bbSize;
}
/**
* @return the bbLoginSize
*/
public int getBbLoginSize() {
return bbLoginSize;
}
/**
* @return the bbColor
*/
@@ -734,8 +837,32 @@ public final class SettingsManager {
public int getClanMinSizeToRival() {
return clanMinSizeToRival;
}
/**
* Returns the max length of the clan description
*
* @return the max length
*/
public int getClanMaxDescriptionLength() {
if (clanMaxDescriptionLength > 255 || clanMaxDescriptionLength < 0) {
clanMaxDescriptionLength = 255;
}
return clanMaxDescriptionLength;
}
/**
* Returns the min length of the clan description
*
* @return the min length
*/
public int getClanMinDescriptionLength() {
if (clanMinDescriptionLength < 0 || clanMinDescriptionLength > getClanMaxDescriptionLength()) {
clanMinDescriptionLength = 0;
}
return clanMinDescriptionLength;
}
/**
* @return the clanMinLength
*/
public int getClanMinLength() {
@@ -1068,6 +1195,22 @@ public final class SettingsManager {
public boolean isConfirmationForDemote() {
return confirmationForDemote;
}
/**
* Returns the min percentage of leaders online required to demote someone
*
* @return the percentage
*/
public double getPercentageOnlineToDemote() {
if (percentageOnlineToDemote <= 0 || percentageOnlineToDemote > 100) {
percentageOnlineToDemote = 100;
}
return percentageOnlineToDemote;
}
public boolean isDenySameIPKills() {
return denySameIPKills;
}
public boolean isUseColorCodeFromPrefix() {
return useColorCodeFromPrefix;
@@ -85,21 +85,63 @@ public final class StorageManager {
if (!core.existsTable("sc_clans")) {
SimpleClans.log("Creating table: sc_clans");
String query = "CREATE TABLE IF NOT EXISTS `sc_clans` ( `id` bigint(20) NOT NULL auto_increment, `verified` tinyint(1) default '0', `tag` varchar(25) NOT NULL, `color_tag` varchar(25) NOT NULL, `name` varchar(100) NOT NULL, `friendly_fire` tinyint(1) default '0', `founded` bigint NOT NULL, `last_used` bigint NOT NULL, `packed_allies` text NOT NULL, `packed_rivals` text NOT NULL, `packed_bb` mediumtext NOT NULL, `cape_url` varchar(255) NOT NULL, `flags` text NOT NULL, `balance` double(64,2), PRIMARY KEY (`id`), UNIQUE KEY `uq_simpleclans_1` (`tag`));";
String query = "CREATE TABLE IF NOT EXISTS `sc_clans` ("
+ " `id` bigint(20) NOT NULL auto_increment,"
+ " `verified` tinyint(1) default '0',"
+ " `tag` varchar(25) NOT NULL,"
+ " `color_tag` varchar(25) NOT NULL,"
+ " `name` varchar(100) NOT NULL,"
+ " `description` varchar(255),"
+ " `friendly_fire` tinyint(1) default '0',"
+ " `founded` bigint NOT NULL,"
+ " `last_used` bigint NOT NULL,"
+ " `packed_allies` text NOT NULL,"
+ " `packed_rivals` text NOT NULL,"
+ " `packed_bb` mediumtext NOT NULL,"
+ " `cape_url` varchar(255) NOT NULL,"
+ " `flags` text NOT NULL,"
+ " `balance` double(64,2),"
+ " `fee_enabled` tinyint(1) default '0',"
+ " `fee_value` double(64,2),"
+ " PRIMARY KEY (`id`),"
+ " UNIQUE KEY `uq_simpleclans_1` (`tag`));";
core.execute(query);
}
if (!core.existsTable("sc_players")) {
SimpleClans.log("Creating table: sc_players");
String query = "CREATE TABLE IF NOT EXISTS `sc_players` ( `id` bigint(20) NOT NULL auto_increment, `name` varchar(16) NOT NULL, `leader` tinyint(1) default '0', `tag` varchar(25) NOT NULL, `friendly_fire` tinyint(1) default '0', `neutral_kills` int(11) default NULL, `rival_kills` int(11) default NULL, `civilian_kills` int(11) default NULL, `deaths` int(11) default NULL, `last_seen` bigint NOT NULL, `join_date` bigint NOT NULL, `trusted` tinyint(1) default '0', `flags` text NOT NULL, `packed_past_clans` text, PRIMARY KEY (`id`), UNIQUE KEY `uq_sc_players_1` (`name`));";
String query = "CREATE TABLE IF NOT EXISTS `sc_players` ("
+ " `id` bigint(20) NOT NULL auto_increment,"
+ " `name` varchar(16) NOT NULL,"
+ " `leader` tinyint(1) default '0',"
+ " `tag` varchar(25) NOT NULL,"
+ " `friendly_fire` tinyint(1) default '0',"
+ " `neutral_kills` int(11) default NULL,"
+ " `rival_kills` int(11) default NULL,"
+ " `civilian_kills` int(11) default NULL,"
+ " `deaths` int(11) default NULL,"
+ " `last_seen` bigint NOT NULL,"
+ " `join_date` bigint NOT NULL,"
+ " `trusted` tinyint(1) default '0',"
+ " `flags` text NOT NULL,"
+ " `packed_past_clans` text,"
+ " PRIMARY KEY (`id`),"
+ " UNIQUE KEY `uq_sc_players_1` (`name`));";
core.execute(query);
}
if (!core.existsTable("sc_kills")) {
SimpleClans.log("Creating table: sc_kills");
String query = "CREATE TABLE IF NOT EXISTS `sc_kills` ( `kill_id` bigint(20) NOT NULL auto_increment, `attacker` varchar(16) NOT NULL, `attacker_tag` varchar(16) NOT NULL, `victim` varchar(16) NOT NULL, `victim_tag` varchar(16) NOT NULL, `kill_type` varchar(1) NOT NULL, PRIMARY KEY (`kill_id`));";
String query = "CREATE TABLE IF NOT EXISTS `sc_kills` ("
+ " `kill_id` bigint(20) NOT NULL auto_increment,"
+ " `attacker` varchar(16) NOT NULL,"
+ " `attacker_tag` varchar(16) NOT NULL,"
+ " `victim` varchar(16) NOT NULL,"
+ " `victim_tag` varchar(16) NOT NULL,"
+ " `kill_type` varchar(1) NOT NULL,"
+ " PRIMARY KEY (`kill_id`));";
core.execute(query);
}
} else {
@@ -114,21 +156,63 @@ public final class StorageManager {
if (!core.existsTable("sc_clans")) {
SimpleClans.log("Creating table: sc_clans");
String query = "CREATE TABLE IF NOT EXISTS `sc_clans` ( `id` bigint(20), `verified` tinyint(1) default '0', `tag` varchar(25) NOT NULL, `color_tag` varchar(25) NOT NULL, `name` varchar(100) NOT NULL, `friendly_fire` tinyint(1) default '0', `founded` bigint NOT NULL, `last_used` bigint NOT NULL, `packed_allies` text NOT NULL, `packed_rivals` text NOT NULL, `packed_bb` mediumtext NOT NULL, `cape_url` varchar(255) NOT NULL, `flags` text NOT NULL, `balance` double(64,2) default 0.0, PRIMARY KEY (`id`), UNIQUE (`tag`));";
String query = "CREATE TABLE IF NOT EXISTS `sc_clans` ("
+ " `id` bigint(20),"
+ " `verified` tinyint(1) default '0',"
+ " `tag` varchar(25) NOT NULL,"
+ " `color_tag` varchar(25) NOT NULL,"
+ " `name` varchar(100) NOT NULL,"
+ " `description` varchar(255),"
+ " `friendly_fire` tinyint(1) default '0',"
+ " `founded` bigint NOT NULL,"
+ " `last_used` bigint NOT NULL,"
+ " `packed_allies` text NOT NULL,"
+ " `packed_rivals` text NOT NULL,"
+ " `packed_bb` mediumtext NOT NULL,"
+ " `cape_url` varchar(255) NOT NULL,"
+ " `flags` text NOT NULL,"
+ " `balance` double(64,2) default 0.0,"
+ " `fee_enabled` tinyint(1) default '0',"
+ " `fee_value` double(64,2),"
+ " PRIMARY KEY (`id`),"
+ " UNIQUE (`tag`));";
core.execute(query);
}
if (!core.existsTable("sc_players")) {
SimpleClans.log("Creating table: sc_players");
String query = "CREATE TABLE IF NOT EXISTS `sc_players` ( `id` bigint(20), `name` varchar(16) NOT NULL, `leader` tinyint(1) default '0', `tag` varchar(25) NOT NULL, `friendly_fire` tinyint(1) default '0', `neutral_kills` int(11) default NULL, `rival_kills` int(11) default NULL, `civilian_kills` int(11) default NULL, `deaths` int(11) default NULL, `last_seen` bigint NOT NULL, `join_date` bigint NOT NULL, `trusted` tinyint(1) default '0', `flags` text NOT NULL, `packed_past_clans` text, PRIMARY KEY (`id`), UNIQUE (`name`));";
String query = "CREATE TABLE IF NOT EXISTS `sc_players` ("
+ " `id` bigint(20),"
+ " `name` varchar(16) NOT NULL,"
+ " `leader` tinyint(1) default '0',"
+ " `tag` varchar(25) NOT NULL,"
+ " `friendly_fire` tinyint(1) default '0',"
+ " `neutral_kills` int(11) default NULL,"
+ " `rival_kills` int(11) default NULL,"
+ " `civilian_kills` int(11) default NULL,"
+ " `deaths` int(11) default NULL,"
+ " `last_seen` bigint NOT NULL,"
+ " `join_date` bigint NOT NULL,"
+ " `trusted` tinyint(1) default '0',"
+ " `flags` text NOT NULL,"
+ " `packed_past_clans` text,"
+ " PRIMARY KEY (`id`),"
+ " UNIQUE (`name`));";
core.execute(query);
}
if (!core.existsTable("sc_kills")) {
SimpleClans.log("Creating table: sc_kills");
String query = "CREATE TABLE IF NOT EXISTS `sc_kills` ( `kill_id` bigint(20), `attacker` varchar(16) NOT NULL, `attacker_tag` varchar(16) NOT NULL, `victim` varchar(16) NOT NULL, `victim_tag` varchar(16) NOT NULL, `kill_type` varchar(1) NOT NULL, PRIMARY KEY (`kill_id`));";
String query = "CREATE TABLE IF NOT EXISTS `sc_kills` ("
+ " `kill_id` bigint(20),"
+ " `attacker` varchar(16) NOT NULL,"
+ " `attacker_tag` varchar(16) NOT NULL,"
+ " `victim` varchar(16) NOT NULL,"
+ " `victim_tag` varchar(16) NOT NULL,"
+ " `kill_type` varchar(1) NOT NULL,"
+ " PRIMARY KEY (`kill_id`));";
core.execute(query);
}
} else {
@@ -263,6 +347,7 @@ public final class StorageManager {
String tag = res.getString("tag");
String color_tag = Helper.parseColors(res.getString("color_tag"));
String name = res.getString("name");
String description = res.getString("description");
String packed_allies = res.getString("packed_allies");
String packed_rivals = res.getString("packed_rivals");
String packed_bb = res.getString("packed_bb");
@@ -271,6 +356,8 @@ public final class StorageManager {
long founded = res.getLong("founded");
long last_used = res.getLong("last_used");
double balance = res.getDouble("balance");
double feeValue = res.getDouble("fee_value");
boolean feeEnabled = res.getBoolean("fee_enabled");
if (founded == 0) {
founded = (new Date()).getTime();
@@ -287,6 +374,7 @@ public final class StorageManager {
clan.setTag(tag);
clan.setColorTag(color_tag);
clan.setName(name);
clan.setDescription(description);
clan.setPackedAllies(packed_allies);
clan.setPackedRivals(packed_rivals);
clan.setPackedBb(packed_bb);
@@ -294,6 +382,8 @@ public final class StorageManager {
clan.setFounded(founded);
clan.setLastUsed(last_used);
clan.setBalance(balance);
clan.setMemberFee(feeValue);
clan.setMemberFeeEnabled(feeEnabled);
out.add(clan);
} catch (Exception ex) {
@@ -333,6 +423,7 @@ public final class StorageManager {
String tag = res.getString("tag");
String color_tag = Helper.parseColors(res.getString("color_tag"));
String name = res.getString("name");
String description = res.getString("description");
String packed_allies = res.getString("packed_allies");
String packed_rivals = res.getString("packed_rivals");
String packed_bb = res.getString("packed_bb");
@@ -341,6 +432,8 @@ public final class StorageManager {
long founded = res.getLong("founded");
long last_used = res.getLong("last_used");
double balance = res.getDouble("balance");
double feeValue = res.getDouble("fee_value");
boolean feeEnabled = res.getBoolean("fee_enabled");
if (founded == 0) {
founded = (new Date()).getTime();
@@ -357,6 +450,7 @@ public final class StorageManager {
clan.setTag(tag);
clan.setColorTag(color_tag);
clan.setName(name);
clan.setDescription(description);
clan.setPackedAllies(packed_allies);
clan.setPackedRivals(packed_rivals);
clan.setPackedBb(packed_bb);
@@ -364,6 +458,8 @@ public final class StorageManager {
clan.setFounded(founded);
clan.setLastUsed(last_used);
clan.setBalance(balance);
clan.setMemberFee(feeValue);
clan.setMemberFeeEnabled(feeEnabled);
out = clan;
} catch (Exception ex) {
@@ -567,8 +663,8 @@ public final class StorageManager {
* @param clan
*/
public void insertClan(Clan clan) {
String query = "INSERT INTO `sc_clans` ( `verified`, `tag`, `color_tag`, `name`, `friendly_fire`, `founded`, `last_used`, `packed_allies`, `packed_rivals`, `packed_bb`, `cape_url`, `flags`, `balance`) ";
String values = "VALUES ( " + (clan.isVerified() ? 1 : 0) + ",'" + Helper.escapeQuotes(clan.getTag()) + "','" + Helper.escapeQuotes(clan.getColorTag()) + "','" + Helper.escapeQuotes(clan.getName()) + "'," + (clan.isFriendlyFire() ? 1 : 0) + ",'" + clan.getFounded() + "','" + clan.getLastUsed() + "','" + Helper.escapeQuotes(clan.getPackedAllies()) + "','" + Helper.escapeQuotes(clan.getPackedRivals()) + "','" + Helper.escapeQuotes(clan.getPackedBb()) + "','" + Helper.escapeQuotes(clan.getCapeUrl()) + "','" + Helper.escapeQuotes(clan.getFlags()) + "','" + Helper.escapeQuotes(String.valueOf(clan.getBalance())) + "');";
String query = "INSERT INTO `sc_clans` (`description`, `fee_enabled`, `fee_value`, `verified`, `tag`, `color_tag`, `name`, `friendly_fire`, `founded`, `last_used`, `packed_allies`, `packed_rivals`, `packed_bb`, `cape_url`, `flags`, `balance`) ";
String values = "VALUES ( '" + Helper.escapeQuotes(clan.getDescription()) + "'," + (clan.isMemberFeeEnabled() ? 1 : 0) +","+ Helper.escapeQuotes(String.valueOf(clan.getMemberFee())) + "," + (clan.isVerified() ? 1 : 0) + ",'" + Helper.escapeQuotes(clan.getTag()) + "','" + Helper.escapeQuotes(clan.getColorTag()) + "','" + Helper.escapeQuotes(clan.getName()) + "'," + (clan.isFriendlyFire() ? 1 : 0) + ",'" + clan.getFounded() + "','" + clan.getLastUsed() + "','" + Helper.escapeQuotes(clan.getPackedAllies()) + "','" + Helper.escapeQuotes(clan.getPackedRivals()) + "','" + Helper.escapeQuotes(clan.getPackedBb()) + "','" + Helper.escapeQuotes(clan.getCapeUrl()) + "','" + Helper.escapeQuotes(clan.getFlags()) + "','" + Helper.escapeQuotes(String.valueOf(clan.getBalance())) + "');";
core.insert(query + values);
}
@@ -618,9 +714,7 @@ public final class StorageManager {
* @param clan
*/
public void updateClan(Clan clan) {
clan.updateLastUsed();
String query = "UPDATE `sc_clans` SET verified = " + (clan.isVerified() ? 1 : 0) + ", tag = '" + Helper.escapeQuotes(clan.getTag()) + "', color_tag = '" + Helper.escapeQuotes(clan.getColorTag()) + "', name = '" + Helper.escapeQuotes(clan.getName()) + "', friendly_fire = " + (clan.isFriendlyFire() ? 1 : 0) + ", founded = '" + clan.getFounded() + "', last_used = '" + clan.getLastUsed() + "', packed_allies = '" + Helper.escapeQuotes(clan.getPackedAllies()) + "', packed_rivals = '" + Helper.escapeQuotes(clan.getPackedRivals()) + "', packed_bb = '" + Helper.escapeQuotes(clan.getPackedBb()) + "', cape_url = '" + Helper.escapeQuotes(clan.getCapeUrl()) + "', cape_url = '" + Helper.escapeQuotes(String.valueOf(clan.getCapeUrl())) + "', balance = '" + clan.getBalance() + "', flags = '" + Helper.escapeQuotes(clan.getFlags()) + "' WHERE tag = '" + Helper.escapeQuotes(clan.getTag()) + "';";
core.update(query);
updateClan(clan, true);
}
/**
@@ -633,8 +727,8 @@ public final class StorageManager {
public void updateClan(Clan clan, boolean updateLastUsed) {
if (updateLastUsed) {
clan.updateLastUsed();
}
String query = "UPDATE `sc_clans` SET verified = " + (clan.isVerified() ? 1 : 0) + ", tag = '" + Helper.escapeQuotes(clan.getTag()) + "', color_tag = '" + Helper.escapeQuotes(clan.getColorTag()) + "', name = '" + Helper.escapeQuotes(clan.getName()) + "', friendly_fire = " + (clan.isFriendlyFire() ? 1 : 0) + ", founded = '" + clan.getFounded() + "', last_used = '" + clan.getLastUsed() + "', packed_allies = '" + Helper.escapeQuotes(clan.getPackedAllies()) + "', packed_rivals = '" + Helper.escapeQuotes(clan.getPackedRivals()) + "', packed_bb = '" + Helper.escapeQuotes(clan.getPackedBb()) + "', cape_url = '" + Helper.escapeQuotes(clan.getCapeUrl()) + "', cape_url = '" + Helper.escapeQuotes(String.valueOf(clan.getCapeUrl())) + "', balance = '" + clan.getBalance() + "', flags = '" + Helper.escapeQuotes(clan.getFlags()) + "' WHERE tag = '" + Helper.escapeQuotes(clan.getTag()) + "';";
}
String query = "UPDATE `sc_clans` SET description = '" + Helper.escapeQuotes(clan.getDescription())+ "', fee_enabled = "+ (clan.isMemberFeeEnabled() ? 1 : 0) +", fee_value = '" + clan.getMemberFee() + "', verified = " + (clan.isVerified() ? 1 : 0) + ", tag = '" + Helper.escapeQuotes(clan.getTag()) + "', color_tag = '" + Helper.escapeQuotes(clan.getColorTag()) + "', name = '" + Helper.escapeQuotes(clan.getName()) + "', friendly_fire = " + (clan.isFriendlyFire() ? 1 : 0) + ", founded = '" + clan.getFounded() + "', last_used = '" + clan.getLastUsed() + "', packed_allies = '" + Helper.escapeQuotes(clan.getPackedAllies()) + "', packed_rivals = '" + Helper.escapeQuotes(clan.getPackedRivals()) + "', packed_bb = '" + Helper.escapeQuotes(clan.getPackedBb()) + "', cape_url = '" + Helper.escapeQuotes(clan.getCapeUrl()) + "', cape_url = '" + Helper.escapeQuotes(String.valueOf(clan.getCapeUrl())) + "', balance = '" + clan.getBalance() + "', flags = '" + Helper.escapeQuotes(clan.getFlags()) + "' WHERE tag = '" + Helper.escapeQuotes(clan.getTag()) + "';";
core.update(query);
}
@@ -702,6 +796,11 @@ public final class StorageManager {
* @param cp
*/
public void deleteClanPlayer(ClanPlayer cp) {
final Clan clan = cp.getClan();
if (clan != null) {
clan.addBbWithoutSaving(ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.been.purged"), cp.getName()));
updateClan(clan, false);
}
if (SimpleClans.getInstance().hasUUID()) {
String query = "DELETE FROM `sc_players` WHERE uuid = '" + cp.getUniqueId() + "';";
core.delete(query);
@@ -838,6 +937,26 @@ public final class StorageManager {
query = "ALTER TABLE sc_clans ADD COLUMN `balance` double(64,2);";
core.execute(query);
}
/**
* From 2.7.16 to 2.7.17
*/
if (!core.existsColumn("sc_clans", "fee_enabled")) {
query = "ALTER TABLE sc_clans ADD COLUMN `fee_enabled` tinyint(1) default '0';";
core.execute(query);
}
if (!core.existsColumn("sc_clans", "fee_value")) {
query = "ALTER TABLE sc_clans ADD COLUMN `fee_value` double(64,2);";
core.execute(query);
}
/**
* From 2.7.21 to 2.7.22
*/
if (!core.existsColumn("sc_clans", "description")) {
query = "ALTER TABLE sc_clans ADD COLUMN `description` varchar(255);";
core.execute(query);
}
/**
* Bukkit 1.7.5+ UUID Migration
@@ -0,0 +1,63 @@
package net.sacredlabyrinth.phaed.simpleclans.tasks;
import java.text.MessageFormat;
import net.md_5.bungee.api.ChatColor;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.scheduler.BukkitRunnable;
/**
*
* @author roinujnosde
*/
public class CollectFeeTask extends BukkitRunnable {
/**
* Starts the repetitive task
*/
public void start() {
long delay = Helper.getDelayTo(1, 0);
this.runTaskTimerAsynchronously(SimpleClans.getInstance(), delay * 20, 86400 * 20);
}
/**
* (used internally)
*/
@Override
public void run() {
final SimpleClans plugin = SimpleClans.getInstance();
for (Clan clan : plugin.getClanManager().getClans()) {
final double memberFee = clan.getMemberFee();
if (clan.isMemberFeeEnabled() && memberFee > 0) {
for (ClanPlayer cp : clan.getNonLeaders()) {
final boolean success = plugin.getPermissionsManager().playerChargeMoney(cp.getName(), memberFee);
new BukkitRunnable() {
@Override
public void run() {
if (success) {
ChatBlock.sendMessage(cp.toPlayer(), ChatColor.AQUA +
MessageFormat.format(plugin.getLang("fee.collected"), memberFee));
clan.setBalance(clan.getBalance() + memberFee);
plugin.getStorageManager().updateClanAsync(clan);
} else {
if (plugin.hasUUID()) {
clan.removePlayerFromClan(cp.getUniqueId());
} else {
clan.removePlayerFromClan(cp.getName());
}
clan.addBb(ChatColor.AQUA +
MessageFormat.format(plugin.getLang("bb.fee.player.kicked"), cp.getName()));
}
}
}.runTask(plugin);
}
}
}
}
}
@@ -0,0 +1,50 @@
package net.sacredlabyrinth.phaed.simpleclans.tasks;
import java.text.MessageFormat;
import net.md_5.bungee.api.ChatColor;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import org.bukkit.scheduler.BukkitRunnable;
/**
*
* @author roinujnosde
*/
public class CollectUpkeepTask extends BukkitRunnable {
/**
* Starts the repetitive task
*/
public void start() {
long delay = Helper.getDelayTo(1, 30);
this.runTaskTimerAsynchronously(SimpleClans.getInstance(), delay * 20, 86400 * 20);
}
/**
* (used internally)
*/
@Override
public void run() {
final SimpleClans plugin = SimpleClans.getInstance();
final SettingsManager settingsManager = plugin.getSettingsManager();
plugin.getClanManager().getClans().forEach((clan) -> {
if (settingsManager.isChargeUpkeepOnlyIfMemberFeeEnabled() && !clan.isMemberFeeEnabled()) {
return;
}
double upkeep = settingsManager.getClanUpkeep();
if (settingsManager.isMultiplyUpkeepBySize()) {
upkeep = upkeep * clan.getSize();
}
final double balance = clan.getBalance();
if (balance >= upkeep) {
clan.setBalance(balance - upkeep);
clan.addBb(ChatColor.AQUA + MessageFormat.format(plugin.getLang("upkeep.collected"), upkeep), false);
} else {
clan.disband();
}
});
}
}
@@ -0,0 +1,47 @@
package net.sacredlabyrinth.phaed.simpleclans.tasks;
import java.text.MessageFormat;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import org.bukkit.scheduler.BukkitRunnable;
/**
*
* @author roinujnosde
*/
public class UpkeepWarningTask extends BukkitRunnable {
/**
* Starts the repetitive task
*
*/
public void start() {
long delay = Helper.getDelayTo(12, 0);
this.runTaskTimerAsynchronously(SimpleClans.getInstance(), delay * 20, 86400 * 20);
}
/**
* (used internally)
*/
@Override
public void run() {
final SimpleClans plugin = SimpleClans.getInstance();
final SettingsManager sm = plugin.getSettingsManager();
plugin.getClanManager().getClans().forEach((clan) -> {
if (sm.isChargeUpkeepOnlyIfMemberFeeEnabled() && !clan.isMemberFeeEnabled()) {
return;
}
final double balance = clan.getBalance();
double upkeep = sm.getClanUpkeep();
if (sm.isMultiplyUpkeepBySize()) {
upkeep = upkeep * clan.getSize();
}
if (balance < upkeep) {
clan.addBb(MessageFormat.format(plugin.getLang("balance.is.not.enough.for.upkeep"), upkeep), false);
}
});
}
}
+13
View File
@@ -73,19 +73,31 @@ economy:
money-per-kill-kdr-multipier: 10
purchase-reset-kdr: true
reset-kdr-price: 10000.0
purchase-member-fee-set: false
member-fee-set-price: 1000.0
member-fee-enabled: false
max-member-fee: 200.0
upkeep: 200.0
upkeep-enabled: false
multiply-upkeep-by-clan-size: false
charge-upkeep-only-if-member-fee-enabled: true
kill-weights:
rival: 2.0
civilian: 0.0
neutral: 1.0
deny-same-ip-kills: false
clan:
homebase-teleport-wait-secs: 10
homebase-can-be-set-only-once: true
min-size-to-set-rival: 3
max-length: 25
max-description-length: 120
min-description-length: 10
max-members: 25
confirmation-for-promote: false
trust-members-by-default: false
confirmation-for-demote: false
percentage-online-to-demote: 100.0
ff-on-by-default: false
min-length: 2
min-size-to-set-ally: 3
@@ -115,6 +127,7 @@ bb:
accent-color: '8'
show-on-login: true
size: 6
login-size: 6
allychat:
enable: true
format: "&b[Ally Chat] &4<%clan%&4> <%nick-color%%player%&4> %rank%: &b%message%"
+48 -1
View File
@@ -1,3 +1,4 @@
description.command: "description"
create.command: "criar"
list.command: "listar"
profile.command: "perfil"
@@ -18,6 +19,8 @@ toggle.command: "alternar"
invite.command: "convidar"
kick.command: "expulsar"
bank.command: "banco"
fee.command: "fee"
purge.command: "purge"
trust.command: "confiar"
untrust.command: "naoconfiar"
promote.command: "promover"
@@ -38,6 +41,7 @@ home.command: "casa"
setrank.command: "definirrank"
place.command: "colocar"
resetkdr.command: "redefinirkdr"
usage.description: "Usage: /{0} description [description]"
usage.resetkdr: "Usage: /{0} resetkdr [all/player]" #TODO: from here, to the bottom
usage.clan.alliances: "Usage: /{0} alliances"
usage.ally: "Usage: /{0} ally add/remove [tag]"
@@ -57,6 +61,8 @@ usage.0.permissions.player: "Usage: /{0} permissions [clan] add/remove [permissi
usage.0.invite.player: "Usage: /{0} invite [player]"
usage.kick.player: "Usage: /{0} kick [player]"
usage.bank: "Usage: /{0} bank withdraw/deposit/status [amount]"
usage.fee: "Usage: /{0} fee check/set [amount]"
usage.purge: "Usage: /{0} purge [player]"
usage.0.modtag.tag: "Usage: /{0} modtag [tag]"
usage.list: "Usage: /{0} list"
usage.lookup.tag: "Usage: /{0} lookup [tag]"
@@ -79,6 +85,7 @@ usage.0.leaderboard: "Usage: /{0} leaderboard"
0.disband.tag.1.disband.a.clan: "/{0} disband [tag]{1} - Disband a clan"
0.resetkdr.1.resets.kdr: "/{0} resetkdr player/all{1} - Reset KDR of all players or just of one"
0.resetkdr.1.resets.your.kdr: "/{0} resetkdr{1} - Reset your KDR"
0.purge.player.1.purge.a.player: "/{0} purge [player]{1} - Purge a player"
0.verify.tag.1.verify.an.unverified.clan: "/{0} verify [tag]{1} - Verify an unverified clan"
0.verify.1.purchase.verification.of.your.clan: "/{0} verify{1} - Purchase verification of your clan"
0.list.1.lists.all.clans: "/{0} list{1} - Lists all clans"
@@ -97,6 +104,7 @@ usage.0.leaderboard: "Usage: /{0} leaderboard"
0.ally.add.remove.tag.1.add.remove.an.ally.clan: "/{0} ally add/remove [tag]{1} - Add/remove an ally clan"
0.rival.add.remove.tag.1.add.remove.a.rival.clan: "/{0} rival add/remove [tag]{1} - Add/remove a rival clan"
0.bb.1.display.bulletin.board: "/{0} bb{1} - Display bulletin board"
0.description.description.1.modify.the.clan.s.description: "/{0} description [description]{1} - Modify the clan''s description"
0.bb.msg.1.add.a.message.to.the.bulletin.board: "/{0} bb [msg]{1} - Add a message to the bulletin board"
0.modtag.tag.1.modify.the.clan.s.tag: "/{0} modtag [tag]{1} - Modify the clan''s tag"
0.cape.url.1.change.your.clan.s.cape: "/{0} cape [url]{1} - Change your clan''s cape"
@@ -116,6 +124,8 @@ usage.0.leaderboard: "Usage: /{0} leaderboard"
0.create.tag.name.1.create.a.new.clan: "/{0} create [tag] [name]{1} - Create a new clan"
0.kills: "/{0} kills{1} - View your kill counts"
0.killsplayer: "/{0} kills [player]{1} - View a player''s kill counts"
0.fee.check: "/{0} fee check {1}- Check if the fee is enabled and how much is it"
0.fee.set: "/{0} fee set [amount]{1} - Set the clan's member fee"
0.mostkilled: "/{0} mostkilled{1} - View serverwide most killed counts"
home-menu: "/{0} home{1} - Teleport to clan home-base"
home-set-menu: "/{0} home set{1} - Set the clan''s home base"
@@ -260,6 +270,7 @@ you.must.first.resign: "You must first resign from {0}"
clan.with.this.tag.already.exists: "A clan with this tag already exists"
get.your.clan.verified.to.access.advanced.features: "Get your clan verified to access advanced features"
clan.created: "Clan {0} created"
not.enough.leaders.online.to.vote.on.demotion: "There aren''t enough leaders online to vote on this demotion"
leaders.must.be.online.to.vote.on.demotion: "All leaders other than the demoted must be online to vote on this demotion"
demotion.vote.has.been.requested.from.all.leaders: "Demotion vote has been requested from all leaders"
player.is.not.a.leader.of.your.clan: "The player is not a leader of your clan"
@@ -293,6 +304,7 @@ status.0: "Status: {0}"
rank.0: "Rank: {0}"
kdr.0: "KDR: {0}"
deaths.0: "Deaths: {0}"
fee.0.value.1: "Fee: {0}, {1} $"
join.date.0: "Join Date: {0}"
last.seen.0: "Last Seen: {0}"
past.clans.0: "Past Clans: {0}"
@@ -302,6 +314,7 @@ clan.commands: "clan commands"
you.can.only.modify.the.color.and.case.of.the.tag: "You can only modify the color and case of the tag"
tag.changed.to.0: "Tag changed to {0}"
name.0: "Name: {0}"
description.0: "Description: {0}"
leaders.0: "Leaders: {0}"
members.online.0: "Members Online: {0}"
allies.0: "Allies: {0}"
@@ -384,6 +397,8 @@ depositon: "Deposit toggled on"
depositoff: "Deposit toggled off"
withdrawon: "Withdraw toggled on"
withdrawoff: "Withdraw toggled off"
feeoff: "Fee toggled off"
feeon: "Fee toggled on"
home.base.only.once: "Home base can only be set once"
now.at.homebase: "You are now at {0}''s home base"
hombase.set: "Clan home-base set to: {0}"
@@ -404,6 +419,8 @@ your.clans.are.already.rivals: "Your clans are already rivals"
player.got.money: "You got {0} for killing {1} based on you KDR: {2}"
cleared.bb: "Cleared the bulletin board"
clan.balance: "Clan-Balance: {0}"
bb.fee.player.kicked: "{0} was kicked for not paying the fee"
bb.fee.set: "{0} $ is the fee"
bb.clan.deposit: "{0} $ were deposited"
player.clan.deposit: "You deposited {0}"
bb.clan.withdraw: "{0} $ were withdrawn"
@@ -414,4 +431,34 @@ you.cannot.rival.your.own.clan: "You cannot rival your own clan"
the.clan.members.reached.limit: "Your clan members reached limit"
you.have.reseted.your.kdr: "You have reseted your KDR"
you.have.reseted.0.kdr: "You have reseted {0}''s KDR"
you.have.reseted.kdr.of.all.players: "You have reseted the KDR of all players"
you.have.reseted.kdr.of.all.players: "You have reseted the KDR of all players"
resign.yes: "Yes"
resign.no: "No"
resign.confirmation: "Are you sure you want to resign? {0}"
resign.success: "You have successfully resigned from your clan"
player.is.not.a.leader.of.any.clan: "The player is not a leader of any clan"
you.cannot.demote.the.last.leader: "You cannot demote the last leader"
player.successfully.demoted: "The player was successfully demoted"
bb.ago: " ago "
bb.moments: "moments"
bb.seconds: " seconds"
bb.minutes: " minutes"
bb.one.minute: "1 minute"
bb.hours: " hours"
bb.one.hour: "1 hour"
bb.days: " days"
bb.one.day: "1 day"
the.fee.is.0.and.its.current.value.is.1: "The fee is {0} and the its current value is {1} $"
fee.enabled: "enabled"
fee.disabled: "disabled"
fee.set: "The fee was successfully set"
max.fee.allowed.is.0: "Max fee allowed is {0}"
fee.collected: "{0} $ were withdrawn for the clan fee"
invalid.fee: "The value you inserted is not valid"
player.purged: "The player was successfully purged"
upkeep.collected: "{0} $ were withdrawn for the upkeep"
balance.is.not.enough.for.upkeep: "The clan balance is not enough for paying the upkeep ({0} $), deposit the amount to avoid being disbanded"
your.clan.description.must.be.longer.than: "Your clan description must be longer than {0} characters"
your.clan.description.cannot.be.longer.than: "Your clan description cannot be longer than {0} characters"
description.changed: "You have successfully changed your clan's description"
no.description: "No description"
+47
View File
@@ -1,3 +1,4 @@
description.command: "description"
create.command: "create"
list.command: "list"
profile.command: "profile"
@@ -18,6 +19,8 @@ toggle.command: "toggle"
invite.command: "invite"
kick.command: "kick"
bank.command: "bank"
fee.command: "fee"
purge.command: "purge"
trust.command: "trust"
untrust.command: "untrust"
promote.command: "promote"
@@ -38,6 +41,7 @@ home.command: "home"
setrank.command: "setrank"
place.command: "place"
resetkdr.command: "resetkdr"
usage.description: "Usage: /{0} description [description]"
usage.resetkdr: "Használat: /{0} resetkdr [all/player]"
usage.clan.alliances: "Használat: /{0} alliances"
usage.ally: "Használat: /{0} ally add/remove [címke]"
@@ -57,6 +61,8 @@ usage.0.permissions.player: "Használat: /{0} permissions [klán] add/remove [jo
usage.0.invite.player: "Használat: /{0} invite [játékos]"
usage.kick.player: "Használat: /{0} kick [játékos]"
usage.bank: "Használat: /{0} bank withdraw/deposit/status [mennyiség]"
usage.fee: "Usage: /{0} fee check/set [amount]"
usage.purge: "Usage: /{0} purge [player]"
usage.0.modtag.tag: "Használat: /{0} modtag [címke]"
usage.list: "Használat: /{0} list"
usage.lookup.tag: "Használat: /{0} lookup [címke]"
@@ -79,6 +85,7 @@ usage.0.leaderboard: "Használat: /{0} leaderboard"
0.disband.tag.1.disband.a.clan: "/{0} disband [címke]{1} - Eltávolít egy klánt"
0.resetkdr.1.resets.kdr: "/{0} resetkdr player/all{1} - Visszaállítsa az összes játékos KDR-jét vagy csak egy"
0.resetkdr.1.resets.your.kdr: "/{0} resetkdr{1} - Visszaállítja KDR-t"
0.purge.player.1.purge.a.player: "/{0} purge [player]{1} - Purge a player"
0.verify.tag.1.verify.an.unverified.clan: "/{0} verify [címke]{1} - Ellenőrzi az ellenőrzött klánt"
0.verify.1.purchase.verification.of.your.clan: "/{0} verify{1} - A klán megvásárlásának ellenőrzése"
0.list.1.lists.all.clans: "/{0} list{1} - Az összes klán felsorolása"
@@ -98,6 +105,7 @@ usage.0.leaderboard: "Használat: /{0} leaderboard"
0.rival.add.remove.tag.1.add.remove.a.rival.clan: "/{0} rival add/remove [címke]{1} - Egy rivális klán hozzáadása/eltávolítása"
0.bb.1.display.bulletin.board: "/{0} bb{1} - Hirdetőtábla megjelenítése"
0.bb.msg.1.add.a.message.to.the.bulletin.board: "/{0} bb [msg]{1} - Üzenet hozzáadása a hirdetőtáblához"
0.description.description.1.modify.the.clan.s.description: "/{0} description [description]{1} - Modify the clan''s description"
0.modtag.tag.1.modify.the.clan.s.tag: "/{0} modtag [címke]{1} - Módosítja a klán címkéjét"
0.cape.url.1.change.your.clan.s.cape: "/{0} cape [url]{1} - Megváltoztatja a klánodat"
0.invite.player.1.invite.a.player: "/{0} invite [játékos]{1} - Meghív egy játékost"
@@ -116,6 +124,8 @@ usage.0.leaderboard: "Használat: /{0} leaderboard"
0.create.tag.name.1.create.a.new.clan: "/{0} create [címke] [name]{1} - Létrehoz egy új klánt"
0.kills: "/{0} kills{1} - Megnézi az ölésedet"
0.killsplayer: "/{0} kills [játékos]{1} - Megtekinti a játékos ölési számát"
0.fee.check: "/{0} fee check {1}- Check if the fee is enabled and how much is it"
0.fee.set: "/{0} fee set [amount]{1} - Set the clan's member fee"
0.mostkilled: "/{0} mostkilled{1} - Megtekinti a kiszolgálón leggyakoribb ölési számokat"
home-menu: "/{0} home{1} - Teleportálás a klán hazai bázisához"
home-set-menu: "/{0} home set{1} - Beállítsa a klán hazai bázisát"
@@ -260,6 +270,7 @@ you.must.first.resign: "Először lemondania a {0}"
clan.with.this.tag.already.exists: "Ezzel a címkével már létezik egy klán"
get.your.clan.verified.to.access.advanced.features: "Szerezd meg a klánt, hogy ellenőrizze a speciális funkciók elérését"
clan.created: "A(z) {0} klán létrehozva"
not.enough.leaders.online.to.vote.on.demotion: "There aren''t enough leaders online to vote on this demotion"
leaders.must.be.online.to.vote.on.demotion: "A lefokozástól eltérő összes vezetőnek online kell lennie ahhoz, hogy szavazzon a lefokozásról"
demotion.vote.has.been.requested.from.all.leaders: "Demotion szavazást kértek minden vezetőtől"
player.is.not.a.leader.of.your.clan: "A játékos nem a klán egyik vezetője"
@@ -293,6 +304,7 @@ status.0: "Állapot: {0}"
rank.0: "Rang: {0}"
kdr.0: "KDR: {0}"
deaths.0: "Halálok: {0}"
fee.0.value.1: "Fee: {0}, {1} $"
join.date.0: "Csatlakozás dátuma: {0}"
last.seen.0: "Utoljára látva: {0}"
past.clans.0: "Múlt klánok: {0}"
@@ -302,6 +314,7 @@ clan.commands: "klán parancsok"
you.can.only.modify.the.color.and.case.of.the.tag: "Csak a címke színét és esetét módosíthatod"
tag.changed.to.0: "A címke megváltoztatva {0}"
name.0: "Név: {0}"
description.0: "Description: {0}"
leaders.0: "Vezetők: {0}"
members.online.0: "Tagok online: {0}"
allies.0: "Szövetségesek: {0}"
@@ -384,6 +397,8 @@ depositon: "Letét bekapcsolva"
depositoff: "Letét kikapcsolva"
withdrawon: "Visszavonulás bekapcsolva"
withdrawoff: "Visszavonulás kikapcsolva"
feeoff: "Fee toggled off"
feeon: "Fee toggled on"
home.base.only.once: "A bázis csak egyszer állítható be"
now.at.homebase: "Most a(z) {0} székhelyen tartózkodsz"
hombase.set: "Klán bázis beállítva: {0}"
@@ -404,6 +419,8 @@ your.clans.are.already.rivals: "A klánod már riválisok"
player.got.money: "Megkaptad {0} a(z) {1} megöléséért KDR-ed alapján: {2}"
cleared.bb: "Törölte a hirdetőtáblát"
clan.balance: "Klán egyenleg: {0}"
bb.fee.player.kicked: "{0} was kicked for not paying the fee"
bb.fee.set: "{0} $ is the fee"
bb.clan.deposit: "{0} $ letétbe helyezték"
player.clan.deposit: "Letétbe helyezted {0}"
bb.clan.withdraw: "{0} $ visszavonták"
@@ -415,3 +432,33 @@ the.clan.members.reached.limit: "A klán tagjai elérik a határt"
you.have.reseted.your.kdr: "Visszaállítottad KDR-t"
you.have.reseted.0.kdr: "Visszaállítottad a(z) {0} KDR-t"
you.have.reseted.kdr.of.all.players: "Visszaállítottad a játékosok KDR-jét"
resign.yes: "Yes"
resign.no: "No"
resign.confirmation: "Are you sure you want to resign? {0}"
resign.success: "You have successfully resigned from your clan"
player.is.not.a.leader.of.any.clan: "The player is not a leader of any clan"
you.cannot.demote.the.last.leader: "You cannot demote the last leader"
player.successfully.demoted: "The player was successfully demoted"
bb.ago: " ago "
bb.moments: "moments"
bb.seconds: " seconds"
bb.minutes: " minutes"
bb.one.minute: "1 minute"
bb.hours: " hours"
bb.one.hour: "1 hour"
bb.days: " days"
bb.one.day: "1 day"
the.fee.is.0.and.its.current.value.is.1: "The fee is {0} and the its current value is {1} $"
fee.enabled: "enabled"
fee.disabled: "disabled"
fee.set: "The fee was successfully set"
max.fee.allowed.is.0: "Max fee allowed is {0}"
fee.collected: "{0} $ were withdrawn for the clan fee"
invalid.fee: "The value you inserted is not valid"
player.purged: "The player was successfully purged"
upkeep.collected: "{0} $ were withdrawn for the upkeep"
balance.is.not.enough.for.upkeep: "The clan balance is not enough for paying the upkeep ({0} $), deposit the amount to avoid being disbanded"
your.clan.description.must.be.longer.than: "Your clan description must be longer than {0} characters"
your.clan.description.cannot.be.longer.than: "Your clan description cannot be longer than {0} characters"
description.changed: "You have successfully changed your clan's description"
no.description: "No description"
+62 -1
View File
@@ -1,3 +1,4 @@
description.command: "description"
create.command: "创建"
list.command: "列表"
profile.command: "信息"
@@ -18,6 +19,8 @@ toggle.command: "切换"
invite.command: "邀请"
kick.command: "移除"
bank.command: "银行"
fee.command: "fee"
purge.command: "purge"
trust.command: "信任"
untrust.command: "取消信任"
promote.command: "提升"
@@ -37,6 +40,9 @@ war.command: "战争"
home.command: "基地"
setrank.command: "设置称号"
place.command: "移动"
resetkdr.command: "resetkdr"
usage.description: "Usage: /{0} description [description]"
usage.resetkdr: "Usage: /{0} resetkdr [all/player]"
usage.clan.alliances: "使用: /{0} alliances"
usage.ally: "使用: /{0} ally add/remove [标签]"
usage.ban.unban: "使用: /{0} ban/unban [玩家]"
@@ -55,6 +61,8 @@ usage.0.permissions.player: "使用: /{0} permissions [帮派] add/remove [权
usage.0.invite.player: "使用: /{0} invite [玩家]"
usage.kick.player: "使用: /{0} kick [玩家]"
usage.bank: "使用: /{0} bank withdraw/deposit/status [数量]"
usage.fee: "Usage: /{0} fee check/set [amount]"
usage.purge: "Usage: /{0} purge [player]"
usage.0.modtag.tag: "使用: /{0} modtag [标签]"
usage.list: "使用: /{0} list"
usage.lookup.tag: "使用: /{0} lookup [标签]"
@@ -75,6 +83,9 @@ usage.0.leaderboard: "使用: /{0} leaderboard"
0.ban.unban.player.1.ban.unban.a.player: "/{0} ban/unban [玩家]{1} - 封禁/解封一个玩家"
0.hometp.clan.1.tp.home.a.clan: "/{0} home tp [帮派]{1} - 传送至帮派基地"
0.disband.tag.1.disband.a.clan: "/{0} disband [标签]{1} - 解禁帮派"
0.resetkdr.1.resets.kdr: "/{0} resetkdr player/all{1} - Reset KDR of all players or just of one"
0.resetkdr.1.resets.your.kdr: "/{0} resetkdr{1} - Reset your KDR"
0.purge.player.1.purge.a.player: "/{0} purge [player]{1} - Purge a player"
0.verify.tag.1.verify.an.unverified.clan: "/{0} verify [标签]{1} - 验证一个帮派"
0.verify.1.purchase.verification.of.your.clan: "/{0} verify{1} - 付费验证你的帮派"
0.list.1.lists.all.clans: "/{0} list{1} - 列出所有帮派"
@@ -94,6 +105,7 @@ usage.0.leaderboard: "使用: /{0} leaderboard"
0.rival.add.remove.tag.1.add.remove.a.rival.clan: "/{0} rival add/remove [标签]{1} - 添加/移除一个敌对帮派"
0.bb.1.display.bulletin.board: "/{0} bb{1} - 显示公告板"
0.bb.msg.1.add.a.message.to.the.bulletin.board: "/{0} bb [msg]{1} - 添加信息到公告板"
0.description.description.1.modify.the.clan.s.description: "/{0} description [description]{1} - Modify the clan''s description"
0.modtag.tag.1.modify.the.clan.s.tag: "/{0} modtag [标签]{1} - 更改帮派标签"
0.cape.url.1.change.your.clan.s.cape: "/{0} cape [url]{1} - 更改帮派披风"
0.invite.player.1.invite.a.player: "/{0} invite [玩家]{1} - 邀请玩家"
@@ -112,10 +124,13 @@ usage.0.leaderboard: "使用: /{0} leaderboard"
0.create.tag.name.1.create.a.new.clan: "/{0} create [标签] [name]{1} - 创建新的帮派"
0.kills: "/{0} kills{1} - 查看你的击杀量"
0.killsplayer: "/{0} kills [玩家]{1} - 查看玩家的击杀量"
0.fee.check: "/{0} fee check {1}- Check if the fee is enabled and how much is it"
0.fee.set: "/{0} fee set [amount]{1} - Set the clan's member fee"
0.mostkilled: "/{0} mostkilled{1} - 查看全服死亡排名"
home-menu: "/{0} home{1} - 传送至帮派基地"
home-set-menu: "/{0} home set{1} - 设置帮派基地"
home-clear-menu: "/{0} home clear{1} - 清除帮派基地"
home-regroup-menu: "/{0} home regroup [me]{1} - Regroup all members to clan home-base or to you"
example.clan.modtag.4kfo.4l: "示例: /clan modtag &4帅"
example.clan.create: "示例: /clan create &4大帅比"
clan: "帮派"
@@ -245,15 +260,17 @@ you.are.the.only.member.online: "你是唯一在线的成员"
your.clan.tag.cannot.be.longer.than.characters: "你的帮派的标签不能超过 {0} 字符"
your.clan.tag.must.be.longer.than.characters: "你的帮派的标签必须超过 {0} 字符"
your.tag.cannot.contain.the.following.colors: "帮派的标签不能含有以下颜色: {0}"
your.tag.cannot.contain.color.codes: "Your tag cannot contain color codes"
your.clan.name.cannot.be.longer.than.characters: "你的帮派的名称不能超过 {0} 字符"
your.clan.name.must.be.longer.than.characters: "你的帮派的名称必须超过 {0} 字符"
your.clan.tag.can.only.contain.letters.numbers.and.color.codes: "帮派的标签只能含有字母、数字和颜色代码
your.clan.tag.can.only.contain.letters.numbers.and.color.codes: "帮派的标签只能含有字母、数字和颜色代码"
your.clan.name.cannot.contain.color.codes: "帮派的名称不能含有颜色"
that.tag.name.is.disallowed: "这个标签名不被允许"
you.must.first.resign: "你必须先离开 {0}"
clan.with.this.tag.already.exists: "此标签的帮派已经存在"
get.your.clan.verified.to.access.advanced.features: "验证你的帮派以使用高级功能"
clan.created: "帮派 {0} 创建了"
not.enough.leaders.online.to.vote.on.demotion: "There aren''t enough leaders online to vote on this demotion"
leaders.must.be.online.to.vote.on.demotion: "除了此降级的老大以外的所有老大必须全部在线才能降级"
demotion.vote.has.been.requested.from.all.leaders: "所有老大都要求降级"
player.is.not.a.leader.of.your.clan: "这个玩家不是你的帮派的老大"
@@ -288,6 +305,7 @@ rank.0: "称号: {0}"
kdr.0: "KD: {0}"
deaths.0: "死亡: {0}"
join.date.0: "加入日期: {0}"
fee.0.value.1: "Fee: {0}, {1} $"
last.seen.0: "最后上线: {0}"
past.clans.0: "曾经的帮派: {0}"
inactive.0: "不活跃: {0}"
@@ -296,6 +314,7 @@ clan.commands: "帮派命令"
you.can.only.modify.the.color.and.case.of.the.tag: "你只能更改标签的颜色和大小写"
tag.changed.to.0: "标签更改为 {0}"
name.0: "名称: {0}"
description.0: "Description: {0}"
leaders.0: "老大: {0}"
members.online.0: "在线成员: {0}"
allies.0: "联盟: {0}"
@@ -374,6 +393,12 @@ bboff: "公告板已关闭"
bbon: "公告板已开启"
tagoff: "标签已关闭"
tagon: "标签已开启"
depositon: "Deposit toggled on"
depositoff: "Deposit toggled off"
withdrawon: "Withdraw toggled on"
withdrawoff: "Withdraw toggled off"
feeoff: "Fee toggled off"
feeon: "Fee toggled on"
home.base.only.once: "基地只能设置一次"
now.at.homebase: "你现在在 {0} 的基地"
hombase.set: "帮派基地设置为: {0}"
@@ -394,10 +419,46 @@ your.clans.are.already.rivals: "你的帮派已经是敌对了"
player.got.money: "你因为击杀 {1} 而获得了基于 KD: {2} 的 {0}"
cleared.bb: "清空了公告板"
clan.balance: "帮派经济: {0}"
bb.fee.player.kicked: "{0} was kicked for not paying the fee"
bb.fee.set: "{0} $ is the fee"
bb.clan.deposit: "{0} $ 已存入"
player.clan.deposit: "你存入了 {0}"
bb.clan.withdraw: "{0} $ 被取出"
player.clan.withdraw: "你取出了 {0}"
clan.bank.not.enough.money: "你的帮派银行资金不足"
your.clans.are.not.rivals: "你的帮派不是敌对"
you.cannot.rival.your.own.clan: "You cannot rival your own clan"
the.clan.members.reached.limit: "帮派成员达到上限"
you.have.reseted.your.kdr: "You have reseted your KDR"
you.have.reseted.0.kdr: "You have reseted {0}''s KDR"
you.have.reseted.kdr.of.all.players: "You have reseted the KDR of all players"
resign.yes: "Yes"
resign.no: "No"
resign.confirmation: "Are you sure you want to resign? {0}"
resign.success: "You have successfully resigned from your clan"
player.is.not.a.leader.of.any.clan: "The player is not a leader of any clan"
you.cannot.demote.the.last.leader: "You cannot demote the last leader"
player.successfully.demoted: "The player was successfully demoted"
bb.ago: " ago "
bb.moments: "moments"
bb.seconds: " seconds"
bb.minutes: " minutes"
bb.one.minute: "1 minute"
bb.hours: " hours"
bb.one.hour: "1 hour"
bb.days: " days"
bb.one.day: "1 day"
the.fee.is.0.and.its.current.value.is.1: "The fee is {0} and the its current value is {1} $"
fee.enabled: "enabled"
fee.disabled: "disabled"
fee.set: "The fee was successfully set"
max.fee.allowed.is.0: "Max fee allowed is {0}"
fee.collected: "{0} $ were withdrawn for the clan fee"
invalid.fee: "The value you inserted is not valid"
player.purged: "The player was successfully purged"
upkeep.collected: "{0} $ were withdrawn for the upkeep"
balance.is.not.enough.for.upkeep: "The clan balance is not enough for paying the upkeep ({0} $), deposit the amount to avoid being disbanded"
your.clan.description.must.be.longer.than: "Your clan description must be longer than {0} characters"
your.clan.description.cannot.be.longer.than: "Your clan description cannot be longer than {0} characters"
description.changed: "You have successfully changed your clan's description"
no.description: "No description"
+48 -1
View File
@@ -1,3 +1,4 @@
description.command: "description"
create.command: "create"
list.command: "list"
profile.command: "profile"
@@ -18,6 +19,8 @@ toggle.command: "toggle"
invite.command: "invite"
kick.command: "kick"
bank.command: "bank"
fee.command: "fee"
purge.command: "purge"
trust.command: "trust"
untrust.command: "untrust"
promote.command: "promote"
@@ -38,6 +41,7 @@ home.command: "home"
setrank.command: "setrank"
place.command: "place"
resetkdr.command: "resetkdr"
usage.description: "Usage: /{0} description [description]"
usage.resetkdr: "Usage: /{0} resetkdr [all/player]"
usage.clan.alliances: "Usage: /{0} alliances"
usage.ally: "Usage: /{0} ally add/remove [tag]"
@@ -57,6 +61,8 @@ usage.0.permissions.player: "Usage: /{0} permissions [clan] add/remove [permissi
usage.0.invite.player: "Usage: /{0} invite [player]"
usage.kick.player: "Usage: /{0} kick [player]"
usage.bank: "Usage: /{0} bank withdraw/deposit/status [amount]"
usage.fee: "Usage: /{0} fee check/set [amount]"
usage.purge: "Usage: /{0} purge [player]"
usage.0.modtag.tag: "Usage: /{0} modtag [tag]"
usage.list: "Usage: /{0} list"
usage.lookup.tag: "Usage: /{0} lookup [tag]"
@@ -79,6 +85,7 @@ usage.0.leaderboard: "Usage: /{0} leaderboard"
0.disband.tag.1.disband.a.clan: "/{0} disband [tag]{1} - Disband a clan"
0.resetkdr.1.resets.kdr: "/{0} resetkdr player/all{1} - Reset KDR of all players or just of one"
0.resetkdr.1.resets.your.kdr: "/{0} resetkdr{1} - Reset your KDR"
0.purge.player.1.purge.a.player: "/{0} purge [player]{1} - Purge a player"
0.verify.tag.1.verify.an.unverified.clan: "/{0} verify [tag]{1} - Verify an unverified clan"
0.verify.1.purchase.verification.of.your.clan: "/{0} verify{1} - Purchase verification of your clan"
0.list.1.lists.all.clans: "/{0} list{1} - Lists all clans"
@@ -99,6 +106,7 @@ usage.0.leaderboard: "Usage: /{0} leaderboard"
0.bb.1.display.bulletin.board: "/{0} bb{1} - Display bulletin board"
0.bb.msg.1.add.a.message.to.the.bulletin.board: "/{0} bb [msg]{1} - Add a message to the bulletin board"
0.modtag.tag.1.modify.the.clan.s.tag: "/{0} modtag [tag]{1} - Modify the clan''s tag"
0.description.description.1.modify.the.clan.s.description: "/{0} description [description]{1} - Modify the clan''s description"
0.cape.url.1.change.your.clan.s.cape: "/{0} cape [url]{1} - Change your clan''s cape"
0.invite.player.1.invite.a.player: "/{0} invite [player]{1} - Invite a player"
0.kick.player.1.kick.a.player.from.the.clan: "/{0} kick [player]{1} - Kick a player from the clan"
@@ -116,6 +124,8 @@ usage.0.leaderboard: "Usage: /{0} leaderboard"
0.create.tag.name.1.create.a.new.clan: "/{0} create [tag] [name]{1} - Create a new clan"
0.kills: "/{0} kills{1} - View your kill counts"
0.killsplayer: "/{0} kills [player]{1} - View a player''s kill counts"
0.fee.check: "/{0} fee check {1}- Check if the fee is enabled and how much is it"
0.fee.set: "/{0} fee set [amount]{1} - Set the clan's member fee"
0.mostkilled: "/{0} mostkilled{1} - View serverwide most killed counts"
home-menu: "/{0} home{1} - Teleport to clan home-base"
home-set-menu: "/{0} home set{1} - Set the clan''s home base"
@@ -260,6 +270,7 @@ you.must.first.resign: "You must first resign from {0}"
clan.with.this.tag.already.exists: "A clan with this tag already exists"
get.your.clan.verified.to.access.advanced.features: "Get your clan verified to access advanced features"
clan.created: "Clan {0} created"
not.enough.leaders.online.to.vote.on.demotion: "There aren''t enough leaders online to vote on this demotion"
leaders.must.be.online.to.vote.on.demotion: "All leaders other than the demoted must be online to vote on this demotion"
demotion.vote.has.been.requested.from.all.leaders: "Demotion vote has been requested from all leaders"
player.is.not.a.leader.of.your.clan: "The player is not a leader of your clan"
@@ -293,6 +304,7 @@ status.0: "Status: {0}"
rank.0: "Rank: {0}"
kdr.0: "KDR: {0}"
deaths.0: "Deaths: {0}"
fee.0.value.1: "Fee: {0}, {1} $"
join.date.0: "Join Date: {0}"
last.seen.0: "Last Seen: {0}"
past.clans.0: "Past Clans: {0}"
@@ -302,6 +314,7 @@ clan.commands: "clan commands"
you.can.only.modify.the.color.and.case.of.the.tag: "You can only modify the color and case of the tag"
tag.changed.to.0: "Tag changed to {0}"
name.0: "Name: {0}"
description.0: "Description: {0}"
leaders.0: "Leaders: {0}"
members.online.0: "Members Online: {0}"
allies.0: "Allies: {0}"
@@ -384,6 +397,8 @@ depositon: "Deposit toggled on"
depositoff: "Deposit toggled off"
withdrawon: "Withdraw toggled on"
withdrawoff: "Withdraw toggled off"
feeoff: "Fee toggled off"
feeon: "Fee toggled on"
home.base.only.once: "Home base can only be set once"
now.at.homebase: "You are now at {0}''s home base"
hombase.set: "Clan home-base set to: {0}"
@@ -404,6 +419,8 @@ your.clans.are.already.rivals: "Your clans are already rivals"
player.got.money: "You got {0} for killing {1} based on you KDR: {2}"
cleared.bb: "Cleared the bulletin board"
clan.balance: "Clan-Balance: {0}"
bb.fee.player.kicked: "{0} was kicked for not paying the fee"
bb.fee.set: "{0} $ is the fee"
bb.clan.deposit: "{0} $ were deposited"
player.clan.deposit: "You deposited {0}"
bb.clan.withdraw: "{0} $ were withdrawn"
@@ -414,4 +431,34 @@ you.cannot.rival.your.own.clan: "You cannot rival your own clan"
the.clan.members.reached.limit: "Your clan members reached limit"
you.have.reseted.your.kdr: "You have reseted your KDR"
you.have.reseted.0.kdr: "You have reseted {0}''s KDR"
you.have.reseted.kdr.of.all.players: "You have reseted the KDR of all players"
you.have.reseted.kdr.of.all.players: "You have reseted the KDR of all players"
resign.yes: "Yes"
resign.no: "No"
resign.confirmation: "Are you sure you want to resign? {0}"
resign.success: "You have successfully resigned from your clan"
player.is.not.a.leader.of.any.clan: "The player is not a leader of any clan"
you.cannot.demote.the.last.leader: "You cannot demote the last leader"
player.successfully.demoted: "The player was successfully demoted"
bb.ago: " ago "
bb.moments: "moments"
bb.seconds: " seconds"
bb.minutes: " minutes"
bb.one.minute: "1 minute"
bb.hours: " hours"
bb.one.hour: "1 hour"
bb.days: " days"
bb.one.day: "1 day"
the.fee.is.0.and.its.current.value.is.1: "The fee is {0} and the its current value is {1} $"
fee.enabled: "enabled"
fee.disabled: "disabled"
fee.set: "The fee was successfully set"
max.fee.allowed.is.0: "Max fee allowed is {0}"
fee.collected: "{0} $ were withdrawn for the clan fee"
invalid.fee: "The value you inserted is not valid"
player.purged: "The player was successfully purged"
upkeep.collected: "{0} $ were withdrawn for the upkeep"
balance.is.not.enough.for.upkeep: "The clan balance is not enough for paying the upkeep ({0} $), deposit the amount to avoid being disbanded"
your.clan.description.must.be.longer.than: "Your clan description must be longer than {0} characters"
your.clan.description.cannot.be.longer.than: "Your clan description cannot be longer than {0} characters"
description.changed: "You have successfully changed your clan's description"
no.description: "No description"
+14
View File
@@ -7,6 +7,12 @@ permissions:
description: Can grant clans permissions
simpleclans.admin.reload:
description: Can reload configuration
simpleclans.admin.purge:
description: Can purge a player
simpleclans.admin.promote:
description: Can promote players to clan leaders
simpleclans.admin.demote:
description: Can demote clan leaders to normal players
simpleclans.admin.all-seeing-eye:
description: Can see all clan chats
simpleclans.admin.resetkdr:
@@ -89,6 +95,8 @@ permissions:
description: Can start a rivalry with another clan
simpleclans.leader.modtag:
description: Can modify his clan's tag
simpleclans.leader.description:
description: Can modify his clan's description
simpleclans.leader.cape:
description: Can set his clan's cape url
simpleclans.member.cape-toggle:
@@ -97,12 +105,16 @@ permissions:
description: Can view his and other's kills
simpleclans.member.tag-toggle:
description: Can hide his own clan tag
simpleclans.member.fee-check:
description: Can check his clan's fee
simpleclans.mod.mostkilled:
description: Can view his and other's clans mostkilled
simpleclans.mod.keep-items:
description: Can keep items when teleporting home
simpleclans.mod.place:
description: Can manually place players in clans
simpleclans.leader.fee:
description: Can enable and set the clan fee
simpleclans.leader.invite:
description: Can invite players into his clan
simpleclans.leader.kick:
@@ -134,6 +146,7 @@ permissions:
simpleclans.admin.reload: true
simpleclans.admin.all-seeing-eye: true
simpleclans.admin.resetkdr: true
simpleclans.admin.demote: true
simpleclans.mod.*:
description: Permissions for moderators
default: op
@@ -183,6 +196,7 @@ permissions:
simpleclans.member.kills: true
simpleclans.member.bank: true
simpleclans.member.resetkdr: true
simpleclans.member.fee-check: true
simpleclans.leader.*:
description: Permissions for those who can be clan leaders
default: false