forked from Limework/RediSkript
Compare commits
11 Commits
1.0.0-SNAP
...
1.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4afd5a2dbc | ||
|
|
92d89ec76d | ||
|
|
0ca8712a1a | ||
|
|
216b2635b3 | ||
|
|
df8608802d | ||
|
|
157e2b08c7 | ||
|
|
5f4600546e | ||
|
|
f4ab43bcb8 | ||
|
|
542884dfe9 | ||
|
|
2e80b57a53 | ||
|
|
4141bcdfb1 |
6
pom.xml
6
pom.xml
@@ -5,8 +5,8 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>net.limework.core</groupId>
|
||||
<artifactId>LimeworkSpigotCore</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<artifactId>RediSkript</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<build>
|
||||
@@ -83,7 +83,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: net.limework.core.RediSkript
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package net.limework.core;
|
||||
|
||||
import net.limework.core.guis.ControlGui;
|
||||
import net.limework.core.hooks.SkriptHook;
|
||||
import net.limework.core.managers.RedisManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class LimeworkSpigotCore extends JavaPlugin {
|
||||
import java.util.Objects;
|
||||
|
||||
public class RediSkript extends JavaPlugin {
|
||||
|
||||
//Redis manager
|
||||
private RedisManager rm;
|
||||
@@ -15,20 +15,15 @@ public class LimeworkSpigotCore extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
saveDefaultConfig();
|
||||
rm = new RedisManager(this);
|
||||
Objects.requireNonNull(getServer().getPluginCommand("reloadredis")).setExecutor(rm);
|
||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
||||
new SkriptHook(this);
|
||||
} else {
|
||||
getLogger().info("Skript wasn't found.");
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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.", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.limework.core.events;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import ch.njol.skript.SkriptAddon;
|
||||
import ch.njol.skript.lang.ExpressionType;
|
||||
import ch.njol.skript.registrations.EventValues;
|
||||
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.skript.elements.EvtRedis;
|
||||
import net.limework.core.skript.elements.ExprChannel;
|
||||
@@ -16,7 +16,7 @@ import java.io.IOException;
|
||||
public class SkriptHook {
|
||||
|
||||
private SkriptAddon addon;
|
||||
public SkriptHook(LimeworkSpigotCore plugin) {
|
||||
public SkriptHook(RediSkript plugin) {
|
||||
addon = Skript.registerAddon(plugin);
|
||||
try {
|
||||
addon.loadClasses("net.limework.core.skript", "elements");
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package net.limework.core.managers;
|
||||
|
||||
import net.limework.Data.Encryption;
|
||||
import net.limework.core.LimeworkSpigotCore;
|
||||
import net.limework.core.RediSkript;
|
||||
import net.limework.data.Encryption;
|
||||
import net.limework.core.events.RedisMessageEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
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.entity.Player;
|
||||
import org.cryptomator.siv.UnauthenticCiphertextException;
|
||||
import org.json.JSONObject;
|
||||
import redis.clients.jedis.BinaryJedis;
|
||||
@@ -14,18 +19,20 @@ import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPoolConfig;
|
||||
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
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 ExecutorService RedisService;
|
||||
|
||||
private AtomicBoolean isKilled = new AtomicBoolean();
|
||||
|
||||
|
||||
//sub
|
||||
@@ -36,7 +43,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
|
||||
private Encryption encryption;
|
||||
|
||||
|
||||
public RedisManager(LimeworkSpigotCore plugin) {
|
||||
public RedisManager(RediSkript plugin) {
|
||||
this.plugin = plugin;
|
||||
Configuration config = this.plugin.getConfig();
|
||||
JedisPoolConfig JConfig = new JedisPoolConfig();
|
||||
@@ -51,7 +58,10 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
|
||||
config.getString("Redis.Password"),
|
||||
config.getBoolean("Redis.useSSL"));
|
||||
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");
|
||||
encryption = new Encryption(config);
|
||||
|
||||
@@ -64,6 +74,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
|
||||
@Override
|
||||
public void run() {
|
||||
while (!isShuttingDown.get()) {
|
||||
isKilled.set(false);
|
||||
try {
|
||||
message("&e[Jedis] &cConnecting to redis...........");
|
||||
if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource();
|
||||
@@ -79,7 +90,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
|
||||
try {
|
||||
/* Data Initialization for channelsInByte array from List<String> channels */
|
||||
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) {
|
||||
reInitializeByteArray = true;
|
||||
@@ -92,7 +103,9 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
|
||||
|
||||
} catch (Exception e) {
|
||||
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);
|
||||
}
|
||||
try {
|
||||
@@ -100,6 +113,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (isKilled.get()) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,21 +123,30 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
|
||||
|
||||
@Override
|
||||
public void onMessage(byte[] channel, byte[] message) {
|
||||
String channelString = new String(channel);
|
||||
String channelString = new String(channel, StandardCharsets.UTF_8);
|
||||
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 {
|
||||
decrypted = encryption.decrypt(message);
|
||||
receivedMessage = encryption.decrypt(message);
|
||||
} catch (UnauthenticCiphertextException | IllegalBlockSizeException e) {
|
||||
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());
|
||||
plugin.getServer().getPluginManager().callEvent(new RedisMessageEvent(channelString, j.getString("Message")));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
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."));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -161,4 +184,25 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable{
|
||||
public Encryption getEncryption() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import ch.njol.skript.lang.Effect;
|
||||
import ch.njol.skript.lang.Expression;
|
||||
import ch.njol.skript.lang.SkriptParser;
|
||||
import ch.njol.util.Kleenean;
|
||||
import net.limework.core.LimeworkSpigotCore;
|
||||
import net.limework.core.RediSkript;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.Event;
|
||||
@@ -15,7 +15,6 @@ import redis.clients.jedis.BinaryJedis;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class EffSendMessage extends Effect {
|
||||
//"hi"
|
||||
static {
|
||||
Skript.registerEffect(EffSendMessage.class, "send redis message to channel %string% with message %string%");
|
||||
}
|
||||
@@ -27,7 +26,7 @@ public class EffSendMessage extends Effect {
|
||||
|
||||
@Override
|
||||
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 channel = this.channel.getSingle(event);
|
||||
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();
|
||||
json.put("Message", message);
|
||||
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;
|
||||
if (plugin.getRm().getEncryption().isEncryptionEnabled()) {
|
||||
msg = plugin.getRm().getEncryption().encrypt(json.toString());
|
||||
} else {
|
||||
msg = message.getBytes(StandardCharsets.UTF_8);
|
||||
msg = json.toString().getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
j.publish(channel.getBytes(), msg);
|
||||
//System.out.println("SkriptSide sent MESSAGE: ["+ message + "] to channel: " + channel + " and json: \n" + json.toString());
|
||||
j.publish(channel.getBytes(StandardCharsets.UTF_8), msg);
|
||||
j.close();
|
||||
});
|
||||
|
||||
@@ -56,7 +54,7 @@ public class EffSendMessage extends Effect {
|
||||
|
||||
@Override
|
||||
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")
|
||||
@@ -1,5 +1,4 @@
|
||||
package net.limework.core.skript.elements;
|
||||
;
|
||||
import ch.njol.skript.lang.Literal;
|
||||
import ch.njol.skript.lang.SkriptEvent;
|
||||
import ch.njol.skript.lang.SkriptParser;
|
||||
@@ -7,11 +6,8 @@ import org.bukkit.event.Event;
|
||||
|
||||
public class EvtRedis extends SkriptEvent {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean init(Literal<?>[] literals, int i, SkriptParser.ParseResult parseResult) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.limework.Data;
|
||||
package net.limework.data;
|
||||
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.cryptomator.siv.SivMode;
|
||||
@@ -26,11 +26,11 @@ public class Encryption {
|
||||
public boolean isEncryptionEnabled() { return encryptionEnabled; }
|
||||
|
||||
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) {
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
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"
|
||||
MaxConnections: 20
|
||||
Threads: 10
|
||||
#the default Redis port
|
||||
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
|
||||
#useful if SSL is disabled
|
||||
EncryptMessages: false
|
||||
#may be useful if you cannot use SSL due to use of older version of Redis
|
||||
#however this will not encrypt the initial authentication password, only the messages sent
|
||||
EncryptMessages: true
|
||||
EncryptionKey: "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:
|
||||
- "Channel1"
|
||||
- "Channel2"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
main: net.limework.core.LimeworkSpigotCore
|
||||
name: LimeworkSpigotCore
|
||||
main: net.limework.core.RediSkript
|
||||
name: RediSkript
|
||||
version: ${project.version}
|
||||
author: limework.net
|
||||
authors: [Govindas, ham1255, DaemonicKing]
|
||||
api-version: 1.13
|
||||
softdepend:
|
||||
- Skript
|
||||
commands:
|
||||
control:
|
||||
description: "server control"
|
||||
reloadredis:
|
||||
description: "Restart redis connection"
|
||||
permission: "admin.use"
|
||||
Reference in New Issue
Block a user