Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.cubenetwork.lokykun.cubestats.tables;
- import java.util.HashMap;
- import de.cubenetwork.lokykun.cubestats.CubeStatsPlugin;
- public class ItemUseTable {
- public int[] block;
- public int[] item;
- public int hand;
- public ItemUseTable(CubeStatsPlugin plugin) {
- // Array größe defenieren
- block = new int[94];
- item = new int[2002];
- hand = 0;
- }
- /**
- * Addiert block hinzu
- *
- * @param block
- */
- public void setInTable(int itemID) {
- if (itemID == 0){
- this.hand++;
- }else if (itemID >= 256){
- this.item[itemID-256]++;
- }else{
- this.block[itemID-1]++;
- }
- }
- /**
- * gibt den inhalt des Tabels als HashMap zurück
- * @return HashMap<Integer, Integer>
- */
- public HashMap<Integer, Integer> getHashMap(){
- HashMap<Integer, Integer> table = new HashMap<Integer, Integer>();
- if (hand > 0){
- table.put(0, hand);
- }
- for (int i = 0; i < block.length; i++) {
- if (block[i] > 0){
- table.put(i+1, block[i]);
- }
- }
- for (int i = 0; i < item.length; i++) {
- if (item[i] > 0){
- table.put(i+256, item[i]);
- }
- }
- return table;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement