mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 08:36:45 +01:00
Another WIP, this time with a functional GUI menu
This commit is contained in:
parent
be23f9a145
commit
6f6d065820
@ -2,13 +2,16 @@ Changelog:
|
||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
|
||||
Version 1.1.06
|
||||
Retro HUD implemented!
|
||||
With the help of Randomage the XP Formulas have been vastly changed for flexability
|
||||
With the help of Randomage the XP Formulas have been vastly changed for flexibility
|
||||
Global modifiers and skill modifiers now support decimals
|
||||
Global formula modifier dropped from config
|
||||
GigaDrillBreaker/Berserk doesn't drop clay blocks anymore
|
||||
Fixed bug where Herbalism didn't heal more for bread/stew when right clicking a block
|
||||
Fixed bug where Wheat did not use the values form the config file
|
||||
|
||||
TODO:
|
||||
Add full customization of the colors
|
||||
Fix Archery exploit
|
||||
Fix the NPE with theType
|
||||
Permission nodes for Spout elements
|
||||
Small HUD style
|
||||
|
@ -24,7 +24,7 @@ public class LoadProperties
|
||||
berserkCooldown, serratedStrikeCooldown, skullSplitterCooldown, abilityDurabilityLoss,
|
||||
feathersConsumedByChimaeraWing, repairdiamondlevel, rWood, rStone, rIron, rGold, rDiamond;
|
||||
|
||||
public static double pvpxprewardmodifier, globalxpmodifier, tamingxpmodifier, miningxpmodifier,
|
||||
public static double pvpxprewardmodifier, tamingxpmodifier, miningxpmodifier,
|
||||
repairxpmodifier, woodcuttingxpmodifier, sorceryxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier,
|
||||
archeryxpmodifier, swordsxpmodifier, axesxpmodifier, acrobaticsxpmodifier;
|
||||
|
||||
@ -381,7 +381,6 @@ public class LoadProperties
|
||||
woodcuttingrequiresaxe = readBoolean("Skills.Woodcutting.Requires_Axe", true);
|
||||
repairdiamondlevel = readInteger("Skills.Repair.Diamond.Level_Required", 50);
|
||||
|
||||
globalxpmodifier = readDouble("Experience.Formula.Multiplier.Global", 1.0);
|
||||
sorceryxpmodifier = readDouble("Experience.Formula.Multiplier.Sorcery", 1.0);
|
||||
tamingxpmodifier = readDouble("Experience.Formula.Multiplier.Taming", 1.0);
|
||||
miningxpmodifier = readDouble("Experience.Formula.Multiplier.Mining", 1.0);
|
||||
|
@ -1003,7 +1003,7 @@ public class PlayerProfile
|
||||
}
|
||||
public Integer getXpToLevel(SkillType skillType)
|
||||
{
|
||||
return (int) ((100+(skills.get(skillType) * LoadProperties.globalxpmodifier))*10);
|
||||
return (int) ((1020+(skills.get(skillType) * 20)));
|
||||
}
|
||||
|
||||
//Store the player's party
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.gmail.nossr50.datatypes.buttons;
|
||||
|
||||
import org.getspout.spoutapi.gui.GenericButton;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
public class ButtonHUDStyle extends GenericButton
|
||||
{
|
||||
public ButtonHUDStyle(PlayerProfile PP)
|
||||
{
|
||||
this.setText("HUD Type: "+PP.getHUDType().toString());
|
||||
this.setTooltip("Change your HUD style!");
|
||||
this.setWidth(120).setHeight(20);
|
||||
this.setDirty(true);
|
||||
}
|
||||
public void updateText(PlayerProfile PP)
|
||||
{
|
||||
this.setText("HUD Type: "+PP.getHUDType().toString());
|
||||
this.setDirty(true);
|
||||
}
|
||||
}
|
43
mcMMO/com/gmail/nossr50/datatypes/popups/PopupMMO.java
Normal file
43
mcMMO/com/gmail/nossr50/datatypes/popups/PopupMMO.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.gmail.nossr50.datatypes.popups;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.getspout.spoutapi.gui.GenericLabel;
|
||||
import org.getspout.spoutapi.gui.GenericPopup;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
|
||||
|
||||
public class PopupMMO extends GenericPopup
|
||||
{
|
||||
ButtonHUDStyle HUDButton = 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);
|
||||
|
||||
this.attachWidget(plugin, HUDButton);
|
||||
this.attachWidget(plugin, mcMMO_label);
|
||||
this.attachWidget(plugin, tip_escape);
|
||||
|
||||
this.setDirty(true);
|
||||
}
|
||||
|
||||
public void updateButtons(PlayerProfile PP)
|
||||
{
|
||||
HUDButton.updateText(PP);
|
||||
this.setDirty(true);
|
||||
}
|
||||
}
|
46
mcMMO/com/gmail/nossr50/listeners/mcSpoutInputListener.java
Normal file
46
mcMMO/com/gmail/nossr50/listeners/mcSpoutInputListener.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.getspout.spoutapi.event.input.InputListener;
|
||||
import org.getspout.spoutapi.event.input.KeyPressedEvent;
|
||||
import org.getspout.spoutapi.gui.ScreenType;
|
||||
import org.getspout.spoutapi.keyboard.Keyboard;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.popups.PopupMMO;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutInputListener extends InputListener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
|
||||
public mcSpoutInputListener(mcMMO pluginx)
|
||||
{
|
||||
plugin = pluginx;
|
||||
}
|
||||
|
||||
public void onKeyPressedEvent(KeyPressedEvent event)
|
||||
{
|
||||
if(!event.getPlayer().isSpoutCraftEnabled() || event.getPlayer().getMainScreen().getActivePopup() != null)
|
||||
return;
|
||||
if(event.getScreenType() != ScreenType.GAME_SCREEN)
|
||||
return;
|
||||
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
|
||||
if(event.getKey() == Keyboard.KEY_M)
|
||||
{
|
||||
if(!SpoutStuff.playerScreens.containsKey(sPlayer))
|
||||
{
|
||||
PopupMMO mmoPop = new PopupMMO(sPlayer, Users.getProfile(sPlayer), plugin);
|
||||
SpoutStuff.playerScreens.put(sPlayer, mmoPop);
|
||||
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
} else {
|
||||
sPlayer.getMainScreen().attachPopupScreen(SpoutStuff.playerScreens.get(sPlayer));
|
||||
sPlayer.getMainScreen().setDirty(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
50
mcMMO/com/gmail/nossr50/listeners/mcSpoutScreenListener.java
Normal file
50
mcMMO/com/gmail/nossr50/listeners/mcSpoutScreenListener.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.getspout.spoutapi.event.screen.ButtonClickEvent;
|
||||
import org.getspout.spoutapi.event.screen.ScreenListener;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.HUDType;
|
||||
import com.gmail.nossr50.datatypes.HUDmmo;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.buttons.ButtonHUDStyle;
|
||||
import com.gmail.nossr50.spout.SpoutStuff;
|
||||
|
||||
public class mcSpoutScreenListener extends ScreenListener
|
||||
{
|
||||
mcMMO plugin = null;
|
||||
public mcSpoutScreenListener(mcMMO pluginx)
|
||||
{
|
||||
plugin = pluginx;
|
||||
}
|
||||
public void onButtonClick(ButtonClickEvent event)
|
||||
{
|
||||
SpoutPlayer sPlayer = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(sPlayer);
|
||||
|
||||
if(event.getButton() instanceof ButtonHUDStyle)
|
||||
{
|
||||
if(SpoutStuff.playerHUDs.containsKey(sPlayer))
|
||||
{
|
||||
SpoutStuff.playerHUDs.get(sPlayer).resetHUD();
|
||||
SpoutStuff.playerHUDs.remove(sPlayer);
|
||||
|
||||
switch(PP.getHUDType())
|
||||
{
|
||||
case RETRO:
|
||||
PP.setHUDType(HUDType.STANDARD);
|
||||
break;
|
||||
case STANDARD:
|
||||
PP.setHUDType(HUDType.RETRO);
|
||||
break;
|
||||
}
|
||||
|
||||
SpoutStuff.playerHUDs.put(sPlayer, new HUDmmo(sPlayer));
|
||||
|
||||
SpoutStuff.playerScreens.get(sPlayer).updateButtons(PP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -128,7 +128,7 @@ public class Excavation
|
||||
}
|
||||
break;
|
||||
case CLAY:
|
||||
if(LoadProperties.slimeballs && PP.getSkillLevel(SkillType.EXCAVATION) >= 150)
|
||||
if(LoadProperties.slimeballs && PP.getSkillLevel(SkillType.EXCAVATION) >= 50)
|
||||
{
|
||||
if(Math.random() * 20 > 19)
|
||||
{
|
||||
@ -144,13 +144,13 @@ public class Excavation
|
||||
is.add(new ItemStack(Material.STRING, 1, (byte)0, (byte)0));
|
||||
}
|
||||
}
|
||||
if(LoadProperties.map && PP.getSkillLevel(SkillType.EXCAVATION) >= 25)
|
||||
if(LoadProperties.watch && PP.getSkillLevel(SkillType.EXCAVATION) >= 500)
|
||||
{
|
||||
if(Math.random() * 50 > 49)
|
||||
if(Math.random() * 100 > 99)
|
||||
{
|
||||
MapView mv = Bukkit.getServer().createMap(loc.getWorld());
|
||||
xp+= LoadProperties.mmap;
|
||||
is.add(new ItemStack(Material.MAP, 1, mv.getId()));
|
||||
xp+= LoadProperties.mwatch;
|
||||
is.add(new ItemStack(Material.WATCH, 1, mv.getId()));
|
||||
}
|
||||
}
|
||||
if(LoadProperties.bucket && PP.getSkillLevel(SkillType.EXCAVATION) >= 500)
|
||||
|
@ -78,6 +78,7 @@ public class Herbalism
|
||||
block.setData((byte) 0x03);
|
||||
}
|
||||
}
|
||||
|
||||
public static void greenTerra(Player player, Block block){
|
||||
if(block.getType() == Material.COBBLESTONE || block.getType() == Material.DIRT){
|
||||
if(!hasSeeds(player))
|
||||
@ -92,6 +93,7 @@ public class Herbalism
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean canBeGreenTerra(Block block){
|
||||
int t = block.getTypeId();
|
||||
if(t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38){
|
||||
|
@ -24,22 +24,33 @@ import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.HUDType;
|
||||
import com.gmail.nossr50.datatypes.HUDmmo;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.popups.PopupMMO;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.datatypes.HealthBarMMO;
|
||||
import com.gmail.nossr50.listeners.mcSpoutInputListener;
|
||||
import com.gmail.nossr50.listeners.mcSpoutListener;
|
||||
import com.gmail.nossr50.listeners.mcSpoutScreenListener;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class SpoutStuff
|
||||
{
|
||||
static mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
|
||||
|
||||
private final static mcSpoutListener spoutListener = new mcSpoutListener();
|
||||
private final static mcSpoutInputListener spoutInputListener = new mcSpoutInputListener(plugin);
|
||||
private final static mcSpoutScreenListener spoutScreenListener = new mcSpoutScreenListener(plugin);
|
||||
|
||||
public static HashMap<Player, HUDmmo> playerHUDs = new HashMap<Player, HUDmmo>();
|
||||
public static HashMap<Player, ArrayList<HealthBarMMO>> partyHealthBars = new HashMap<Player, ArrayList<HealthBarMMO>>();
|
||||
public static HashMap<SpoutPlayer, PopupMMO> playerScreens = new HashMap<SpoutPlayer, PopupMMO>();
|
||||
|
||||
|
||||
static mcMMO plugin = (mcMMO) Bukkit.getServer().getPluginManager().getPlugin("mcMMO");
|
||||
|
||||
public static void registerCustomEvent()
|
||||
{
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, Bukkit.getServer().getPluginManager().getPlugin("mcMMO"));
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutListener, Priority.Normal, plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutInputListener, Priority.Normal, plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.CUSTOM_EVENT, spoutScreenListener, Priority.Normal, plugin);
|
||||
}
|
||||
|
||||
public static Color getRetroColor(SkillType type)
|
||||
|
Loading…
Reference in New Issue
Block a user