mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Another WIP
This commit is contained in:
parent
ea3c762de5
commit
580961662e
@ -6,6 +6,7 @@ Version 1.1.14
|
|||||||
[1.8] Swords no longer parry, no need to compete with in game mechanics
|
[1.8] Swords no longer parry, no need to compete with in game mechanics
|
||||||
[1.8] mcMMO no longer has an HP Regen system, no need to compete with in game mechanics
|
[1.8] mcMMO no longer has an HP Regen system, no need to compete with in game mechanics
|
||||||
[SPOUT] mcMMO now transfers files between [MC Server] -> [Client] rather than [Webserver] -> [Client]
|
[SPOUT] mcMMO now transfers files between [MC Server] -> [Client] rather than [Webserver] -> [Client]
|
||||||
|
[SPOUT] Temporarily disabled the PartyHUD due to some performance issues
|
||||||
[SPOUT/CONFIG] mcMMO now allows for disabling of the party HUD with the node Spout.Party.HUD.Enabled
|
[SPOUT/CONFIG] mcMMO now allows for disabling of the party HUD with the node Spout.Party.HUD.Enabled
|
||||||
[BUG] Fixed a few problems with readying abilities for Woodcutting/Axes
|
[BUG] Fixed a few problems with readying abilities for Woodcutting/Axes
|
||||||
[MYSQL] Improvements have been made to the performance of MySQL thanks to krinsdeath
|
[MYSQL] Improvements have been made to the performance of MySQL thanks to krinsdeath
|
||||||
|
@ -23,7 +23,7 @@ import com.gmail.nossr50.datatypes.HUDType;
|
|||||||
|
|
||||||
public class LoadProperties
|
public class LoadProperties
|
||||||
{
|
{
|
||||||
public static Boolean watch, xplockEnable, xpbar, xpicon, partybar, string, bucket, web, xprateEnable, slimeballs, spoutEnabled,
|
public static Boolean showDisplayName, showFaces, watch, xplockEnable, xpbar, xpicon, partybar, string, bucket, web, xprateEnable, slimeballs, spoutEnabled,
|
||||||
donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable,
|
donateMessage, chimaeraWingEnable, xpGainsMobSpawners, myspawnEnable, mccEnable, mcmmoEnable, partyEnable, inviteEnable, acceptEnable,
|
||||||
whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable,
|
whoisEnable, statsEnable, addxpEnable, ptpEnable, mmoeditEnable, clearmyspawnEnable, mcgodEnable, mcabilityEnable, mctopEnable,
|
||||||
mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms,
|
mcrefreshEnable, enableMotd, enableMySpawn, enableRegen, enableCobbleToMossy, useMySQL, cocoabeans, archeryFireRateLimit, mushrooms,
|
||||||
@ -138,6 +138,8 @@ public class LoadProperties
|
|||||||
write("Spout.XP.Icon.X_POS", 78);
|
write("Spout.XP.Icon.X_POS", 78);
|
||||||
write("Spout.XP.Icon.Y_POS", 2);
|
write("Spout.XP.Icon.Y_POS", 2);
|
||||||
write("Spout.Party.HUD.Enabled", true);
|
write("Spout.Party.HUD.Enabled", true);
|
||||||
|
write("Spout.Party.HUD.Show_Faces", true);
|
||||||
|
write("Spout.Party.HUD.Show_Display_Name", false);
|
||||||
write("Spout.Menu.Key", "KEY_M");
|
write("Spout.Menu.Key", "KEY_M");
|
||||||
write("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
|
write("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
|
||||||
write("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
|
write("Spout.HUD.Retro.Colors.Acrobatics.GREEN", 0.3);
|
||||||
@ -365,6 +367,9 @@ public class LoadProperties
|
|||||||
xpbar_y = readInteger("Spout.XP.Bar.Y_POS", 6);
|
xpbar_y = readInteger("Spout.XP.Bar.Y_POS", 6);
|
||||||
xpicon_x = readInteger("Spout.XP.Icon.X_POS", 78);
|
xpicon_x = readInteger("Spout.XP.Icon.X_POS", 78);
|
||||||
xpicon_y = readInteger("Spout.XP.Icon.Y_POS", 2);
|
xpicon_y = readInteger("Spout.XP.Icon.Y_POS", 2);
|
||||||
|
|
||||||
|
showFaces = readBoolean("Spout.Party.HUD.Show_Faces", true);
|
||||||
|
showDisplayName = readBoolean("Spout.Party.HUD.Show_Display_Name", false);
|
||||||
partybar = readBoolean("Spout.Party.HUD.Enabled", true);
|
partybar = readBoolean("Spout.Party.HUD.Enabled", true);
|
||||||
|
|
||||||
acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
|
acrobatics_r = readDouble("Spout.HUD.Retro.Colors.Acrobatics.RED", 0.3);
|
||||||
|
@ -18,6 +18,7 @@ package com.gmail.nossr50.datatypes;
|
|||||||
|
|
||||||
public enum HUDType
|
public enum HUDType
|
||||||
{
|
{
|
||||||
|
DISABLED,
|
||||||
STANDARD,
|
STANDARD,
|
||||||
SMALL,
|
SMALL,
|
||||||
RETRO;
|
RETRO;
|
||||||
|
@ -31,7 +31,6 @@ import com.gmail.nossr50.m;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.spout.SpoutStuff;
|
import com.gmail.nossr50.spout.SpoutStuff;
|
||||||
import com.gmail.nossr50.spout.mmoHelper;
|
|
||||||
|
|
||||||
public class HUDmmo
|
public class HUDmmo
|
||||||
{
|
{
|
||||||
@ -55,10 +54,11 @@ public class HUDmmo
|
|||||||
|
|
||||||
public void initializeHUD(Player player)
|
public void initializeHUD(Player player)
|
||||||
{
|
{
|
||||||
|
//PlayerProfile PP = Users.getProfile(player);
|
||||||
HUDType type = Users.getProfile(player).getHUDType();
|
HUDType type = Users.getProfile(player).getHUDType();
|
||||||
|
|
||||||
if(LoadProperties.partybar)
|
//if(LoadProperties.partybar && PP.getPartyHUD())
|
||||||
mmoHelper.initialize(SpoutManager.getPlayer(player), plugin); //PARTY HUD
|
//mmoHelper.initialize(SpoutManager.getPlayer(player), plugin); //PARTY HUD
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
@ -77,6 +77,10 @@ public class HUDmmo
|
|||||||
initializeXpBarDisplaySmall(SpoutManager.getPlayer(player));
|
initializeXpBarDisplaySmall(SpoutManager.getPlayer(player));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DISABLED:
|
||||||
|
{
|
||||||
|
//Do nothing.. :)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,12 +103,17 @@ public class HUDmmo
|
|||||||
updateXpBarStandard(player, Users.getProfile(player));
|
updateXpBarStandard(player, Users.getProfile(player));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DISABLED:
|
||||||
|
{
|
||||||
|
//Do nothing.. :)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetHUD()
|
public void resetHUD()
|
||||||
{
|
{
|
||||||
SpoutPlayer sPlayer = SpoutStuff.getSpoutPlayer(playerName);
|
SpoutPlayer sPlayer = SpoutStuff.getSpoutPlayer(playerName);
|
||||||
|
//PlayerProfile PP = Users.getProfile(sPlayer);
|
||||||
if(sPlayer != null)
|
if(sPlayer != null)
|
||||||
{
|
{
|
||||||
sPlayer.getMainScreen().removeWidgets(plugin);
|
sPlayer.getMainScreen().removeWidgets(plugin);
|
||||||
@ -115,8 +124,8 @@ public class HUDmmo
|
|||||||
xpbg = null;
|
xpbg = null;
|
||||||
xpicon = null;
|
xpicon = null;
|
||||||
|
|
||||||
if(LoadProperties.partybar)
|
//if(LoadProperties.partybar && PP.getPartyHUD())
|
||||||
mmoHelper.initialize(sPlayer, plugin);
|
//mmoHelper.initialize(sPlayer, plugin);
|
||||||
|
|
||||||
sPlayer.getMainScreen().setDirty(true);
|
sPlayer.getMainScreen().setDirty(true);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class PlayerProfile
|
|||||||
private String party, myspawn, myspawnworld, invite;
|
private String party, myspawn, myspawnworld, invite;
|
||||||
|
|
||||||
//TOGGLES
|
//TOGGLES
|
||||||
private boolean spoutcraft = false, filling = false, xpbarlocked = false, placedAnvil = false, partyChatMode = false, adminChatMode = false, godMode = false, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
|
private boolean partyhud = true, spoutcraft = false, filling = false, xpbarlocked = false, placedAnvil = false, partyChatMode = false, adminChatMode = false, godMode = false, greenTerraMode, partyChatOnly = false, greenTerraInformed = true, berserkInformed = true, skullSplitterInformed = true, gigaDrillBreakerInformed = true,
|
||||||
superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode,
|
superBreakerInformed = true, serratedStrikesInformed = true, treeFellerInformed = true, dead, abilityuse = true, treeFellerMode, superBreakerMode, gigaDrillBreakerMode,
|
||||||
serratedStrikesMode, hoePreparationMode = false, shovelPreparationMode = false, swordsPreparationMode = false, fistsPreparationMode = false, pickaxePreparationMode = false, axePreparationMode = false, skullSplitterMode, berserkMode;
|
serratedStrikesMode, hoePreparationMode = false, shovelPreparationMode = false, swordsPreparationMode = false, fistsPreparationMode = false, pickaxePreparationMode = false, axePreparationMode = false, skullSplitterMode, berserkMode;
|
||||||
|
|
||||||
@ -472,6 +472,14 @@ public class PlayerProfile
|
|||||||
log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
|
log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void togglePartyHUD()
|
||||||
|
{
|
||||||
|
partyhud = !partyhud;
|
||||||
|
}
|
||||||
|
public boolean getPartyHUD()
|
||||||
|
{
|
||||||
|
return partyhud;
|
||||||
|
}
|
||||||
public void toggleSpoutEnabled()
|
public void toggleSpoutEnabled()
|
||||||
{
|
{
|
||||||
spoutcraft = !spoutcraft;
|
spoutcraft = !spoutcraft;
|
||||||
@ -492,6 +500,7 @@ public class PlayerProfile
|
|||||||
public void setHUDType(HUDType type)
|
public void setHUDType(HUDType type)
|
||||||
{
|
{
|
||||||
hud = type;
|
hud = type;
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
public boolean getXpBarLocked()
|
public boolean getXpBarLocked()
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
This file is part of mcMMO.
|
||||||
|
|
||||||
|
mcMMO is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
mcMMO is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.gmail.nossr50.datatypes.buttons;
|
||||||
|
|
||||||
|
import org.getspout.spoutapi.gui.GenericButton;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
|
||||||
|
public class ButtonPartyToggle extends GenericButton
|
||||||
|
{
|
||||||
|
public ButtonPartyToggle(PlayerProfile PP)
|
||||||
|
{
|
||||||
|
this.setText("Party HUD: "+PP.getPartyHUD());
|
||||||
|
this.setTooltip("Toggle the Party HUD!");
|
||||||
|
this.setWidth(120).setHeight(20);
|
||||||
|
this.setDirty(true);
|
||||||
|
}
|
||||||
|
public void updateText(PlayerProfile PP)
|
||||||
|
{
|
||||||
|
this.setText("Party HUD: "+PP.getPartyHUD());
|
||||||
|
this.setDirty(true);
|
||||||
|
}
|
||||||
|
}
|
@ -21,13 +21,16 @@ import org.bukkit.entity.Player;
|
|||||||
import org.getspout.spoutapi.gui.GenericLabel;
|
import org.getspout.spoutapi.gui.GenericLabel;
|
||||||
import org.getspout.spoutapi.gui.GenericPopup;
|
import org.getspout.spoutapi.gui.GenericPopup;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
|
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
|
||||||
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
|
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
|
||||||
|
import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
|
||||||
|
|
||||||
public class PopupMMO extends GenericPopup
|
public class PopupMMO extends GenericPopup
|
||||||
{
|
{
|
||||||
ButtonHUDStyle HUDButton = null;
|
ButtonHUDStyle HUDButton = null;
|
||||||
|
ButtonPartyToggle PartyButton = null;
|
||||||
ButtonEscape EscapeButton = null;
|
ButtonEscape EscapeButton = null;
|
||||||
GenericLabel mcMMO_label = new GenericLabel();
|
GenericLabel mcMMO_label = new GenericLabel();
|
||||||
GenericLabel tip_escape = new GenericLabel();
|
GenericLabel tip_escape = new GenericLabel();
|
||||||
@ -46,8 +49,15 @@ public class PopupMMO extends GenericPopup
|
|||||||
HUDButton = new ButtonHUDStyle(PP);
|
HUDButton = new ButtonHUDStyle(PP);
|
||||||
HUDButton.setX(center_x-(HUDButton.getWidth()/2)).setY(center_y/2).setDirty(true);
|
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 = new ButtonEscape();
|
||||||
EscapeButton.setX(center_x-(EscapeButton.getWidth()/2)).setY((center_y/2)+HUDButton.getHeight()+5).setDirty(true);
|
EscapeButton.setX(center_x-(EscapeButton.getWidth()/2)).setY((center_y/2)+(HUDButton.getHeight()*2)+5).setDirty(true);
|
||||||
|
|
||||||
this.attachWidget(plugin, HUDButton);
|
this.attachWidget(plugin, HUDButton);
|
||||||
this.attachWidget(plugin, mcMMO_label);
|
this.attachWidget(plugin, mcMMO_label);
|
||||||
|
@ -28,6 +28,7 @@ import com.gmail.nossr50.datatypes.HUDmmo;
|
|||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
|
import com.gmail.nossr50.datatypes.buttons.ButtonEscape;
|
||||||
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
|
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
|
||||||
|
import com.gmail.nossr50.datatypes.buttons.ButtonPartyToggle;
|
||||||
import com.gmail.nossr50.datatypes.popups.PopupMMO;
|
import com.gmail.nossr50.datatypes.popups.PopupMMO;
|
||||||
import com.gmail.nossr50.spout.SpoutStuff;
|
import com.gmail.nossr50.spout.SpoutStuff;
|
||||||
|
|
||||||
@ -59,8 +60,10 @@ public class mcSpoutScreenListener extends ScreenListener
|
|||||||
PP.setHUDType(HUDType.SMALL);
|
PP.setHUDType(HUDType.SMALL);
|
||||||
break;
|
break;
|
||||||
case SMALL:
|
case SMALL:
|
||||||
PP.setHUDType(HUDType.RETRO);
|
PP.setHUDType(HUDType.DISABLED);
|
||||||
break;
|
break;
|
||||||
|
case DISABLED:
|
||||||
|
PP.setHUDType(HUDType.RETRO);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
|
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
|
||||||
@ -70,6 +73,13 @@ public class mcSpoutScreenListener extends ScreenListener
|
|||||||
} else if (event.getButton() instanceof ButtonEscape)
|
} else if (event.getButton() instanceof ButtonEscape)
|
||||||
{
|
{
|
||||||
sPlayer.getMainScreen().closePopup();
|
sPlayer.getMainScreen().closePopup();
|
||||||
|
} else if (event.getButton() instanceof ButtonPartyToggle)
|
||||||
|
{
|
||||||
|
PP.togglePartyHUD();
|
||||||
|
ButtonPartyToggle bpt = (ButtonPartyToggle)event.getButton();
|
||||||
|
bpt.updateText(PP);
|
||||||
|
SpoutStuff.playerHUDs.get(sPlayer).resetHUD();
|
||||||
|
SpoutStuff.playerHUDs.get(sPlayer).initializeHUD(sPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ import com.gmail.nossr50.command.Commands;
|
|||||||
import com.gmail.nossr50.config.*;
|
import com.gmail.nossr50.config.*;
|
||||||
import com.gmail.nossr50.runnables.mcTimer;
|
import com.gmail.nossr50.runnables.mcTimer;
|
||||||
import com.gmail.nossr50.spout.SpoutStuff;
|
import com.gmail.nossr50.spout.SpoutStuff;
|
||||||
import com.gmail.nossr50.spout.mmoHelper;
|
|
||||||
import com.gmail.nossr50.listeners.mcBlockListener;
|
import com.gmail.nossr50.listeners.mcBlockListener;
|
||||||
import com.gmail.nossr50.listeners.mcEntityListener;
|
import com.gmail.nossr50.listeners.mcEntityListener;
|
||||||
import com.gmail.nossr50.listeners.mcPlayerListener;
|
import com.gmail.nossr50.listeners.mcPlayerListener;
|
||||||
@ -165,6 +164,7 @@ public class mcMMO extends JavaPlugin
|
|||||||
FileManager FM = SpoutManager.getFileManager();
|
FileManager FM = SpoutManager.getFileManager();
|
||||||
FM.addToPreLoginCache(this, SpoutStuff.getFiles());
|
FM.addToPreLoginCache(this, SpoutStuff.getFiles());
|
||||||
|
|
||||||
|
/*
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this,
|
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this,
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
|
|
||||||
@ -173,6 +173,7 @@ public class mcMMO extends JavaPlugin
|
|||||||
mmoHelper.updateAll();
|
mmoHelper.updateAll();
|
||||||
}
|
}
|
||||||
}, 20, 20);
|
}, 20, 20);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
@ -81,11 +81,6 @@ public class Party
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean inSameParty(Player playera, Player playerb){
|
public boolean inSameParty(Player playera, Player playerb){
|
||||||
if(Users.getProfile(playera) == null || Users.getProfile(playerb) == null)
|
|
||||||
{
|
|
||||||
Users.addUser(playera);
|
|
||||||
Users.addUser(playerb);
|
|
||||||
}
|
|
||||||
if(Users.getProfile(playera).inParty() && Users.getProfile(playerb).inParty())
|
if(Users.getProfile(playera).inParty() && Users.getProfile(playerb).inParty())
|
||||||
{
|
{
|
||||||
if(Users.getProfile(playera).getParty().equals(Users.getProfile(playerb).getParty()))
|
if(Users.getProfile(playera).getParty().equals(Users.getProfile(playerb).getParty()))
|
||||||
|
@ -37,6 +37,7 @@ import org.getspout.spoutapi.gui.WidgetAnchor;
|
|||||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.party.Party;
|
import com.gmail.nossr50.party.Party;
|
||||||
import com.gmail.nossr50.spout.util.GenericLivingEntity;
|
import com.gmail.nossr50.spout.util.GenericLivingEntity;
|
||||||
|
|
||||||
@ -71,10 +72,13 @@ public class mmoHelper
|
|||||||
*/
|
*/
|
||||||
public static String getColor(Player player, LivingEntity target) {
|
public static String getColor(Player player, LivingEntity target) {
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
|
if (((Player) target).isOp()) {
|
||||||
|
return ChatColor.GOLD.toString();
|
||||||
|
}
|
||||||
return ChatColor.YELLOW.toString();
|
return ChatColor.YELLOW.toString();
|
||||||
} else {
|
} else {
|
||||||
if (target instanceof Monster) {
|
if (target instanceof Monster) {
|
||||||
if (player != null && player.equals(((Creature) target).getTarget())) {
|
if (player != null && player.equals(((Monster) target).getTarget())) {
|
||||||
return ChatColor.RED.toString();
|
return ChatColor.RED.toString();
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.YELLOW.toString();
|
return ChatColor.YELLOW.toString();
|
||||||
@ -84,7 +88,7 @@ public class mmoHelper
|
|||||||
} else if (target instanceof Flying) {
|
} else if (target instanceof Flying) {
|
||||||
return ChatColor.YELLOW.toString();
|
return ChatColor.YELLOW.toString();
|
||||||
} else if (target instanceof Animals) {
|
} else if (target instanceof Animals) {
|
||||||
if (player != null && player.equals(((Creature) target).getTarget())) {
|
if (player != null && player.equals(((Animals) target).getTarget())) {
|
||||||
return ChatColor.RED.toString();
|
return ChatColor.RED.toString();
|
||||||
} else if (target instanceof Tameable) {
|
} else if (target instanceof Tameable) {
|
||||||
Tameable pet = (Tameable) target;
|
Tameable pet = (Tameable) target;
|
||||||
@ -125,12 +129,22 @@ public class mmoHelper
|
|||||||
public static String getSimpleName(LivingEntity target, boolean showOwner) {
|
public static String getSimpleName(LivingEntity target, boolean showOwner) {
|
||||||
String name = "";
|
String name = "";
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
name += ((Player)target).getName();
|
if (LoadProperties.showDisplayName) {
|
||||||
|
name += ((Player) target).getName();
|
||||||
|
} else {
|
||||||
|
name += ((Player) target).getDisplayName();
|
||||||
|
}
|
||||||
|
} else if (target instanceof HumanEntity) {
|
||||||
|
name += ((HumanEntity) target).getName();
|
||||||
} else {
|
} else {
|
||||||
if (target instanceof Tameable) {
|
if (target instanceof Tameable) {
|
||||||
if (((Tameable)target).isTamed()) {
|
if (((Tameable) target).isTamed()) {
|
||||||
if (showOwner && ((Tameable)target).getOwner() instanceof Player) {
|
if (showOwner && ((Tameable) target).getOwner() instanceof Player) {
|
||||||
name += ((Player)((Tameable)target).getOwner()).getName() + "'s ";
|
if (LoadProperties.showDisplayName) {
|
||||||
|
name += ((Player) ((Tameable) target).getOwner()).getName() + "'s ";
|
||||||
|
} else {
|
||||||
|
name += ((Player) ((Tameable) target).getOwner()).getDisplayName() + "'s ";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
name += "Pet ";
|
name += "Pet ";
|
||||||
}
|
}
|
||||||
@ -142,6 +156,8 @@ public class mmoHelper
|
|||||||
name += "Cow";
|
name += "Cow";
|
||||||
} else if (target instanceof Creeper) {
|
} else if (target instanceof Creeper) {
|
||||||
name += "Creeper";
|
name += "Creeper";
|
||||||
|
} else if (target instanceof Ghast) {
|
||||||
|
name += "Ghast";
|
||||||
} else if (target instanceof Giant) {
|
} else if (target instanceof Giant) {
|
||||||
name += "Giant";
|
name += "Giant";
|
||||||
} else if (target instanceof Pig) {
|
} else if (target instanceof Pig) {
|
||||||
@ -150,6 +166,8 @@ public class mmoHelper
|
|||||||
name += "PigZombie";
|
name += "PigZombie";
|
||||||
} else if (target instanceof Sheep) {
|
} else if (target instanceof Sheep) {
|
||||||
name += "Sheep";
|
name += "Sheep";
|
||||||
|
} else if (target instanceof Slime) {
|
||||||
|
name += "Slime";
|
||||||
} else if (target instanceof Skeleton) {
|
} else if (target instanceof Skeleton) {
|
||||||
name += "Skeleton";
|
name += "Skeleton";
|
||||||
} else if (target instanceof Spider) {
|
} else if (target instanceof Spider) {
|
||||||
@ -173,7 +191,7 @@ public class mmoHelper
|
|||||||
|
|
||||||
public static LivingEntity[] getPets(HumanEntity player) {
|
public static LivingEntity[] getPets(HumanEntity player) {
|
||||||
ArrayList<LivingEntity> pets = new ArrayList<LivingEntity>();
|
ArrayList<LivingEntity> pets = new ArrayList<LivingEntity>();
|
||||||
if (player != null && (!(player instanceof Player) || ((Player)player).isOnline())) {
|
if (player != null && (!(player instanceof Player) || ((Player) player).isOnline())) {
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
for (World world : Bukkit.getServer().getWorlds()) {
|
for (World world : Bukkit.getServer().getWorlds()) {
|
||||||
for (LivingEntity entity : world.getLivingEntities()) {
|
for (LivingEntity entity : world.getLivingEntities()) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of mmoMinecraft (http://code.google.com/p/mmo-minecraft/).
|
* This file is part of mmoMinecraft (https://github.com/mmoMinecraftDev).
|
||||||
*
|
*
|
||||||
* mmoMinecraft is free software: you can redistribute it and/or modify
|
* mmoMinecraft is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -10,15 +10,16 @@
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.gmail.nossr50.spout.util;
|
package com.gmail.nossr50.spout.util;
|
||||||
|
|
||||||
import org.getspout.spoutapi.gui.GenericTexture;
|
import org.getspout.spoutapi.gui.GenericTexture;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
|
|
||||||
public final class GenericFace extends GenericTexture {
|
public final class GenericFace extends GenericTexture {
|
||||||
|
|
||||||
private static String facePath = "http://face.rycochet.net/";
|
private static String facePath = "http://face.rycochet.net/";
|
||||||
@ -26,18 +27,20 @@ public final class GenericFace extends GenericTexture {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public GenericFace() {
|
public GenericFace() {
|
||||||
this.setWidth(defaultSize).setHeight(defaultSize).setFixed(true);
|
this("", defaultSize);
|
||||||
setName("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericFace(String name) {
|
public GenericFace(String name) {
|
||||||
this.setWidth(defaultSize).setHeight(defaultSize).setFixed(true);
|
this(name, defaultSize);
|
||||||
setName(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericFace(String name, int size) {
|
public GenericFace(String name, int size) {
|
||||||
this.setWidth(size).setHeight(size).setFixed(true);
|
if (LoadProperties.showFaces) {
|
||||||
setName(name);
|
this.setWidth(size).setHeight(size).setFixed(true);
|
||||||
|
setName(name);
|
||||||
|
} else {
|
||||||
|
this.setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -45,14 +48,18 @@ public final class GenericFace extends GenericTexture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GenericFace setName(String name) {
|
public GenericFace setName(String name) {
|
||||||
this.name = name == null ? "" : name;
|
if (LoadProperties.showFaces) {
|
||||||
super.setUrl(facePath + this.name + ".png");
|
this.name = name == null ? "" : name;
|
||||||
super.setDirty(true);
|
super.setUrl(facePath + this.name + ".png");
|
||||||
|
super.setDirty(true);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericFace setSize(int size) {
|
public GenericFace setSize(int size) {
|
||||||
super.setWidth(size).setHeight(size);
|
if (LoadProperties.showFaces) {
|
||||||
|
super.setWidth(size).setHeight(size);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is from mmoMinecraft (http://code.google.com/p/mmo-minecraft/).
|
* This file is part of mmoHelperMinecraft (https://github.com/mmoHelperMinecraftDev).
|
||||||
*
|
*
|
||||||
* mmoMinecraft is free software: you can redistribute it and/or modify
|
* mmoHelperMinecraft is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@ -10,13 +10,12 @@
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package com.gmail.nossr50.spout.util;
|
package com.gmail.nossr50.spout.util;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.getspout.spoutapi.gui.*;
|
import org.getspout.spoutapi.gui.*;
|
||||||
@ -25,7 +24,6 @@ import com.gmail.nossr50.spout.mmoHelper;
|
|||||||
|
|
||||||
public class GenericLivingEntity extends GenericContainer {
|
public class GenericLivingEntity extends GenericContainer {
|
||||||
|
|
||||||
private Container _bars;
|
|
||||||
private Container _space;
|
private Container _space;
|
||||||
private Label _label;
|
private Label _label;
|
||||||
private Gradient _health;
|
private Gradient _health;
|
||||||
@ -54,7 +52,7 @@ public class GenericLivingEntity extends GenericContainer {
|
|||||||
.setTopColor(black)
|
.setTopColor(black)
|
||||||
.setBottomColor(black)
|
.setBottomColor(black)
|
||||||
.setPriority(RenderPriority.Highest),
|
.setPriority(RenderPriority.Highest),
|
||||||
_bars = (Container) new GenericContainer(
|
new GenericContainer(
|
||||||
_health = (Gradient) new GenericGradient(),
|
_health = (Gradient) new GenericGradient(),
|
||||||
_armor = (Gradient) new GenericGradient()
|
_armor = (Gradient) new GenericGradient()
|
||||||
) .setMargin(1)
|
) .setMargin(1)
|
||||||
@ -96,7 +94,7 @@ public class GenericLivingEntity extends GenericContainer {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public GenericLivingEntity setEntity(String name, String prefix) {
|
public GenericLivingEntity setEntity(String name, String prefix) {
|
||||||
Player player = Bukkit.getServer().getPlayer(name);
|
Player player = this.getPlugin().getServer().getPlayer(name);
|
||||||
if (player != null && player.isOnline()) {
|
if (player != null && player.isOnline()) {
|
||||||
return setEntity(player, prefix);
|
return setEntity(player, prefix);
|
||||||
}
|
}
|
||||||
@ -127,7 +125,7 @@ public class GenericLivingEntity extends GenericContainer {
|
|||||||
setHealth(mmoHelper.getHealth(entity)); // Needs a maxHealth() check
|
setHealth(mmoHelper.getHealth(entity)); // Needs a maxHealth() check
|
||||||
setArmor(mmoHelper.getArmor(entity));
|
setArmor(mmoHelper.getArmor(entity));
|
||||||
setLabel((!"".equals(prefix) ? prefix : "") + mmoHelper.getColor(screen != null ? screen.getPlayer() : null, entity) + mmoHelper.getSimpleName(entity, !target));
|
setLabel((!"".equals(prefix) ? prefix : "") + mmoHelper.getColor(screen != null ? screen.getPlayer() : null, entity) + mmoHelper.getSimpleName(entity, !target));
|
||||||
setFace(entity instanceof Player ? ((Player)entity).getName() : "");
|
setFace(entity instanceof Player ? ((Player)entity).getName() : "+" + mmoHelper.getSimpleName(entity,false).replaceAll(" ", ""));
|
||||||
} else {
|
} else {
|
||||||
setHealth(0);
|
setHealth(0);
|
||||||
setArmor(0);
|
setArmor(0);
|
||||||
@ -222,8 +220,8 @@ public class GenericLivingEntity extends GenericContainer {
|
|||||||
@Override
|
@Override
|
||||||
public Container updateLayout() {
|
public Container updateLayout() {
|
||||||
super.updateLayout();
|
super.updateLayout();
|
||||||
_armor.setWidth((_bars.getWidth() * armor) / 100).setDirty(true);
|
_armor.setWidth((_armor.getContainer().getWidth() * armor) / 100).setDirty(true);
|
||||||
_health.setWidth((_bars.getWidth() * health) / 100).setDirty(true);
|
_health.setWidth((_health.getContainer().getWidth() * health) / 100).setDirty(true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user