mirror of
https://github.com/darksaid98/EntityBingo.git
synced 2026-12-01 15:58:46 +00:00
Base framework
This commit is contained in:
1 parent
d97d25e7c6
commit
c54512bfb6
7 files changed
+110
-3
No files matched your search
@@ -0,0 +1,53 @@
|
||||
package org.aubrithehuman.entitybingo;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class BingoEvent {
|
||||
|
||||
private final HashMap<String, Integer> entries;
|
||||
|
||||
|
||||
public BingoEvent() {
|
||||
this.entries = new HashMap<>();
|
||||
}
|
||||
|
||||
public HashMap<String, Integer> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* return true if player has not yet made a guess, else return false
|
||||
*
|
||||
* @param player player
|
||||
* @param value value
|
||||
* @return previous guess
|
||||
*/
|
||||
public boolean addEntry(String player, int value) {
|
||||
if(entries.containsKey(player)) {
|
||||
entries.put(player, value);
|
||||
return true;
|
||||
} else {
|
||||
entries.put(player, value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int totalGuesses() {
|
||||
return this.entries.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a player based on the entry, if none match then return null;
|
||||
*
|
||||
* @param i value
|
||||
* @return player
|
||||
*/
|
||||
public String getByEntry(int i) {
|
||||
for(String s : entries.keySet()) {
|
||||
if (entries.get(s) == i) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public final class EntityBingo extends JavaPlugin implements Listener {
|
||||
|
||||
DataManager.init();
|
||||
|
||||
this.getLogger().info("EntityBingo loaded");
|
||||
this.getLogger().info("EntityBingo loaded.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.aubrithehuman.entitybingo.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityBingoCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
private final List<String> options = List.of(new String[] {
|
||||
"scoreboard"
|
||||
});
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(args.length >= 1) {
|
||||
if(args[0].equalsIgnoreCase("scoreboard")) {
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(args.length >= 1) {
|
||||
return options;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.aubrithehuman.entitybingo.listeners;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
public class ChatListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onChat(PlayerCommandPreprocessEvent e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -2,3 +2,9 @@ name: EntityBingo
|
||||
version: '${project.version}'
|
||||
main: org.aubrithehuman.entitybingo.EntityBingo
|
||||
api-version: 1.19
|
||||
|
||||
commands:
|
||||
entitybingo:
|
||||
description: used to display the scoreboard.
|
||||
usage: /entitybingo
|
||||
aliases: [eb, entb]
|
||||
Reference in new issue
Block a user