bunch o' bugfixes

This commit is contained in:
yourfriendoss 2023-04-17 21:19:50 +03:00
parent a68178d0a8
commit 94ece84706
9 changed files with 45 additions and 41 deletions

View file

@ -46,12 +46,6 @@ public class MyCoolAnimal extends Animal {
public String chatTransformations(String message) {
return this.destroyer.destroy(message);
}
@Override
public Location movementTransformations(Location location) {
return location;
}
}
```
3. Change the info in the TextDestroyer initialization

View file

@ -62,6 +62,7 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
public class AnimalRP extends JavaPlugin {
public static HashMap<UUID, Animal> users = new HashMap<UUID, Animal>();
public static HashMap<UUID, Boolean> isChatModOff = new HashMap<UUID, Boolean>();
public static HashMap<UUID, Cooldown> cooldowns = new HashMap<UUID, Cooldown>();
public static HashMap<String, Animal> animals = new HashMap<String, Animal>();
public static Emote emotes;
@ -114,6 +115,7 @@ public class AnimalRP extends JavaPlugin {
animals.put("fox", new Fox());
animals.put("bee", new Bee());
// animals.put("phantom", new Phantom()); // finish Phantom
animals.forEach((z,b) -> {
pm.registerEvents(b, this);
});

View file

@ -3,7 +3,6 @@ package lv.pi.animalrp.animals;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -53,5 +52,4 @@ public abstract class Animal implements Listener {
}
public abstract String chatTransformations(String message);
public abstract Location movementTransformations(Location location);
}

View file

@ -3,7 +3,6 @@ package lv.pi.animalrp.animals;
import java.util.ArrayList;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
@ -93,10 +92,4 @@ public class Bee extends Animal {
public String chatTransformations(String message) {
return destroyer.destroy(message);
}
@Override
public Location movementTransformations(Location location) {
return location;
}
}

View file

@ -1,6 +1,5 @@
package lv.pi.animalrp.animals;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -59,10 +58,4 @@ public class Cat extends Animal {
public String chatTransformations(String message) {
return destroyer.destroy(message);
}
@Override
public Location movementTransformations(Location location) {
return location;
}
}

View file

@ -2,7 +2,6 @@ package lv.pi.animalrp.animals;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType;
@ -63,10 +62,4 @@ public class Fox extends Animal {
public String chatTransformations(String message) {
return this.destroyer.destroy(message);
}
@Override
public Location movementTransformations(Location location) {
return location;
}
}

View file

@ -2,7 +2,6 @@ package lv.pi.animalrp.animals;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -41,10 +40,4 @@ public class Phantom extends Animal {
public String chatTransformations(String message) {
return this.destroyer.destroy(message);
}
@Override
public Location movementTransformations(Location location) {
return location;
}
}

View file

@ -0,0 +1,37 @@
package lv.pi.animalrp.commands;
import java.util.stream.Collectors;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import lv.pi.animalrp.AnimalRP;
// TODO: Unfinished
public class ChatModCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender arg0, @NotNull Command arg1, @NotNull String arg2, @NotNull String[] arg3) {
if(!(arg0 instanceof Player)) {
arg0.sendMessage(AnimalRP.mm.deserialize("<gray>I'm sorry console. :(</gray>"));
return true;
}
Player player = (Player)arg0;
if(arg3.length == 0) {
options(player);
return true;
}
boolean off = false;
if(arg2.endsWith("off")) {
off = true;
}
return true;
}
}

View file

@ -20,14 +20,15 @@ public class TextDestroyer {
Random y = new Random();
for (String word : words) {
if((word.startsWith("[") && word.endsWith("]")) || word.startsWith("@")) {
out.add(word);
continue;
}
if(y.nextBoolean()){
out.add(word);
continue;
};
if(word.startsWith("[") && word.endsWith("]")) {
out.add(word);
continue;
}
for(String[] replacing: this.replaces) {
word = word.replace(replacing[0], replacing[1]);