bunch o' bugfixes
This commit is contained in:
parent
a68178d0a8
commit
94ece84706
|
@ -46,12 +46,6 @@ public class MyCoolAnimal extends Animal {
|
||||||
public String chatTransformations(String message) {
|
public String chatTransformations(String message) {
|
||||||
return this.destroyer.destroy(message);
|
return this.destroyer.destroy(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location movementTransformations(Location location) {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
3. Change the info in the TextDestroyer initialization
|
3. Change the info in the TextDestroyer initialization
|
||||||
|
|
|
@ -62,6 +62,7 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
|
|
||||||
public class AnimalRP extends JavaPlugin {
|
public class AnimalRP extends JavaPlugin {
|
||||||
public static HashMap<UUID, Animal> users = new HashMap<UUID, Animal>();
|
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<UUID, Cooldown> cooldowns = new HashMap<UUID, Cooldown>();
|
||||||
public static HashMap<String, Animal> animals = new HashMap<String, Animal>();
|
public static HashMap<String, Animal> animals = new HashMap<String, Animal>();
|
||||||
public static Emote emotes;
|
public static Emote emotes;
|
||||||
|
@ -114,6 +115,7 @@ public class AnimalRP extends JavaPlugin {
|
||||||
animals.put("fox", new Fox());
|
animals.put("fox", new Fox());
|
||||||
animals.put("bee", new Bee());
|
animals.put("bee", new Bee());
|
||||||
// animals.put("phantom", new Phantom()); // finish Phantom
|
// animals.put("phantom", new Phantom()); // finish Phantom
|
||||||
|
|
||||||
animals.forEach((z,b) -> {
|
animals.forEach((z,b) -> {
|
||||||
pm.registerEvents(b, this);
|
pm.registerEvents(b, this);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,6 @@ package lv.pi.animalrp.animals;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
@ -53,5 +52,4 @@ public abstract class Animal implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String chatTransformations(String message);
|
public abstract String chatTransformations(String message);
|
||||||
public abstract Location movementTransformations(Location location);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package lv.pi.animalrp.animals;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
@ -93,10 +92,4 @@ public class Bee extends Animal {
|
||||||
public String chatTransformations(String message) {
|
public String chatTransformations(String message) {
|
||||||
return destroyer.destroy(message);
|
return destroyer.destroy(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location movementTransformations(Location location) {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package lv.pi.animalrp.animals;
|
package lv.pi.animalrp.animals;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -59,10 +58,4 @@ public class Cat extends Animal {
|
||||||
public String chatTransformations(String message) {
|
public String chatTransformations(String message) {
|
||||||
return destroyer.destroy(message);
|
return destroyer.destroy(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location movementTransformations(Location location) {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,7 +2,6 @@ package lv.pi.animalrp.animals;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
@ -63,10 +62,4 @@ public class Fox extends Animal {
|
||||||
public String chatTransformations(String message) {
|
public String chatTransformations(String message) {
|
||||||
return this.destroyer.destroy(message);
|
return this.destroyer.destroy(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location movementTransformations(Location location) {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,7 +2,6 @@ package lv.pi.animalrp.animals;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
|
||||||
|
@ -41,10 +40,4 @@ public class Phantom extends Animal {
|
||||||
public String chatTransformations(String message) {
|
public String chatTransformations(String message) {
|
||||||
return this.destroyer.destroy(message);
|
return this.destroyer.destroy(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location movementTransformations(Location location) {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
37
src/main/java/lv/pi/animalrp/commands/ChatModCommand.java
Normal file
37
src/main/java/lv/pi/animalrp/commands/ChatModCommand.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -20,14 +20,15 @@ public class TextDestroyer {
|
||||||
Random y = new Random();
|
Random y = new Random();
|
||||||
|
|
||||||
for (String word : words) {
|
for (String word : words) {
|
||||||
|
if((word.startsWith("[") && word.endsWith("]")) || word.startsWith("@")) {
|
||||||
|
out.add(word);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(y.nextBoolean()){
|
if(y.nextBoolean()){
|
||||||
out.add(word);
|
out.add(word);
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
if(word.startsWith("[") && word.endsWith("]")) {
|
|
||||||
out.add(word);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(String[] replacing: this.replaces) {
|
for(String[] replacing: this.replaces) {
|
||||||
word = word.replace(replacing[0], replacing[1]);
|
word = word.replace(replacing[0], replacing[1]);
|
||||||
|
|
Loading…
Reference in a new issue