= Fixed plugin output

This commit is contained in:
Matthew Cech
2019-05-20 15:21:39 -07:00
parent 1df71ef61d
commit b71debb9d2
4 changed files with 33 additions and 24 deletions
+9 -7
View File
@@ -82,6 +82,15 @@ StarkInfo=Snaps your icon or the icon of a friend you mentioned
[CommandYeet] [CommandYeet]
YeetInfo=Yeet yourself or yeet a friend with @! YeetInfo=Yeet yourself or yeet a friend with @!
[CommandTradeBeans]
TradeBeanseStealingBeans=Stealing is wrong! *Steals 10 beans from %s*
TradeBeansNoTargetError=You have to give *someone* your beans!
TradeBeansSuccess=%s gave %s %s of their beans!
TradeBeansStealingBeans=
TradeBeansInfo=Gives another person some of your beans! Use is `tradebeans amount @person`!
TradeBeansIntParseError=That's not a real number!
TradeBeansNotEnoughError=You don't have enough beans!
[CommandPollVote] [CommandPollVote]
PollVoteNotValidNumber=That's not a vaild number! PollVoteNotValidNumber=That's not a vaild number!
PollVoteInfo=Vote in a poll with the choice number, won't work if no poll is running, you can't change your vote once you have cast it! Be careful! PollVoteInfo=Vote in a poll with the choice number, won't work if no poll is running, you can't change your vote once you have cast it! Be careful!
@@ -228,11 +237,4 @@ MapVersion=Using mapgen v0.1
MapWidth=Width MapWidth=Width
MapHeight=Height MapHeight=Height
[CommandTradeBeans]
TradeBeansInfo=Gives another person some of your beans! Use is `tradebeans amount @person`!
TradeBeansNoTargetError=You have to give *someone* your beans!
TradeBeansIntParseError=That's not a real number!
TradeBeansNotEnoughError=You don't have enough beans!
TradeBeanseStealingBeans=Stealing is wrong! *Steals 10 beans from %s*
TradeBeansSuccess=%s gave %s %s of their beans!
+9 -5
View File
@@ -50,17 +50,15 @@ public class Plugin
public List<String> Run(String args, PluginUser user) public List<String> Run(String args, PluginUser user)
{ {
List<String> outputs = new Vector<String>();
try try
{ {
List<String> outputs = new Vector<String>();
LuaValue res = func_plugin.call(LuaValue.valueOf(args), user.AsLua()); LuaValue res = func_plugin.call(LuaValue.valueOf(args), user.AsLua());
if(!res.isnil()) if(!res.isnil())
{ {
if(res.istable()) if(res.istable())
{
while(true)
{ {
LuaValue key = LuaValue.NIL; LuaValue key = LuaValue.NIL;
while (true) while (true)
@@ -74,12 +72,18 @@ public class Plugin
outputs.add(value.toString()); outputs.add(value.toString());
} }
} }
}
else else
{ {
System.out.println("Loc2.5 " + res.toString());
outputs.add(res.toString()); outputs.add(res.toString());
} }
} }
if(outputs.size() <= 0)
return null;
return outputs;
} }
catch(Exception e) catch(Exception e)
{ {
+4 -1
View File
@@ -90,7 +90,10 @@ public class Main extends ListenerAdapter
List<String> pluginOutput = pluginManager.RunAll(input.message, user); List<String> pluginOutput = pluginManager.RunAll(input.message, user);
if(pluginOutput != null && pluginOutput.size() > 0) if(pluginOutput != null && pluginOutput.size() > 0)
response.Call(pluginOutput.get(0)); {
for(int i = 0; i < pluginOutput.size(); ++i)
response.Call(pluginOutput.get(i));
}
} }
// Run any upkeep in post we need to // Run any upkeep in post we need to