11 Commits

Author SHA1 Message Date
Govindass
4afd5a2dbc Merge branch 'master' of https://github.com/Limework/RediSkript 2020-10-22 14:19:36 +03:00
Govindass
92d89ec76d Remove debug message & Hotfix 2020-10-22 14:19:29 +03:00
Govindas
0ca8712a1a Update README.md 2020-10-22 13:31:38 +03:00
Govindass
216b2635b3 Further fixes & refactoring for release 2020-10-22 13:30:41 +03:00
Govindass
df8608802d Fix encryption disabling & some refactoring 2020-10-22 12:32:08 +03:00
Govindass
157e2b08c7 Remove unneeded code 2020-10-18 17:07:37 +03:00
mohammed jasem alaajel
5f4600546e small fix to make sure the connect was killed 2020-07-30 09:35:50 +04:00
mohammed jasem alaajel
f4ab43bcb8 added protection to kill current working sub 2020-07-28 10:53:42 +04:00
mohammed jasem alaajel
542884dfe9 added /reloadredis command 2020-07-28 10:44:00 +04:00
ham1255
2e80b57a53 Fixed mongodb url from config is wrong 2020-07-08 12:37:10 +04:00
ham1255
4141bcdfb1 added mongodb, bumped versoin 2020-07-07 18:49:19 +04:00
16 changed files with 108 additions and 223 deletions

View File

@@ -1,2 +1 @@
# SkLimework
Private addon

View File

@@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.limework.core</groupId> <groupId>net.limework.core</groupId>
<artifactId>LimeworkSpigotCore</artifactId> <artifactId>RediSkript</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>
@@ -83,7 +83,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version> <version>1.16.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: net.limework.core.RediSkript

View File

