mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merged Devel into 1.12 Alpha Branch
This commit is contained in:
commit
299e0ccd4a
@ -3,3 +3,10 @@ jdk:
|
||||
- oraclejdk8
|
||||
notifications:
|
||||
email: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- sshpass
|
||||
script: mvn clean install
|
||||
after_success:
|
||||
- ./travis-upload.sh
|
||||
|
12
README.md
12
README.md
@ -1,6 +1,10 @@
|
||||
# TotalFreedomMod #
|
||||
|
||||
<<<<<<< HEAD
|
||||
[![Build Status](https://travis-ci.org/TotalFreedom/TotalFreedomMod.svg?branch=TFM1.12-Alpha)](https://travis-ci.org/TotalFreedom/TotalFreedomMod)
|
||||
=======
|
||||
[![Build Status](https://travis-ci.org/TotalFreedom/TotalFreedomMod.svg?branch=devel)](https://travis-ci.org/TotalFreedom/TotalFreedomMod)
|
||||
>>>>>>> devel
|
||||
|
||||
TotalFreedomMod is a CraftBukkit server plugin designed primarily to support the [Official TotalFreedom Minecraft Server](http://totalfreedom.me/). However, you are more than welcome to adapt the source for your own server.
|
||||
|
||||
@ -9,5 +13,11 @@ This plugin was originally coded by StevenLawson (Madgeek1450), with Jerom van d
|
||||
### Download ###
|
||||
You may download official binaries from the [releases page](https://github.com/TotalFreedom/TotalFreedomMod/releases).
|
||||
|
||||
Additionally, Travis CI generates a binary for each commit to the repository. While they might not be stable or 100% functional, these binaries are accessible at [tfmbuilds.win](https://tfmbuilds.win/).
|
||||
|
||||
### Contributing ###
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in developing TotalFreedomMod. For information on how TotalFreedomMod is licensed, please see [LICENSE.md](LICENSE.md).
|
||||
Please see [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in developing TotalFreedomMod.
|
||||
|
||||
For information on how TotalFreedomMod is licensed, please see [LICENSE.md](LICENSE.md).
|
||||
|
||||
Please [join our Discord server](https://discord.gg/fb9J2TD) for any discussion on TFM development and other TotalFreedom Organization projects.
|
||||
|
43
pom.xml
43
pom.xml
@ -54,10 +54,10 @@
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- <repository>
|
||||
<id>elmakers-repo</id>
|
||||
<url>http://maven.elmakers.com/repository/</url>
|
||||
</repository>
|
||||
</repository>-->
|
||||
<repository>
|
||||
<id>sk89q-snapshots</id>
|
||||
<url>http://maven.sk89q.com/artifactory/repo</url>
|
||||
@ -65,6 +65,17 @@
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
@ -74,8 +85,9 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.12-R0.1-SNAPSHOT</version>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12-pre5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -90,6 +102,12 @@
|
||||
<version>4.5-pre1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<version>2.13.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.TotalFreedom.TF-WorldEdit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
@ -102,23 +120,6 @@
|
||||
<version>6.1.0-TF</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.12-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<version>2.13.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>com.github.TotalFreedom</groupId>
|
||||
<artifactId>TF-LibsDisguises</artifactId>
|
||||
<version>-SNAPSHOT</version>
|
||||
</dependency> -->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,15 +1,13 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.*;
|
||||
import java.security.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.command.Command_logs;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -38,10 +36,10 @@ public class LogViewer extends FreedomService
|
||||
|
||||
public void updateLogsRegistration(final CommandSender sender, final Player target, final LogsRegistrationMode mode)
|
||||
{
|
||||
updateLogsRegistration(sender, target.getName(), target.getAddress().getAddress().getHostAddress().trim(), mode);
|
||||
updateLogsRegistration(sender, target.getName(), mode);
|
||||
}
|
||||
|
||||
public void updateLogsRegistration(final CommandSender sender, final String targetName, final String targetIP, final LogsRegistrationMode mode)
|
||||
public void updateLogsRegistration(final CommandSender sender, final String targetName, final LogsRegistrationMode mode)
|
||||
{
|
||||
final String logsRegisterUrl = ConfigEntry.LOGS_URL.getString();
|
||||
final String logsRegisterPassword = ConfigEntry.LOGS_SECRET.getString();
|
||||
@ -63,14 +61,16 @@ public class LogViewer extends FreedomService
|
||||
sender.sendMessage(ChatColor.YELLOW + "Connecting...");
|
||||
}
|
||||
|
||||
URL url = new URLBuilder(logsRegisterUrl)
|
||||
.addQueryParameter("mode", mode.toString())
|
||||
final String key = SecureCodeGenerator.generateCode(20);
|
||||
|
||||
final URL urlAdd = new URLBuilder(logsRegisterUrl)
|
||||
.addQueryParameter("mode", mode.name())
|
||||
.addQueryParameter("password", logsRegisterPassword)
|
||||
.addQueryParameter("name", targetName)
|
||||
.addQueryParameter("ip", targetIP)
|
||||
.addQueryParameter("key", key)
|
||||
.getURL();
|
||||
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
final HttpURLConnection connection = (HttpURLConnection) urlAdd.openConnection();
|
||||
connection.setConnectTimeout(1000 * 5);
|
||||
connection.setReadTimeout(1000 * 5);
|
||||
connection.setUseCaches(false);
|
||||
@ -92,7 +92,29 @@ public class LogViewer extends FreedomService
|
||||
{
|
||||
if (responseCode == 200)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GREEN + "Registration " + mode.toString() + "d.");
|
||||
if (mode == LogsRegistrationMode.ADD)
|
||||
{
|
||||
String link = null;
|
||||
try
|
||||
{
|
||||
final URL urlVerify = new URLBuilder(logsRegisterUrl)
|
||||
.addQueryParameter("mode", LogsRegistrationMode.VERIFY.name())
|
||||
.addQueryParameter("name", targetName)
|
||||
.addQueryParameter("key", key)
|
||||
.getURL();
|
||||
link = urlVerify.toString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Open this link to verify your logviewer registration:\n" + ChatColor.DARK_GREEN + link);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.GREEN + "Logviewer access revoked successfully.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -110,30 +132,10 @@ public class LogViewer extends FreedomService
|
||||
}.runTaskAsynchronously(plugin);
|
||||
}
|
||||
|
||||
public void deactivateSuperadmin(Admin superadmin)
|
||||
{
|
||||
for (String ip : superadmin.getIps())
|
||||
{
|
||||
updateLogsRegistration(null, superadmin.getName(), ip, LogsRegistrationMode.DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum LogsRegistrationMode
|
||||
{
|
||||
|
||||
UPDATE("update"), DELETE("delete");
|
||||
private final String mode;
|
||||
|
||||
private LogsRegistrationMode(String mode)
|
||||
{
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
ADD, DELETE, VERIFY;
|
||||
}
|
||||
|
||||
private static class URLBuilder
|
||||
@ -160,11 +162,44 @@ public class LogViewer extends FreedomService
|
||||
while (it.hasNext())
|
||||
{
|
||||
Map.Entry<String, String> pair = it.next();
|
||||
pairs.add(pair.getKey() + "=" + pair.getValue());
|
||||
try
|
||||
{
|
||||
pairs.add(URLEncoder.encode(pair.getKey(), "UTF-8") + "=" + URLEncoder.encode(pair.getValue(), "UTF-8"));
|
||||
}
|
||||
catch (UnsupportedEncodingException ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return new URL(requestPath + "?" + StringUtils.join(pairs, "&"));
|
||||
}
|
||||
}
|
||||
|
||||
private static class SecureCodeGenerator
|
||||
{
|
||||
|
||||
private static final String CHARACTER_SET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
public static String generateCode(final int length)
|
||||
{
|
||||
SecureRandom random;
|
||||
try
|
||||
{
|
||||
random = SecureRandom.getInstance("SHA1PRNG", "SUN");
|
||||
}
|
||||
catch (NoSuchAlgorithmException | NoSuchProviderException ex)
|
||||
{
|
||||
random = new SecureRandom();
|
||||
FLog.severe(ex);
|
||||
}
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
sb.append(CHARACTER_SET.charAt(random.nextInt(CHARACTER_SET.length())));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,15 +168,15 @@ public class LoginProcess extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
// Whitelist
|
||||
if (plugin.si.isWhitelisted())
|
||||
{
|
||||
if (!plugin.si.getWhitelisted().contains(username.toLowerCase()))
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// // Whitelist
|
||||
// if (plugin.si.isWhitelisted())
|
||||
// {
|
||||
// if (!plugin.si.getWhitelisted().contains(username.toLowerCase()))
|
||||
// {
|
||||
// event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
|
@ -1,14 +1,7 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_12_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_12_R1.PropertyManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||
|
||||
public class ServerInterface extends FreedomService
|
||||
{
|
||||
@ -41,52 +34,52 @@ public class ServerInterface extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnlineMode(boolean mode)
|
||||
{
|
||||
final PropertyManager manager = getServer().getPropertyManager();
|
||||
manager.setProperty("online-mode", mode);
|
||||
manager.savePropertiesFile();
|
||||
}
|
||||
|
||||
public int purgeWhitelist()
|
||||
{
|
||||
String[] whitelisted = getServer().getPlayerList().getWhitelisted();
|
||||
int size = whitelisted.length;
|
||||
for (EntityPlayer player : getServer().getPlayerList().players)
|
||||
{
|
||||
getServer().getPlayerList().getWhitelist().remove(player.getProfile());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
getServer().getPlayerList().getWhitelist().save();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.warning("Could not purge the whitelist!");
|
||||
FLog.warning(ex);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public boolean isWhitelisted()
|
||||
{
|
||||
return getServer().getPlayerList().getHasWhitelist();
|
||||
}
|
||||
|
||||
public List<?> getWhitelisted()
|
||||
{
|
||||
return Arrays.asList(getServer().getPlayerList().getWhitelisted());
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return getServer().getVersion();
|
||||
}
|
||||
|
||||
private MinecraftServer getServer()
|
||||
{
|
||||
return ((CraftServer) Bukkit.getServer()).getServer();
|
||||
}
|
||||
// public void setOnlineMode(boolean mode)
|
||||
// {
|
||||
// final PropertyManager manager = getServer().getPropertyManager();
|
||||
// manager.setProperty("online-mode", mode);
|
||||
// manager.savePropertiesFile();
|
||||
// }
|
||||
//
|
||||
// public int purgeWhitelist()
|
||||
// {
|
||||
// String[] whitelisted = getServer().getPlayerList().getWhitelisted();
|
||||
// int size = whitelisted.length;
|
||||
// for (EntityPlayer player : getServer().getPlayerList().players)
|
||||
// {
|
||||
// getServer().getPlayerList().getWhitelist().remove(player.getProfile());
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// getServer().getPlayerList().getWhitelist().save();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// FLog.warning("Could not purge the whitelist!");
|
||||
// FLog.warning(ex);
|
||||
// }
|
||||
// return size;
|
||||
// }
|
||||
//
|
||||
// public boolean isWhitelisted()
|
||||
// {
|
||||
// return getServer().getPlayerList().getHasWhitelist();
|
||||
// }
|
||||
//
|
||||
// public List<?> getWhitelisted()
|
||||
// {
|
||||
// return Arrays.asList(getServer().getPlayerList().getWhitelisted());
|
||||
// }
|
||||
//
|
||||
// public String getVersion()
|
||||
// {
|
||||
// return getServer().getVersion();
|
||||
// }
|
||||
//
|
||||
// private MinecraftServer getServer()
|
||||
// {
|
||||
// return ((CraftServer) Bukkit.getServer()).getServer();
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -55,7 +55,8 @@ public class ServerPing extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
String baseMotd = ConfigEntry.SERVER_MOTD.getString().replace("%mcversion%", plugin.si.getVersion());
|
||||
// String baseMotd = ConfigEntry.SERVER_MOTD.getString().replace("%mcversion%", plugin.si.getVersion());
|
||||
String baseMotd = ConfigEntry.SERVER_MOTD.getString();
|
||||
baseMotd = baseMotd.replace("\\n", "\n");
|
||||
baseMotd = FUtil.colorize(baseMotd);
|
||||
|
||||
|
@ -5,6 +5,8 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.base.ConfigLoadable;
|
||||
@ -25,7 +27,6 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
@Setter
|
||||
private String name;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean active = true;
|
||||
@Getter
|
||||
@Setter
|
||||
@ -138,6 +139,26 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
||||
ips.clear();
|
||||
}
|
||||
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
this.active = active;
|
||||
|
||||
final TotalFreedomMod plugin = TotalFreedomMod.plugin();
|
||||
|
||||
if (!active)
|
||||
{
|
||||
if (getRank().isAtLeast(Rank.TELNET_ADMIN))
|
||||
{
|
||||
if (plugin.btb != null)
|
||||
{
|
||||
plugin.btb.killTelnetSessions(getName());
|
||||
}
|
||||
}
|
||||
|
||||
plugin.lv.updateLogsRegistration(null, getName(), LogsRegistrationMode.DELETE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.command.Command_logs;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
@ -272,6 +271,14 @@ public class AdminList extends FreedomService
|
||||
|
||||
public boolean removeAdmin(Admin admin)
|
||||
{
|
||||
if (admin.getRank().isAtLeast(Rank.TELNET_ADMIN))
|
||||
{
|
||||
if (plugin.btb != null)
|
||||
{
|
||||
plugin.btb.killTelnetSessions(admin.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove admin, update views
|
||||
if (allAdmins.remove(admin.getConfigKey()) == null)
|
||||
{
|
||||
@ -345,7 +352,6 @@ public class AdminList extends FreedomService
|
||||
}
|
||||
|
||||
admin.setActive(false);
|
||||
plugin.lv.deactivateSuperadmin(admin);
|
||||
}
|
||||
|
||||
save();
|
||||
|
@ -1,21 +1,29 @@
|
||||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.bukkittelnet.BukkitTelnet;
|
||||
import me.totalfreedom.bukkittelnet.api.TelnetCommandEvent;
|
||||
import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
|
||||
import me.totalfreedom.bukkittelnet.api.TelnetRequestDataTagsEvent;
|
||||
import me.totalfreedom.bukkittelnet.session.ClientSession;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class BukkitTelnetBridge extends FreedomService
|
||||
{
|
||||
|
||||
private BukkitTelnet bukkitTelnetPlugin = null;
|
||||
|
||||
public BukkitTelnetBridge(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
@ -94,4 +102,69 @@ public class BukkitTelnetBridge extends FreedomService
|
||||
playerTags.put("tfm.essentialsBridge.getNickname", plugin.esb.getNickname(player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
public BukkitTelnet getBukkitTelnetPlugin()
|
||||
{
|
||||
if (bukkitTelnetPlugin == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
final Plugin bukkitTelnet = server.getPluginManager().getPlugin("BukkitTelnet");
|
||||
if (bukkitTelnet != null)
|
||||
{
|
||||
if (bukkitTelnet instanceof BukkitTelnet)
|
||||
{
|
||||
bukkitTelnetPlugin = (BukkitTelnet) bukkitTelnet;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return bukkitTelnetPlugin;
|
||||
}
|
||||
|
||||
public void killTelnetSessions(final String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
final List<ClientSession> sessionsToRemove = new ArrayList<>();
|
||||
|
||||
final BukkitTelnet telnet = getBukkitTelnetPlugin();
|
||||
if (telnet != null)
|
||||
{
|
||||
final Iterator<ClientSession> it = telnet.appender.getSessions().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
final ClientSession session = it.next();
|
||||
if (name != null && name.equalsIgnoreCase(session.getUserName()))
|
||||
{
|
||||
sessionsToRemove.add(session);
|
||||
}
|
||||
}
|
||||
|
||||
for (final ClientSession session : sessionsToRemove)
|
||||
{
|
||||
try
|
||||
{
|
||||
telnet.appender.removeSession(session);
|
||||
session.syncTerminateSession();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe("Error removing single telnet session: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
FLog.info(sessionsToRemove.size() + " telnet session(s) removed.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe("Error removing telnet sessions: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +1,10 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
|
||||
@ -30,16 +14,13 @@ public class Command_logs extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
LogsRegistrationMode mode = LogsRegistrationMode.UPDATE;
|
||||
|
||||
if (args.length == 1)
|
||||
LogsRegistrationMode mode = LogsRegistrationMode.ADD;
|
||||
if (args.length == 1 && "off".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
mode = ("off".equals(args[0]) ? LogsRegistrationMode.DELETE : LogsRegistrationMode.UPDATE);
|
||||
mode = LogsRegistrationMode.DELETE;
|
||||
}
|
||||
|
||||
plugin.lv.updateLogsRegistration(sender, playerSender, mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -44,26 +43,27 @@ public class Command_onlinemode extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
plugin.si.setOnlineMode(onlineMode);
|
||||
|
||||
if (onlineMode)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
player.kickPlayer("Server is activating \"online-mode=true\". Please reconnect.");
|
||||
}
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Turning player validation " + (onlineMode ? "on" : "off") + ".", true);
|
||||
|
||||
server.reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FLog.severe(ex);
|
||||
}
|
||||
// try
|
||||
// {
|
||||
// plugin.si.setOnlineMode(onlineMode);
|
||||
//
|
||||
// if (onlineMode)
|
||||
// {
|
||||
// for (Player player : server.getOnlinePlayers())
|
||||
// {
|
||||
// player.kickPlayer("Server is activating \"online-mode=true\". Please reconnect.");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// FUtil.adminAction(sender.getName(), "Turning player validation " + (onlineMode ? "on" : "off") + ".", true);
|
||||
//
|
||||
// server.reload();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// FLog.severe(ex);
|
||||
// }
|
||||
FUtil.adminAction(sender.getName(), "Online-Mode toggling is temporarily disabled.", true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -158,8 +158,10 @@ public class Command_whitelist extends FreedomCommand
|
||||
//purge
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
||||
msg("Removed " + plugin.si.purgeWhitelist() + " players from the whitelist.");
|
||||
// FUtil.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
||||
// msg("Removed " + plugin.si.purgeWhitelist() + " players from the whitelist.");
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Whitelist purging is temporarily disabled.", true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
13
travis-upload.sh
Executable file
13
travis-upload.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
|
||||
mv target/TotalFreedomMod.jar target/TotalFreedomMod-${TRAVIS_COMMIT}.jar
|
||||
export SSHPASS=${SFTP_PASSWORD}
|
||||
sshpass -e sftp -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oLogLevel=ERROR -oBatchMode=no -b - ${SFTP_USER}@${SFTP_HOST}:${SFTP_PATH} << !
|
||||
put target/TotalFreedomMod-${TRAVIS_COMMIT}.jar
|
||||
bye
|
||||
!
|
||||
echo "Artifact upload status: "$?
|
||||
else
|
||||
echo "Skipping artifact upload for pull request build."
|
||||
fi
|
Loading…
Reference in New Issue
Block a user