From 8940793094f1a2848a28f80f2830e5d070f39f80 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Wed, 23 Aug 2017 15:58:26 -0400 Subject: [PATCH] Set Dictionary commands to modOnly --- An algorithmn for server backups.txt | 72 ------------------- plugin.yml | 4 +- .../dictionary/commands/SendJSON.java | 3 - .../dictionary/spawning/PlaySound.java | 15 +++- .../dictionary/spawning/SetBlock.java | 2 +- .../dictionary/spawning/SpawnCow.java | 2 +- .../dictionary/spawning/SpawnItem.java | 2 +- .../dictionary/spawning/SpawnMagicPotato.java | 2 +- .../dictionary/spawning/SpawnParticle.java | 2 +- target/classes/plugin.yml | 4 +- 10 files changed, 23 insertions(+), 85 deletions(-) delete mode 100644 An algorithmn for server backups.txt diff --git a/An algorithmn for server backups.txt b/An algorithmn for server backups.txt deleted file mode 100644 index 3467701..0000000 --- a/An algorithmn for server backups.txt +++ /dev/null @@ -1,72 +0,0 @@ -0 1 2 3 4 5 6 7 8 9 0 -X -X X -X X X -X - X X -X - X X X -X - X - X X -X - X - X X X -X - X - X - X X -X - X - X - X X X -X - - - X - X - X X -when 4 in a row, delete 2nd - -0 1 2 3 4 5 6 7 8 9 0 -1 -1 1 -1 1 1 -2 - 1 1 -2 - 1 1 1 -2 - 2 - 1 1 -2 - 2 - 1 1 1 -2 - 2 - 2 - 1 1 -2 - 2 - 2 - 1 1 1 -3 - - - 2 - 2 - 1 1 -3 - - - 2 - 2 - 1 1 1 -3 - - - 2 - 2 - 2 - 1 1 -3 - - - 2 - 2 - 2 - 1 1 1 -3 - - - 3 - - - 2 - 2 - 1 1 -3 - - - 3 - - - 2 - 2 - 1 1 1 -3 - - - 3 - - - 2 - 2 - 2 - 1 1 -3 - - - 3 - - - 2 - 2 - 2 - 1 1 1 -3 - - - 3 - - - 3 - - - 2 - 2 - 1 1 -3 - - - 3 - - - 3 - - - 2 - 2 - 1 1 1 -3 - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 -3 - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 1 -4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 1 1 -4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 1 1 1 -4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 -4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 1 -4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 1 1 -4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 1 1 1 -4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 -4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 1 -4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 1 1 -4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 1 1 1 -4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 -4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 1 -4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 1 1 -4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 1 1 1 -4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 -4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 1 -4 - - - - - - - 4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 1 1 -4 - - - - - - - 4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 -4 - - - - - - - 4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 1 -4 - - - - - - - 4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 1 1 -4 - - - - - - - 4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 1 1 1 -4 - - - - - - - 4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 -4 - - - - - - - 4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 3 - - - 2 - 2 - 2 - 1 1 1 -5 - - - - - - - - - - - - - - - 4 - - - - - - - 4 - - - - - - - 3 - - - 3 - - - 2 - 2 - 1 1 - - -The amount of data used, compared to data requested to save... is at most 3 * log2(n) -In other words, you can "save" 10000 data points, and have the algorithm back up only 3 * log2(n) of them -This means that... we can back up the server. Every hour. Every day. For 40 years. And only use 20 storage slots - -Problem is that inserting a new element may cause a chain reactin where data gets deleted and deleted. At worst case, it could be log(n) -If deleting server backups take time... then we should probably run server backups asyncronously or at off-hours of the server time -Still, this backup method is incredibly helpful. -2^n / 3 - - - diff --git a/plugin.yml b/plugin.yml index db0576d..49a3468 100644 --- a/plugin.yml +++ b/plugin.yml @@ -8,4 +8,6 @@ commands: rtp: description: A command that allows players to randomly teleport across the map spawn: - description: A set of commands designed to be used in spawn \ No newline at end of file + description: A set of commands designed to be used in spawn + magic: + description: A set of fun commands designed for cheaty stuff \ No newline at end of file diff --git a/src/main/java/buttondevteam/presents/dictionary/commands/SendJSON.java b/src/main/java/buttondevteam/presents/dictionary/commands/SendJSON.java index 2f02cce..e27fa2e 100644 --- a/src/main/java/buttondevteam/presents/dictionary/commands/SendJSON.java +++ b/src/main/java/buttondevteam/presents/dictionary/commands/SendJSON.java @@ -14,9 +14,6 @@ public class SendJSON extends ModCommand{ @Override public boolean OnCommand(Player player, String alias, String[] args) { - - - GsonBuilder builder = new GsonBuilder(); Gson gson = builder.create(); diff --git a/src/main/java/buttondevteam/presents/dictionary/spawning/PlaySound.java b/src/main/java/buttondevteam/presents/dictionary/spawning/PlaySound.java index cf695d8..285477d 100644 --- a/src/main/java/buttondevteam/presents/dictionary/spawning/PlaySound.java +++ b/src/main/java/buttondevteam/presents/dictionary/spawning/PlaySound.java @@ -13,13 +13,16 @@ public class PlaySound extends PlayerCommand{ public boolean OnCommand(Player player, String alias, String[] args) { int volume = 0; int pitch = 0; + + //parse arguments if (args.length >= 2){ try{ volume = Integer.parseInt(args[0]); pitch = Integer.parseInt(args[1]); }catch(NumberFormatException e){ - volume = 0; - pitch = 0; + + volume = pitch = 0; + player.sendMessage("Incorrect input:"); player.sendMessage(args[0] + " must be an int."); player.sendMessage(args[1] + " must be an int."); @@ -29,7 +32,13 @@ public class PlaySound extends PlayerCommand{ } } - player.getWorld().playSound(player.getLocation(), Sound.ENTITY_BLAZE_DEATH, volume, pitch); + + player.playSound( + player.getLocation(), + Sound.ENTITY_BLAZE_DEATH, + volume, //Volume + pitch); //Pitch + return true; } diff --git a/src/main/java/buttondevteam/presents/dictionary/spawning/SetBlock.java b/src/main/java/buttondevteam/presents/dictionary/spawning/SetBlock.java index 755c572..536e445 100644 --- a/src/main/java/buttondevteam/presents/dictionary/spawning/SetBlock.java +++ b/src/main/java/buttondevteam/presents/dictionary/spawning/SetBlock.java @@ -7,7 +7,7 @@ import org.bukkit.entity.Player; import buttondevteam.lib.chat.CommandClass; import buttondevteam.presents.architecture.commands.PlayerCommand; -@CommandClass(path = "dictionary block") +@CommandClass(path = "dictionary block", modOnly=true) public class SetBlock extends PlayerCommand { @Override diff --git a/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnCow.java b/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnCow.java index 8ee1b93..e460e9d 100644 --- a/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnCow.java +++ b/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnCow.java @@ -5,7 +5,7 @@ import org.bukkit.entity.Player; import buttondevteam.lib.chat.CommandClass; import buttondevteam.presents.architecture.commands.PlayerCommand; -@CommandClass(path = "dictionary cow") +@CommandClass(path = "dictionary cow", modOnly=true) public class SpawnCow extends PlayerCommand { @Override diff --git a/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnItem.java b/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnItem.java index ae1aa2a..73e7b8c 100644 --- a/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnItem.java +++ b/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnItem.java @@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack; import buttondevteam.lib.chat.CommandClass; import buttondevteam.presents.architecture.commands.ModCommand; -@CommandClass(path = "dictionary item") +@CommandClass(path = "dictionary item", modOnly=true) public class SpawnItem extends ModCommand { @Override diff --git a/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnMagicPotato.java b/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnMagicPotato.java index ceb5791..8df1c00 100644 --- a/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnMagicPotato.java +++ b/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnMagicPotato.java @@ -11,7 +11,7 @@ import org.bukkit.inventory.meta.ItemMeta; import buttondevteam.lib.chat.CommandClass; import buttondevteam.presents.architecture.commands.ModCommand; -@CommandClass(path = "dictionary magicpotato") +@CommandClass(path = "dictionary magicpotato", modOnly=true) public class SpawnMagicPotato extends ModCommand { @Override diff --git a/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnParticle.java b/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnParticle.java index c4556b4..cc45394 100644 --- a/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnParticle.java +++ b/src/main/java/buttondevteam/presents/dictionary/spawning/SpawnParticle.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; import buttondevteam.lib.chat.CommandClass; import buttondevteam.presents.architecture.commands.PlayerCommand; -@CommandClass(path = "dictionary particle") +@CommandClass(path = "dictionary particle", modOnly=true) public class SpawnParticle extends PlayerCommand { @Override diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml index db0576d..49a3468 100644 --- a/target/classes/plugin.yml +++ b/target/classes/plugin.yml @@ -8,4 +8,6 @@ commands: rtp: description: A command that allows players to randomly teleport across the map spawn: - description: A set of commands designed to be used in spawn \ No newline at end of file + description: A set of commands designed to be used in spawn + magic: + description: A set of fun commands designed for cheaty stuff \ No newline at end of file