@@ -1,11 +1,11 @@
package net.limework.core; package net.limework.core;
import net.limework.core.guis.ControlGui;
import net.limework.core.hooks.SkriptHook; import net.limework.core.hooks.SkriptHook;
import net.limework.core.managers.RedisManager; import net.limework.core.managers.RedisManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class LimeworkSpigotCore extends JavaPlugin { import java.util.Objects;
public class RediSkript extends JavaPlugin {
//Redis manager //Redis manager
private RedisManager rm; private RedisManager rm;
@@ -15,20 +15,15 @@ public class LimeworkSpigotCore extends JavaPlugin {
public void onEnable() { public void onEnable() {
saveDefaultConfig(); saveDefaultConfig();
rm = new RedisManager(this); rm = new RedisManager(this);
Objects.requireNonNull(getServer().getPluginCommand("reloadredis")).setExecutor(rm);
if (getServer().getPluginManager().getPlugin("Skript") != null) { if (getServer().getPluginManager().getPlugin("Skript") != null) {
new SkriptHook(this); new SkriptHook(this);
} else { } else {
getLogger().info("Skript wasn't found."); getLogger().info("Skript wasn't found.");
} }
rm.start(); rm.start();
try {
ControlGui controlGui = new ControlGui(this);
this.getServer().getPluginManager().registerEvents(controlGui, this);
this.getCommand("control").setExecutor(controlGui);
} catch (NoSuchFieldError e) {
getLogger().info("SOMETHING WENT WRONG WHEN LOADING control gui.");
e.printStackTrace();
}
} }

View File

@@ -1,69 +0,0 @@
package net.limework.core.abstraction;
import ch.njol.skript.Skript;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
import static org.bukkit.ChatColor.translateAlternateColorCodes;
public abstract class Gui {
protected Inventory gui;
private int rows;
private boolean loaded = false;
protected String name;
protected void setup(String name, int rows) {
if (loaded) {
return;
}
loaded = true;
this.rows = 9 * rows;
this.name = ChatColor.translateAlternateColorCodes('&', name);
gui = Bukkit.createInventory(null, this.rows, this.name);
}
protected void makeItem(Material material, int howMany, int slot, String name) {
ItemStack item = new ItemStack(material, 1);
ItemMeta item_meta = item.getItemMeta();
item_meta.setDisplayName(translateAlternateColorCodes('&', name));
item.setItemMeta(item_meta);
item.setAmount(howMany);
this.gui.clear(slot);
this.gui.setItem(slot, item);
}
protected void makeItem(Material material, int howMany, int slot, String name, String... Lore) {
ItemStack item = new ItemStack(material, 1);
ItemMeta item_meta = item.getItemMeta();
item_meta.setDisplayName(translateAlternateColorCodes('&', name));
List<String> lore = new ArrayList<>();
for (String s : Lore) {
lore.add(translateAlternateColorCodes('&', s));
}
item_meta.setLore(lore);
item.setItemMeta(item_meta);
item.setAmount(howMany);
this.gui.clear(slot);
this.gui.setItem(slot, item);
}
protected void fillGUI(Material material) {
int slot = -1;
while (slot <= (this.rows - 2)) {
slot++;
makeItem(material, 1, slot , "&1.", "");
}
}
}

View File

@@ -1,6 +1,5 @@
package net.limework.core.events; package net.limework.core.events;
import org.bukkit.Bukkit;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;

View File

@@ -1,90 +0,0 @@
package net.limework.core.guis;
import net.limework.core.LimeworkSpigotCore;
import net.limework.core.abstraction.Gui;
import org.bukkit.*;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.jetbrains.annotations.NotNull;
public class ControlGui extends Gui implements Listener, CommandExecutor {
private LimeworkSpigotCore plugin;
public ControlGui(LimeworkSpigotCore plugin) {
this.plugin = plugin;
setup("&cServer Control", 6);
//fillGUI(Material.LIME_STAINED_GLASS_PANE);
makeItem(Material.CRAFTING_TABLE, 1, 10, "&eCreative mode", "&cClick this for creative mode.");
makeItem(Material.DIAMOND_SWORD, 1, 12, "&eSurvival Mode", "&bClick this for Survival mode.");
makeItem(Material.DIAMOND, 1, 14, "&eSpectator Mode", "&eClick this for Spectator mode.");
makeItem(Material.PUFFERFISH, 1, 16, "&eAdventure Mode", "&aClick this for Adventure mode.");
plugin.getServer().getScheduler().runTaskTimer(plugin, () -> {
makeItem(Material.OAK_SIGN, 1, 37, "&eRam: " + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000000) + "MB/" + (Runtime.getRuntime().totalMemory() / 1000000) + "MB");
makeItem(Material.PLAYER_HEAD, 1, 40, "&eOnline Players: " + plugin.getServer().getOnlinePlayers().size() + "/" + plugin.getServer().getMaxPlayers());
}, 0, 20);
makeItem(Material.RED_WOOL, 1, 53, "&c&lShutdown the server");
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, @NotNull String[] args) {
if (sender instanceof Player) {
Player p = ((Player) sender);
p.openInventory(gui);
}
return false;
}
@EventHandler
public void onInventory(InventoryClickEvent e) {
if (e.getInventory() == gui) {
e.setCancelled(true);
Player p = (Player) e.getWhoClicked();
switch (e.getSlot()) {
case 10: {
p.setGameMode(GameMode.CREATIVE);
p.closeInventory();
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
break;
}
case 12: {
p.setGameMode(GameMode.SURVIVAL);
p.closeInventory();
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
break;
}
case 14: {
p.setGameMode(GameMode.SPECTATOR);
p.closeInventory();
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
break;
}
case 16: {
p.setGameMode(GameMode.ADVENTURE);
p.closeInventory();
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
break;
}
case 53: {
p.closeInventory();
plugin.getServer().shutdown();
break;
}
default: {
p.playSound(p.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 0.0f);
break;
}
}
}
}
}

View File

@@ -5,7 +5,7 @@ import ch.njol.skript.SkriptAddon;
import ch.njol.skript.lang.ExpressionType; import ch.njol.skript.lang.ExpressionType;
import ch.njol.skript.registrations.EventValues; import ch.njol.skript.registrations.EventValues;
import ch.njol.skript.util.Getter; import ch.njol.skript.util.Getter;
import net.limework.core.LimeworkSpigotCore; import net.limework.core.RediSkript;
import net.limework.core.events.RedisMessageEvent; import net.limework.core.events.RedisMessageEvent;
import net.limework.core.skript.elements.EvtRedis; import net.limework.core.skript.elements.EvtRedis;
import net.limework.core.skript.elements.ExprChannel; import net.limework.core.skript.elements.ExprChannel;
@@ -16,7 +16,7 @@ import java.io.IOException;
public class SkriptHook { public class SkriptHook {
private SkriptAddon addon; private SkriptAddon addon;
public SkriptHook(LimeworkSpigotCore plugin) { public SkriptHook(RediSkript plugin) {
addon = Skript.registerAddon(plugin); addon = Skript.registerAddon(plugin);
try { try {
addon.loadClasses("net.limework.core.skript", "elements"); addon.loadClasses("net.limework.core.skript", "elements");

View File

@@ -1,11 +1,16 @@
package net.limework.core.managers; package net.limework.core.managers;
import net.limework.Data.Encryption; import net.limework.core.RediSkript;
import net.limework.core.LimeworkSpigotCore; import net.limework.data.Encryption;
import net.limework.core.events.RedisMessageEvent; import net.limework.core.events.RedisMessageEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.Configuration; import org.bukkit.configuration.Configuration;
import org.bukkit.entity.Player;
import org.cryptomator.siv.UnauthenticCiphertextException; import org.cryptomator.siv.UnauthenticCiphertextException;
import org.json.JSONObject; import org.json.JSONObject;
import redis.clients.jedis.BinaryJedis; import redis.clients.jedis.BinaryJedis;
@@ -14,18 +19,20 @@ import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisPoolConfig;
import javax.crypto.IllegalBlockSizeException; import javax.crypto.IllegalBlockSizeException;
import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
public class RedisManager extends BinaryJedisPubSub implements Runnable{ public class RedisManager extends BinaryJedisPubSub implements Runnable, CommandExecutor {
private LimeworkSpigotCore plugin; private RediSkript plugin;
private JedisPool jedisPool; private JedisPool jedisPool;
private ExecutorService RedisService; private ExecutorService RedisService;
private AtomicBoolean isKilled = new AtomicBoolean();
//sub //sub
@@ -36,7 +43,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
private Encryption encryption; private Encryption encryption;
public RedisManager(LimeworkSpigotCore plugin) { public RedisManager(RediSkript plugin) {
this.plugin = plugin; this.plugin = plugin;
Configuration config = this.plugin.getConfig(); Configuration config = this.plugin.getConfig();
JedisPoolConfig JConfig = new JedisPoolConfig(); JedisPoolConfig JConfig = new JedisPoolConfig();
@@ -51,19 +58,23 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
config.getString("Redis.Password"), config.getString("Redis.Password"),
config.getBoolean("Redis.useSSL")); config.getBoolean("Redis.useSSL"));
RedisService = Executors.newFixedThreadPool(config.getInt("Redis.Threads")); RedisService = Executors.newFixedThreadPool(config.getInt("Redis.Threads"));
try{this.subscribeJedis = this.jedisPool.getResource(); }catch (Exception ignored){} try {
this.subscribeJedis = this.jedisPool.getResource();
} catch (Exception ignored) {
}
this.channels = config.getStringList("Channels"); this.channels = config.getStringList("Channels");
encryption = new Encryption(config); encryption = new Encryption(config);
} }
public void start(){ public void start() {
this.RedisService.execute(this); this.RedisService.execute(this);
} }
@Override @Override
public void run() { public void run() {
while (!isShuttingDown.get()) { while (!isShuttingDown.get()) {
isKilled.set(false);
try { try {
message("&e[Jedis] &cConnecting to redis..........."); message("&e[Jedis] &cConnecting to redis...........");
if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource(); if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource();
@@ -79,7 +90,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
try { try {
/* Data Initialization for channelsInByte array from List<String> channels */ /* Data Initialization for channelsInByte array from List<String> channels */
for (int x = 0; x < channels.size(); x++) { for (int x = 0; x < channels.size(); x++) {
channelsInByte[x] = channels.get(x).getBytes(); channelsInByte[x] = channels.get(x).getBytes(StandardCharsets.UTF_8);
} }
} catch (ArrayIndexOutOfBoundsException ex) { } catch (ArrayIndexOutOfBoundsException ex) {
reInitializeByteArray = true; reInitializeByteArray = true;
@@ -92,7 +103,9 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
} catch (Exception e) { } catch (Exception e) {
message("&e[Jedis] &cConnection to redis has failed! &ereconnecting..."); message("&e[Jedis] &cConnection to redis has failed! &ereconnecting...");
if (this.subscribeJedis != null){this.subscribeJedis.close();} if (this.subscribeJedis != null) {
this.subscribeJedis.close();
}
isRedisOnline.set(false); isRedisOnline.set(false);
} }
try { try {
@@ -100,6 +113,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (isKilled.get()) break;
} }
} }
@@ -109,28 +123,37 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
@Override @Override
public void onMessage(byte[] channel, byte[] message) { public void onMessage(byte[] channel, byte[] message) {
String channelString = new String(channel); String channelString = new String(channel, StandardCharsets.UTF_8);
try { try {
String decrypted = null; String receivedMessage = null;
//if encryption is enabled, decrypt the message, else just convert binary to string
if (this.encryption.isEncryptionEnabled()) {
try { try {
decrypted = encryption.decrypt(message); receivedMessage = encryption.decrypt(message);
} catch (UnauthenticCiphertextException | IllegalBlockSizeException e) { } catch (UnauthenticCiphertextException | IllegalBlockSizeException e) {
e.printStackTrace(); e.printStackTrace();
} }
assert decrypted != null;
JSONObject j = new JSONObject(decrypted); } else {
//encryption is disabled, so let's just get the string
receivedMessage = new String(message, StandardCharsets.UTF_8);
}
if (receivedMessage != null) {
JSONObject j = new JSONObject(receivedMessage);
//System.out.println("Message got from channel: "+channel +" and the Message: " +json.toString()); //System.out.println("Message got from channel: "+channel +" and the Message: " +json.toString());
plugin.getServer().getPluginManager().callEvent(new RedisMessageEvent(channelString, j.getString("Message"))); plugin.getServer().getPluginManager().callEvent(new RedisMessageEvent(channelString, j.getString("Message")));
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aGBot&a] &cI Got a Message that Was empty from channel " + channel + " Please check your code that you used to send the message. ^ ignore the error.")); Bukkit.getLogger().warning(ChatColor.translateAlternateColorCodes('&', "&2[&aRedisk&a] &cI got a message that was empty from channel " + channelString + " please check your code that you used to send the message. ^ ignore the error."));
} }
} }
public void shutdown() { public void shutdown() {
this.isShuttingDown.set(true); this.isShuttingDown.set(true);
if (this.subscribeJedis != null){ if (this.subscribeJedis != null) {
this.unsubscribe(); this.unsubscribe();
this.subscribeJedis.close(); this.subscribeJedis.close();
} }
@@ -161,4 +184,25 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
public Encryption getEncryption() { public Encryption getEncryption() {
return encryption; return encryption;
} }
// the /reloadredis command
@Override
public boolean onCommand(CommandSender sender, Command cmd, String lable, String[] args) {
if (sender instanceof Player) {
sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&'
, "&cYou cannot execute this command.")));
return true;
}
isKilled.set(true);
try {
if (this.subscribeJedis != null) {
this.unsubscribe();
this.subscribeJedis.close();
}
} catch (Exception e) {
e.printStackTrace();
}
start();
return false;
}
} }

View File

@@ -5,7 +5,7 @@ import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Expression; import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser; import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean; import ch.njol.util.Kleenean;
import net.limework.core.LimeworkSpigotCore; import net.limework.core.RediSkript;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.event.Event; import org.bukkit.event.Event;
@@ -15,7 +15,6 @@ import redis.clients.jedis.BinaryJedis;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
public class EffSendMessage extends Effect { public class EffSendMessage extends Effect {
//"hi"
static { static {
Skript.registerEffect(EffSendMessage.class, "send redis message to channel %string% with message %string%"); Skript.registerEffect(EffSendMessage.class, "send redis message to channel %string% with message %string%");
} }
@@ -27,7 +26,7 @@ public class EffSendMessage extends Effect {
@Override @Override
protected void execute(Event event) { protected void execute(Event event) {
LimeworkSpigotCore plugin = (LimeworkSpigotCore) Bukkit.getPluginManager().getPlugin("LimeworkSpigotCore"); RediSkript plugin = (RediSkript) Bukkit.getPluginManager().getPlugin("RediSkript");
String message = this.message.getSingle(event); String message = this.message.getSingle(event);
String channel = this.channel.getSingle(event); String channel = this.channel.getSingle(event);
if (message == null) {//checks if message equals null if true does not execute. if (message == null) {//checks if message equals null if true does not execute.
@@ -40,15 +39,14 @@ public class EffSendMessage extends Effect {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("Message", message); json.put("Message", message);
json.put("Type", "Skript"); json.put("Type", "Skript");
json.put("Date", System.nanoTime()); //for unique string every time & PING calculations json.put("Date", System.currentTimeMillis()); //for unique string every time & PING calculations
byte[] msg; byte[] msg;
if (plugin.getRm().getEncryption().isEncryptionEnabled()) { if (plugin.getRm().getEncryption().isEncryptionEnabled()) {
msg = plugin.getRm().getEncryption().encrypt(json.toString()); msg = plugin.getRm().getEncryption().encrypt(json.toString());
} else { } else {
msg = message.getBytes(StandardCharsets.UTF_8); msg = json.toString().getBytes(StandardCharsets.UTF_8);
} }
j.publish(channel.getBytes(), msg); j.publish(channel.getBytes(StandardCharsets.UTF_8), msg);
//System.out.println("SkriptSide sent MESSAGE: ["+ message + "] to channel: " + channel + " and json: \n" + json.toString());
j.close(); j.close();
}); });
@@ -56,7 +54,7 @@ public class EffSendMessage extends Effect {
@Override @Override
public String toString(Event event, boolean b) { public String toString(Event event, boolean b) {
return null; return "send redis message to channel " + channel.getSingle(event) + " with message " + message.getSingle(event);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -1,5 +1,4 @@
package net.limework.core.skript.elements; package net.limework.core.skript.elements;
;
import ch.njol.skript.lang.Literal; import ch.njol.skript.lang.Literal;
import ch.njol.skript.lang.SkriptEvent; import ch.njol.skript.lang.SkriptEvent;
import ch.njol.skript.lang.SkriptParser; import ch.njol.skript.lang.SkriptParser;
@@ -7,11 +6,8 @@ import org.bukkit.event.Event;
public class EvtRedis extends SkriptEvent { public class EvtRedis extends SkriptEvent {
@Override @Override
public boolean init(Literal<?>[] literals, int i, SkriptParser.ParseResult parseResult) { public boolean init(Literal<?>[] literals, int i, SkriptParser.ParseResult parseResult) {
return true; return true;
} }

View File

@@ -1,4 +1,4 @@
package net.limework.Data; package net.limework.data;
import org.bukkit.configuration.Configuration; import org.bukkit.configuration.Configuration;
import org.cryptomator.siv.SivMode; import org.cryptomator.siv.SivMode;
@@ -26,11 +26,11 @@ public class Encryption {
public boolean isEncryptionEnabled() { return encryptionEnabled; } public boolean isEncryptionEnabled() { return encryptionEnabled; }
public String decrypt(byte[] message) throws UnauthenticCiphertextException, IllegalBlockSizeException { public String decrypt(byte[] message) throws UnauthenticCiphertextException, IllegalBlockSizeException {
return new String(AES_SIV.decrypt(encryptionKey.getBytes(), macKey.getBytes(), message), StandardCharsets.UTF_8); return new String(AES_SIV.decrypt(encryptionKey.getBytes(StandardCharsets.UTF_8), macKey.getBytes(StandardCharsets.UTF_8), message), StandardCharsets.UTF_8);
} }
public byte[] encrypt(String message) { public byte[] encrypt(String message) {
return AES_SIV.encrypt(encryptionKey.getBytes(), macKey.getBytes(), message.getBytes()); return AES_SIV.encrypt(encryptionKey.getBytes(StandardCharsets.UTF_8), macKey.getBytes(StandardCharsets.UTF_8), message.getBytes(StandardCharsets.UTF_8));
} }

View File

@@ -1,16 +1,26 @@
Redis: Redis:
Password: "yHy0d2zdBlRmaSPj3CiBwEv5V3XxBTLTrCsGW7ntBnzhfxPxXJS6Q1aTtR6DSfAtCZr2VxWnsungXHTcF94a4bsWEpGAvjL6XMU" #a secure password that cannot be cracked, please change it!
#it is also recommended to firewall your redis server with iptables so it can only be accessed by specific IP addresses
Password: "yHy0d2zdBlRmaSPj3CiBwEv5V3XxBTLTrCsGW7ntBnzhfxPxXJS6Q1aTtR6DSfAtCZr2VxWnsungXHTcF94a4bsWEpGAvjL9XMU"
Host: "127.0.0.1" Host: "127.0.0.1"
MaxConnections: 20 MaxConnections: 20
Threads: 10 Threads: 10
#the default Redis port
Port: 6379 Port: 6379
TimeOut: 40000 #time out in milliseconds, how long it should take before it decides that it is unable to connect when sending a message
#90000 = 90 seconds
TimeOut: 90000
#also known as TLS, only use this if you're running Redis 6.0.6 or higher, older versions will not work correctly
useSSL: false useSSL: false
#useful if SSL is disabled #may be useful if you cannot use SSL due to use of older version of Redis
EncryptMessages: false #however this will not encrypt the initial authentication password, only the messages sent
EncryptMessages: true
EncryptionKey: "16CHARACTERS KEY" EncryptionKey: "16CHARACTERS KEY"
MacKey: "16CHARACTERS KEY" MacKey: "16CHARACTERS KEY"
#the channels from which this server can receive messages
#you can always send messages to all channels!
#you can add as many channels as you wish!
Channels: Channels:
- "Channel1" - "Channel1"
- "Channel2" - "Channel2"

View File

@@ -1,11 +1,11 @@
main: net.limework.core.LimeworkSpigotCore main: net.limework.core.RediSkript
name: LimeworkSpigotCore name: RediSkript
version: ${project.version} version: ${project.version}
author: limework.net authors: [Govindas, ham1255, DaemonicKing]
api-version: 1.13 api-version: 1.13
softdepend: softdepend:
- Skript - Skript
commands: commands:
control: reloadredis:
description: "server control" description: "Restart redis connection"
permission: "admin.use" permission: "admin.use"