Set Dictionary commands to modOnly

This commit is contained in:
alisolarflare 2017-08-23 15:58:26 -04:00
parent 303a9cce8a
commit 8940793094
10 changed files with 23 additions and 85 deletions

View file

@ -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

View file

@ -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
description: A set of commands designed to be used in spawn
magic:
description: A set of fun commands designed for cheaty stuff

View file

@ -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();

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
description: A set of commands designed to be used in spawn
magic:
description: A set of fun commands designed for cheaty stuff