More cleanup. Done with Datatypes. Lack Events, Runnables, and...

Commands.
This commit is contained in:
GJ 2012-03-31 19:00:41 -04:00
parent bb5a9826bc
commit a2f23bd056
8 changed files with 200 additions and 191 deletions

View File

@ -17,7 +17,7 @@ import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.spout.SpoutStuff;
public class HUDmmo {
private int center_x = 427/2;
private int center_x = 427 / 2;
private String playerName = null;

View File

@ -10,4 +10,4 @@ public class ButtonEscape extends GenericButton {
this.setHeight(20);
this.setDirty(true);
}
}
}

View File

@ -5,10 +5,10 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
public class ButtonHUDStyle extends ButtonToggle {
public ButtonHUDStyle(PlayerProfile PP) {
super("HUD Type: ", PP.getHUDType().toString(), "Change your HUD style!");
super("HUD Type: ", PP.getHUDType().toString(), "Change your HUD style!"); //TODO: Needs more locale
}
public void updateText(PlayerProfile PP) {
super.updateText("HUD Type: ", PP.getHUDType().toString());
super.updateText("HUD Type: ", PP.getHUDType().toString()); //TODO: Needs more locale
}
}

View File

@ -5,10 +5,10 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
public class ButtonPartyToggle extends ButtonToggle {
public ButtonPartyToggle(PlayerProfile PP) {
super("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString(), "Toggle the Party HUD!");
super("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString(), "Toggle the Party HUD!"); //TODO: Needs more locale
}
public void updateText(PlayerProfile PP) {
super.updateText("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString());
super.updateText("Party HUD: ", ((Boolean) PP.getPartyHUD()).toString()); //TODO: Needs more locale
}
}

View File

@ -11,49 +11,58 @@ import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
public class PopupMMO extends GenericPopup
{
ButtonHUDStyle HUDButton = null;
ButtonPartyToggle PartyButton = null;
ButtonEscape EscapeButton = null;
GenericLabel mcMMO_label = new GenericLabel();
GenericLabel tip_escape = new GenericLabel();
int center_x = 427/2;
int center_y = 240/2;
public PopupMMO(Player player, PlayerProfile PP, mcMMO plugin)
{
//240, 427 are the bottom right
mcMMO_label.setText(ChatColor.GOLD+"~mcMMO Menu~");
mcMMO_label.setX(center_x-35).setY((center_y/2)-20).setDirty(true);
tip_escape.setText(ChatColor.GRAY+"Press ESCAPE to exit!");
tip_escape.setX(mcMMO_label.getX()-15).setY(mcMMO_label.getY()+10).setDirty(true);
HUDButton = new ButtonHUDStyle(PP);
HUDButton.setX(center_x-(HUDButton.getWidth()/2)).setY(center_y/2).setDirty(true);
if(LoadProperties.partybar)
{
PartyButton = new ButtonPartyToggle(PP);
PartyButton.setX(center_x-(PartyButton.getWidth()/2)).setY(center_y/2+PartyButton.getHeight()).setDirty(true);
this.attachWidget(plugin, PartyButton);
}
EscapeButton = new ButtonEscape();
EscapeButton.setX(center_x-(EscapeButton.getWidth()/2)).setY((center_y/2)+(HUDButton.getHeight()*2)+5).setDirty(true);
this.attachWidget(plugin, HUDButton);
this.attachWidget(plugin, mcMMO_label);
this.attachWidget(plugin, tip_escape);
this.attachWidget(plugin, EscapeButton);
this.setDirty(true);
}
public void updateButtons(PlayerProfile PP)
{
HUDButton.updateText(PP);
this.setDirty(true);
}
public class PopupMMO extends GenericPopup {
private ButtonHUDStyle HUDButton = null;
private ButtonPartyToggle PartyButton = null;
private ButtonEscape EscapeButton = null;
private GenericLabel mcMMO_label = new GenericLabel();
private GenericLabel tip_escape = new GenericLabel();
private int center_x = 427 / 2;
private int center_y = 240 / 2;
public PopupMMO(Player player, PlayerProfile PP, mcMMO plugin) {
//240, 427 are the bottom right
mcMMO_label.setText(ChatColor.GOLD + "~mcMMO Menu~"); //TODO: Needs more locale
mcMMO_label.setX(center_x - 35);
mcMMO_label.setY((center_y / 2) - 20);
mcMMO_label.setDirty(true);
tip_escape.setText(ChatColor.GRAY + "Press ESCAPE to exit!"); //TODO: Needs more locale
tip_escape.setX(mcMMO_label.getX() - 15);
tip_escape.setY(mcMMO_label.getY() + 10);
tip_escape.setDirty(true);
HUDButton = new ButtonHUDStyle(PP);
HUDButton.setX(center_x - (HUDButton.getWidth() / 2));
HUDButton.setY(center_y / 2);
HUDButton.setDirty(true);
if (LoadProperties.partybar) {
PartyButton = new ButtonPartyToggle(PP);
PartyButton.setX(center_x - (PartyButton.getWidth() / 2));
PartyButton.setY((center_y / 2) + PartyButton.getHeight());
PartyButton.setDirty(true);
this.attachWidget(plugin, PartyButton);
}
EscapeButton = new ButtonEscape();
EscapeButton.setX(center_x - (EscapeButton.getWidth() / 2));
EscapeButton.setY((center_y / 2) + (HUDButton.getHeight() * 2) + 5);
EscapeButton.setDirty(true);
this.attachWidget(plugin, HUDButton);
this.attachWidget(plugin, mcMMO_label);
this.attachWidget(plugin, tip_escape);
this.attachWidget(plugin, EscapeButton);
this.setDirty(true);
}
public void updateButtons(PlayerProfile PP) {
HUDButton.updateText(PP);
PartyButton.updateText(PP);
this.setDirty(true);
}
}

View File

@ -3,125 +3,126 @@ package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public class ExcavationTreasure extends Treasure {
// dirt grass sand gravel clay mycel soulsand
// 00000001 - dirt 1
// 00000010 - grass 2
// 00000100 - sand 4
// 00001000 - gravel 8
// 00010000 - clay 16
// 00100000 - mycel 32
// 01000000 - soulsand 64
private byte dropsFrom = 0x0;
public ExcavationTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
super(drop, xp, dropChance, dropLevel);
}
// dirt | grass | sand | gravel | clay | mycel | soulsand
// 00000001 - dirt 1
// 00000010 - grass 2
// 00000100 - sand 4
// 00001000 - gravel 8
// 00010000 - clay 16
// 00100000 - mycel 32
// 01000000 - soulsand 64
private byte dropsFrom = 0x0;
// Raw getters and setters
public byte getDropsFrom() {
return dropsFrom;
}
public ExcavationTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
super(drop, xp, dropChance, dropLevel);
}
public void setDropsFrom(byte dropsFrom) {
this.dropsFrom = dropsFrom;
}
// Raw getters and setters
public byte getDropsFrom() {
return dropsFrom;
}
// Getters
public boolean getDropsFromDirt() {
return getDropFromMask(1);
}
public void setDropsFrom(byte dropsFrom) {
this.dropsFrom = dropsFrom;
}
public boolean getDropsFromGrass() {
return getDropFromMask(2);
}
// Getters
public boolean getDropsFromDirt() {
return getDropFromMask(1);
}
public boolean getDropsFromSand() {
return getDropFromMask(4);
}
public boolean getDropsFromGrass() {
return getDropFromMask(2);
}
public boolean getDropsFromGravel() {
return getDropFromMask(8);
}
public boolean getDropsFromSand() {
return getDropFromMask(4);
}
public boolean getDropsFromClay() {
return getDropFromMask(16);
}
public boolean getDropsFromGravel() {
return getDropFromMask(8);
}
public boolean getDropsFromMycel() {
return getDropFromMask(32);
}
public boolean getDropsFromClay() {
return getDropFromMask(16);
}
public boolean getDropsFromSoulSand() {
return getDropFromMask(64);
}
public boolean getDropsFromMycel() {
return getDropFromMask(32);
}
private boolean getDropFromMask(int mask) {
return ((dropsFrom & mask) > 0) ? true : false;
}
public boolean getDropsFromSoulSand() {
return getDropFromMask(64);
}
// Setters
public void setDropsFromDirt() {
setDropFromMask(1);
}
private boolean getDropFromMask(int mask) {
return ((dropsFrom & mask) > 0) ? true : false;
}
public void setDropsFromGrass() {
setDropFromMask(2);
}
// Setters
public void setDropsFromDirt() {
setDropFromMask(1);
}
public void setDropsFromSand() {
setDropFromMask(4);
}
public void setDropsFromGrass() {
setDropFromMask(2);
}
public void setDropsFromGravel() {
setDropFromMask(8);
}
public void setDropsFromSand() {
setDropFromMask(4);
}
public void setDropsFromClay() {
setDropFromMask(16);
}
public void setDropsFromGravel() {
setDropFromMask(8);
}
public void setDropsFromMycel() {
setDropFromMask(32);
}
public void setDropsFromClay() {
setDropFromMask(16);
}
public void setDropsFromSoulSand() {
setDropFromMask(64);
}
public void setDropsFromMycel() {
setDropFromMask(32);
}
private void setDropFromMask(int mask) {
dropsFrom |= mask;
}
public void setDropsFromSoulSand() {
setDropFromMask(64);
}
// Un-setters
public void unsetDropsFromDirt() {
unsetDropFromMask(1);
}
private void setDropFromMask(int mask) {
dropsFrom |= mask;
}
public void unsetDropsFromGrass() {
unsetDropFromMask(2);
}
// Un-setters
public void unsetDropsFromDirt() {
unsetDropFromMask(1);
}
public void unsetDropsFromSand() {
unsetDropFromMask(4);
}
public void unsetDropsFromGrass() {
unsetDropFromMask(2);
}
public void unsetDropsFromGravel() {
unsetDropFromMask(8);
}
public void unsetDropsFromSand() {
unsetDropFromMask(4);
}
public void unsetDropsFromClay() {
unsetDropFromMask(16);
}
public void unsetDropsFromGravel() {
unsetDropFromMask(8);
}
public void unsetDropsFromMycel() {
unsetDropFromMask(32);
}
public void unsetDropsFromClay() {
unsetDropFromMask(16);
}
public void unsetDropsFromSoulSand() {
unsetDropFromMask(64);
}
public void unsetDropsFromMycel() {
unsetDropFromMask(32);
}
private void unsetDropFromMask(int mask) {
dropsFrom &= ~mask;
}
public void unsetDropsFromSoulSand() {
unsetDropFromMask(64);
}
private void unsetDropFromMask(int mask) {
dropsFrom &= ~mask;
}
}

View File

@ -3,18 +3,18 @@ package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public class FishingTreasure extends Treasure {
private int maxLevel;
private int maxLevel;
public FishingTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel, int maxLevel) {
super(drop, xp, dropChance, dropLevel);
this.setMaxLevel(maxLevel);
}
public FishingTreasure(ItemStack drop, int xp, Double dropChance, int dropLevel, int maxLevel) {
super(drop, xp, dropChance, dropLevel);
this.setMaxLevel(maxLevel);
}
public int getMaxLevel() {
return maxLevel;
}
public int getMaxLevel() {
return maxLevel;
}
public void setMaxLevel(int maxLevel) {
this.maxLevel = maxLevel;
}
public void setMaxLevel(int maxLevel) {
this.maxLevel = maxLevel;
}
}

View File

@ -3,48 +3,47 @@ package com.gmail.nossr50.datatypes.treasure;
import org.bukkit.inventory.ItemStack;
public abstract class Treasure {
private int xp;
private Double dropChance;
private int dropLevel;
private int xp;
private Double dropChance;
private int dropLevel;
private ItemStack drop;
private ItemStack drop;
public Treasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
this.drop = drop;
this.xp = xp;
this.dropChance = dropChance;
this.dropLevel = dropLevel;
}
public Treasure(ItemStack drop, int xp, Double dropChance, int dropLevel) {
this.drop = drop;
this.xp = xp;
this.dropChance = dropChance;
this.dropLevel = dropLevel;
}
public ItemStack getDrop() {
return drop;
}
public ItemStack getDrop() {
return drop;
}
public void setDrop(ItemStack drop) {
this.drop = drop;
}
public void setDrop(ItemStack drop) {
this.drop = drop;
}
public int getXp() {
return xp;
}
public int getXp() {
return xp;
}
public void setXp(int xp) {
this.xp = xp;
}
public void setXp(int xp) {
this.xp = xp;
}
public Double getDropChance() {
return dropChance;
}
public Double getDropChance() {
return dropChance;
}
public void setDropChance(Double dropChance) {
this.dropChance = dropChance;
}
public void setDropChance(Double dropChance) {
this.dropChance = dropChance;
}
public int getDropLevel() {
return dropLevel;
}
public int getDropLevel() {
return dropLevel;
}
public void setDropLevel(int dropLevel) {
this.dropLevel = dropLevel;
}
public void setDropLevel(int dropLevel) {
this.dropLevel = dropLevel;
}
}